tikihiki has asked for the wisdom of the Perl Monks concerning the following question:
Copied from http://stackoverflow.com/questions/25799890/win32serialport-cant-find-device, as I didn't get a response.
I'm writing a perl script where I need to read and write to a device connected by serial, and it always fails with "can't find device".
Here is the relevant code:
my $portObj = new Win32::SerialPort("COM67") || return "0";This fails and returns 0. I confirmed that the device was present in device manager. I did see that COM1 and COM3 ports did work, while COM67 and COM22 did not.
I hope maybe it's some kind of silly string error related to a 5 character port name...
But I think the device doesn't allow writes or something and that's causing this issue. But if that was the case, I would expect it to only cause problems when I attempt a write. I've used a terminal program (putty) to read from the device so I know reads are possible.
Also, worst case scenario, I can rearrange the code so that I only need read capability. This is a much less ideal solution though.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::SerialPort can't find device
by ww (Archbishop) on Sep 12, 2014 at 22:53 UTC |