D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] Adventures with USB-serial converter

 

I have set up a PC to sit in a cupboard monitoring water temperature.
There is a little pc board that takes the measurement and feeds it to
the serial port. I had a laptop with a serial port and this worked ok
until the laptop broke and the replacement doesn't have a serial port.
I got a USB-serial converter (with the Prolific chip) and with the
usbserial module (thanks Robin) I can connect the device. All I had to
do was change the fopen() to open /dev/ttyUSB0. Trouble is, this works
for a while and then stops.  It stops when fgets returns null with the
error number 0, ie Success (!), and I then find that /dev/ttyUSB0 does
not exist but /dev/ttyUSB1 does.  If I restart the program to read
from /dev/ttyUSB1 it works for a while then stops in the same way and
then /dev/ttyUSB1 doesn't exist but /dev/ttyUSB0 does. And so on. So
now I run a script that reads from ttyUSB0 and ttyUSB1 alternately. 
Which is satisfactory if a little odd.

Tony Sumner

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html