in reply to Re: finding a serial port with Win32::SerialPort
in thread finding a serial port with Win32::SerialPort
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: finding a serial port with Win32::SerialPort
by Marshall (Canon) on Aug 22, 2011 at 11:58 UTC | |
You have to ask Win32 what the names of the COM ports are or probe up to a certain COMxx number. There are USB ports that can show up as COM ports and I don't know how to create a complete list. I think its hard to do because a new COM port can just "show up" dynamically (i.e. when you plug in a new USB device). This may not be right, but this is what it does on my machine.
I think perhaps another possibility is to "probe COM ports". Use a block "eval" on the "open_uart($_);" statement. >br> Run through the first 32 ports. If a port works works then $_ is a valid COM port and push it onto some stack.
| [reply] [d/l] [select] |
by pashanoid (Scribe) on Aug 22, 2011 at 15:02 UTC | |
This produces 3 com ports out of 1 existing... any chance of modifying it, so that it would show the propper one working COM2 or COM1? Here is my output:
My code:
| [reply] [d/l] [select] |
by Marshall (Canon) on Aug 24, 2011 at 11:52 UTC | |
You are getting some sort of response from both "virtual" serial ports - that is different than "no device connected" - you have "wires to something" on those two ports and the OS is saying that it can talk to what it thinks are 2 devices. This good! So how does your app work when you talk to COM1? I do not know (if either) of these COM devices is the serial device that you want to talk to. But is likely that software COM1 and COM2 are aliases to the same physical serial port. You have to experiment with this! If you have only one physical DB-9 connector on the motherboard, that is very likely to be true.
| [reply] |
|
Re^3: finding a serial port with Win32::SerialPort
by Anonymous Monk on Aug 22, 2011 at 10:59 UTC | |
Yes, because my... You need to enumerate serial ports first | [reply] |
by pashanoid (Scribe) on Aug 22, 2011 at 14:59 UTC | |
| [reply] |