MCS has asked for the wisdom of the Perl Monks concerning the following question:

I have a usb to serial converter and I can't figure out how to access it in perl. I am on OS X and when I plug the usb converter in it creates two devices, /dev/tty.usbserial and /dev/cu.usbserial

The device I want to connect to is a obdII car datalogger. I have the information on what commands to send etc, but I can't figure out how to send and recieve data from it. I'm not even sure which one I should use.

If anyone could provide some guidance I would greatly apreciate it.

Replies are listed 'Best First'.
Re: /dev/tty.usbserial access
by Abigail-II (Bishop) on Jan 14, 2004 at 21:22 UTC
    What's your Perl question? To open a file in perl (and /dev/whatever is just a file), use open. To write something, use print or syswrite.

    The format of the data you need to write (or read) isn't Perl specific. You'd read/write the same thing if you wanted to it in C or Java.

    Abigail

      thanks, I wasn't sure if I needed to print to it in a certain way. Also when I tried it initially, I used the /dev/tty.usbserial and it didn't work. Now that you mentioned that's what I needed to do I tried the /dev/cu.usbserial and it works.