Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Device::USB Read/Write

by flbiggs (Novice)
on Dec 08, 2010 at 00:14 UTC ( #875916=perlquestion: print w/ replies, xml ) Need Help??
flbiggs has asked for the wisdom of the Perl Monks concerning the following question:

I am trying read and write to/from a USB scanner to extend the functionality of sane a bit. I am able to view the device information and endpoints fairly easily with the following code:

my $usb = Device::USB->new(); my $dev = $usb->find_device( VENDOR, PRODUCT ); print Dumper $dev;

My problem is that I cannot quite figure out how to provide appropriate parameters for the interrupt_read, interrupt_write, bulk_read and bulk_write methods.

For example, the documentation for interrupt_write provides:

interrupt_write - Perform a interrupt write request to the specifi +ed endpoint. ep - The number of the endpoint to write bytes Buffer - Buffer from which to write the requested data. timeout - Maximum time to wait (in milliseconds)

Is 'ep' the full bEndpointAddress or just its lower 3 bits. How do I set up Buffer? Is that an array reference?

Could someone please provide some sample perl code that performs a read or write using Device::USB (or point me to a website)?

Thanks

Comment on Device::USB Read/Write
Select or Download Code
Re: Device::USB Read/Write
by Khen1950fx (Canon) on Dec 08, 2010 at 14:32 UTC
    I think that rocket-test by Michael Schilli is exactly what you're looking for.

      That article is exactly what I was looking for. Thank you very much!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2014-08-23 02:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (171 votes), past polls