in reply to cant read serial data with Device::SerialPort
Why do you not check the value of $length? (If you do check that, what do you get?) Why do you check "$buffer eq ''" before you check "!defined $buffer"?
If $length is greater than zero (which means $buffer must be defined), what would you see if you did this before returning:
(You might want to avoid setting $buffer to the initial value of RED,"NO DATA",RESET -- just set it to undef or "" to start with.)printf( "%2.2x ", $_ ) for ( split //, $buffer ); print "\n";
Since you are doing a non-blocking read on the port, my first guess is that the device is not responding with data, so the original content of $buffer is not being replaced.
Are you using the same host computer (i.e. dual-boot windows/linux), or different boxes? If the latter, are you using the same serial cable on both OS's? (I would always have a null-modem adapter on hand for this kind of thing, and if a device/cable doesn't work without the adapter, I put on the adapter and try again.)
|
|---|