in reply to basic serial and USB access

It looks like Device::SerialPort may be what you are after (a CPAN module search for 'serial' turned it up on the second page: http://search.cpan.org/search?m=module&q=serial&s=11).

You won't find anything generic for USB, it doesn't work that way. It's a 'bus' (Universal Serial Bus).


Perl is environmentally friendly - it saves trees

Replies are listed 'Best First'.
Re^2: basic serial and USB access
by proceng (Scribe) on Feb 02, 2008 at 13:53 UTC
    If the device is attached via a serial to USB connector, use Device::SerialPort. When the device is attached, a device will be created at /dev/ttyUSBx. Make sure the permissions are set for your user to be able to read and write to the device. Most serial to USB cables/adapters are Prolific PL-2303 (lsusb will tell you).
    Good Luck.
Re^2: basic serial and USB access
by apotheon (Deacon) on Feb 01, 2008 at 20:17 UTC
    You won't find anything generic for USB, it doesn't work that way. It's a 'bus' (Universal Serial Bus).

    So . . . there's no way to get data directly from a USB device? That doesn't make sense to me.

    print substr("Just another Perl hacker", 0, -2);
    - apotheon
    CopyWrite Chad Perrin

      From a specific type of USB device, yes. From USB devices generally, no. It's rather like saying: "How do I get data from a PCI bus device". There is no general answer because PCI is a bus and the way you interact with a graphics card is vastly different than the way you interact with a USB host controller. In that respectUSB is identical to PCI.

      Forget the "Serial" bit of "Universal Serial Bus" - it has no relationship with RS-232 serial which is the "serial port" protocol that you are talking about. Think of it as a Universal Bus and remember that the way you might communicate with a digital camera is rather different than the way you communicate with a keyboard or mouse.

      Actually, for most USB devices the USB part is irrelevant in terms of high level control of the device. You need to access the API presented by the device driver for the specific device you want to use.


      Perl is environmentally friendly - it saves trees

        Is there no way to access data from such a device, in Perl, without a device driver?

        print substr("Just another Perl hacker", 0, -2);
        - apotheon
        CopyWrite Chad Perrin