Tell us more about what you are trying to achieve and we may be able to help more. Running a program several times doesn't sound like a sensible use of a computer to me. I'd be writing the code to make the guesses and test the outcomes - run one program once and let the computer do the hard work.
True laziness is hard work
| [reply] |
GrandFather -
Here is what I'd like to do:
We have a Cisco box that doesn't output anything on the Console line other than jibberish. This is often due to just to a mismatch between the settings on the device and the settings on the COM port used to connect. So before we ditch this box for having a bad console port, I'd like to have my script 'query' the console port and get its settings (if that's at all possible). Right now, when I run my program all it does is return the values that are set by me on my COM port on the PC. What I want is the program to tell me what the current settings are on the switch. We got this switch off of Craigslist for twenty bucks, and we can't do a thing with it until we can get a console connection. Because of the age of the switch (circa 2000) there's no hardware reset that we know of. We've cracked it open and tried serial connection headers and shorting pins, but no luck. So if it isn't possible to have the device cough up its current settings using Win32::SerialPort, perhaps it's possible with another module? If it isn't possible at all, meaning I don't fully understand the way a serial port works, then it was my thought to have the script keep all variables constant except for one (like baudrate) and modify its value sequentially. Then I would send some characters to the device and record the output. When I get something back I can read, I know I've got the right settings.
Regards,
Scott
| [reply] |
Bottom line: you can't ask the hardware - it doesn't know and can't tell what the settings are.
As you suggest (and as I suggested in Re: Win32::SerialPort Query Current Values) the only way to figure it out is to "suck it to see". Re-read that reply. It tells you which parameters are important and how they should be set for quickest results.
True laziness is hard work
| [reply] |