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

I need to talk to USB devices from my WinXP computer. Is there a PERL module available similar to TelNet?

Replies are listed 'Best First'.
Re: USB module
by GrandFather (Saint) on Sep 22, 2005 at 04:22 UTC

    I'm not sure there is really a simple Perl answer. However so that you appreciate what's going on, a little background may help.

    USB devices use device drivers which are accessed either by using CreateFile to open file handles - if you know the nasty "filename" for the device (enumerating USB devices to get their "file names" is a bit exciting BTW), or hook themselves into various parts of the system depending on the sort of device that they are (mice, sound devices, disk drives ...).

    So if the device you wish to access looks like a disk drive, treat it just like a disk drive. If it is something "special" then you will need a special answer. If you wish to post a little more information about the type of device and how you want to use it, I may be able to help further.


    Perl is Huffman encoded by design.
      The device I need to talk to from a WinXp is not any of the usual devices. It is a special piece of equipment that uses a USB interface. I was wondering how to use PERL to open a connection to a USB device. This device connects to a USB HUB that connects to my PC. Think of this device as a piece of TEST EQUIPMENT with a USB interface. In TelNet I would do use Net::Telnet(); $t = new Net::Telnet (Host = "XXX.XXX.XXX", port = "yyyy"); $t->open(HOST); $t=cmd(String => "This is a test");

        USB just does not work like that. When the usb device is connected a device driver is loaded for the device. If the device is a HID (Human Interface Device) like a mouse, the operating system provides the driver. If the device is vendor specific the manufacturer of the device provides the device driver. The device driver presents some sort of software interface to applications. The interface presented depends very much on the nature of the device.

        The device that you describe sounds like it has an ethernet port on it and acts as an IP device. That has nothing at all to do with it possibly having a USB port, except that it may present itself as a class of USB device that looks to the system as an IP device. If that is the case the your Telnet technique would still work. If not, then you have to find out a lot more about the vendor specific interface that is provided, and then have some serious work to do to access that from Perl.


        Perl is Huffman encoded by design.
Re: USB module
by InfiniteSilence (Curate) on Sep 21, 2005 at 23:45 UTC
    You might try clicking here or better yet, just use the search box at the top and type "usb".

    Celebrate Intellectual Diversity

Re: USB module
by ikegami (Patriarch) on Sep 21, 2005 at 22:14 UTC

    Have you heard of CPAN? Putting telnet in the seach box brings up Net::Telnet.

    As previously hinted in this thread, the protocol is named TELNET, and the language is named Perl.

    Update: Oops, maybe I misunderstood your question. Do your USB devices actually have an IP address? If not, this won't help.

Re: USB module
by ambrus (Abbot) on Sep 21, 2005 at 21:55 UTC

    What's TelNet?

      or PERL?