in reply to Re^2: basic serial and USB access
in thread basic serial and USB access

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

Replies are listed 'Best First'.
Re^4: basic serial and USB access
by apotheon (Deacon) on Feb 03, 2008 at 20:39 UTC

    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

      I don't know how it works for other operating systems, but with Windows (at least in the past) the device gets matched by P&P using its PID and VID to a kernel mode driver that knows how to talk to the device. The main job of the driver is to handle P&P and other aspects of the USB bus that are incidental to the higher level conceptual operation of the device. You really really don't want to deal with a USB device at the level that drivers do. Most device manufacturers wouldn't make the information available to allow you to do that in any case.

      If what you will be dealing with is simply serial devices over a RS-232 to USB adapter, then your Perl code wouldn't know the difference in any case. If you are trying to develop some sort of generic test system, then you will need to write some sort of plug in code technology to handle different devices types over different interfaces.


      Perl is environmentally friendly - it saves trees

        Thanks for all that information.

        I'm looking at writing code for sensor testing now -- and the same code may be used again, with modifications, for another project a little further along. I unfortunately don't know a lot of details about what's actually going to be used in each case, but I'm trying to familiarize myself with the most likely technologies (based on what I know so far), maybe write some code as I wait for more information to arrive, before I actually have to do the work.

        Anyway . . . you've given me some things to think about. I appreciate the help.

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