Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: basic serial and USB access

by apotheon (Deacon)
on Feb 01, 2008 at 20:17 UTC ( #665639=note: print w/ replies, xml ) Need Help??


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

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


Comment on Re^2: basic serial and USB access
Re^3: basic serial and USB access
by GrandFather (Cardinal) on Feb 01, 2008 at 22:35 UTC

    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

        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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://665639]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2014-09-16 10:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (7 votes), past polls