in reply to Re: Connecting to a USB Serial Device on Windows
in thread Connecting to a USB Serial Device on Windows

Wahoo! After a bit of goofing around and some pure luck I was able to make it work. I modified Win32::ComPort.pm, increasing the CP_Length from 64 to 66 as follows:
if (($CP_Length > 64) and ($self->{"_TYPE"} == PST_RS232)) {
to
if (($CP_Length > 66) and ($self->{"_TYPE"} == PST_RS232)) {
Then I installed Device::Modem and wrote the following:
#!perl use strict; #http://search.cpan.org/~cosimo/Device-Modem-1.51/ use Device::Modem; my $port="COM9"; my $modem = new Device::Modem( port =>$port ); if($modem->connect( baudrate => 115200,databits=>8,parity=>'none',stop +bits=>1 ) ) { print "connected!\n"; } else{ print "Error: Unable to connect with $port!.\n\t$!\n"; exit; } print "CMD->"; while(1){ my $cmd=<STDIN>; if($cmd=~/^(x|q|exit|quit)$/is){last;} $cmd =~s/[\r\n\t\s]+$//; $cmd =~s/^[\r\n\t\s]+//; $modem->atsend($cmd . Device::Modem::CR); print $modem->answer(); } #disconnect from the Modem $modem->disconnect(); print "\nDONE\n";
And it all works. I am able to communicate to my usb device, passing it commands and seeing the returning answer. Wahoo!
s/te/ve/

Replies are listed 'Best First'.
Re^3: Connecting to a USB Serial Device on Windows
by GrandFather (Saint) on Jul 10, 2009 at 22:19 UTC

    Very well done! There is actually already a bug report (#33559) at rt://Win32-SerialPort and the module author (or someone) has replied. The two other people who experienced the problem did what you have done with mixed success. It might not hurt to add your two bits worth in the hope that the module author can find a general solution to the issue and at least knows that a) there are people using the module, and b) people are seeing the same problem (module authors like feedback, even / especially bug reports).


    True laziness is hard work
Re^3: Connecting to a USB Serial Device on Windows
by Anonymous Monk on Nov 26, 2016 at 00:46 UTC
    Changes to Win32::ComPort.pm worked for me too. Thank you very much
Re^3: Connecting to a USB Serial Device on Windows
by Anonymous Monk on Jul 13, 2009 at 19:56 UTC
    I ran into the same error message. Changes made to the Win32::ComPort.pm file definitely made things work. THANKS!