in reply to Re^3: finding a serial port with Win32::SerialPort
in thread finding a serial port with Win32::SerialPort

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:

[pasha@pelikan file]$ wine reg.exe trying COM1 trying COM2 trying COM3 can't read Device Control Block for \\.\COM3 at registry.pl line 11 unable to open COM3 trying COM4 can't read Device Control Block for \\.\COM4 at registry.pl line 11 unable to open COM4 trying COM5 File not found can't open device: \\.\COM5 at registry.pl line 11 unable to open COM5 trying COM6 File not found can't open device: \\.\COM6 at registry.pl line 11 unable to open COM6 trying COM7 File not found can't open device: \\.\COM7 at registry.pl line 11 unable to open COM7 trying COM8 File not found can't open device: \\.\COM8 at registry.pl line 11 unable to open COM8 trying COM9 File not found can't open device: \\.\COM9 at registry.pl line 11 unable to open COM9 trying COM10 File not found can't open device: \\.\COM10 at registry.pl line 11 unable to open COM10 trying COM11 File not found can't open device: \\.\COM11 at registry.pl line 11 unable to open COM11 trying COM12 File not found can't open device: \\.\COM12 at registry.pl line 11 unable to open COM12 trying COM13 File not found can't open device: \\.\COM13 at registry.pl line 11 unable to open COM13 trying COM14 File not found can't open device: \\.\COM14 at registry.pl line 11 unable to open COM14 trying COM15 File not found can't open device: \\.\COM15 at registry.pl line 11 unable to open COM15 trying COM16 File not found can't open device: \\.\COM16 at registry.pl line 11 unable to open COM16 trying COM17 File not found can't open device: \\.\COM17 at registry.pl line 11 unable to open COM17 trying COM18 File not found can't open device: \\.\COM18 at registry.pl line 11 unable to open COM18 trying COM19 File not found can't open device: \\.\COM19 at registry.pl line 11 unable to open COM19 trying COM20 File not found can't open device: \\.\COM20 at registry.pl line 11 unable to open COM20 trying COM21 File not found can't open device: \\.\COM21 at registry.pl line 11 unable to open COM21 trying COM22 File not found can't open device: \\.\COM22 at registry.pl line 11 unable to open COM22 trying COM23 File not found can't open device: \\.\COM23 at registry.pl line 11 unable to open COM23 trying COM24 File not found can't open device: \\.\COM24 at registry.pl line 11 unable to open COM24 trying COM25 File not found can't open device: \\.\COM25 at registry.pl line 11 unable to open COM25 trying COM26 File not found can't open device: \\.\COM26 at registry.pl line 11 unable to open COM26 trying COM27 File not found can't open device: \\.\COM27 at registry.pl line 11 unable to open COM27 trying COM28 File not found can't open device: \\.\COM28 at registry.pl line 11 unable to open COM28 trying COM29 File not found can't open device: \\.\COM29 at registry.pl line 11 unable to open COM29 trying COM30 File not found can't open device: \\.\COM30 at registry.pl line 11 unable to open COM30 trying COM31 File not found can't open device: \\.\COM31 at registry.pl line 11 unable to open COM31 trying COM32 File not found can't open device: \\.\COM32 at registry.pl line 11 unable to open COM32

My code:

#!/usr/bin/perl use strict; use Win32::SerialPort; #my @valid_com_ports; foreach my $port_to_open ( map{"COM$_"}1..32) { print "trying $port_to_open\n"; eval { my $PortObj = new Win32::SerialPort ($port_to_ +open) or print "unable to open $port_to_open\n"; }; }

Replies are listed 'Best First'.
Re^5: finding a serial port with Win32::SerialPort
by Marshall (Canon) on Aug 24, 2011 at 11:52 UTC
    This sounds good in that the field has been narrowed to either COM1 or COM2!
    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.