Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is a USB bulk transfer with Perl's Device::USB cut off?

Tags:

linux

perl

usb

I ran this Perl code running on Linux:

my $command = "\x{11}\x{22}\x{33}\x{44}\x{55}\x{66}\x{77}\x{88}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}\x{00}"; # total of 20 bytes to transmit
my $bytesWritten = $device->bulk_write(0x01, $command, 1000);

Using Wireshark, I found the actual application data transmitted to be

0000    00 00 00 00 00 00 00 00    00 00 00 00 00 00 00 00
0010    00 00 00 00 00 00 00 00    11 22 33 44

Printing $bytesWritten reveals that 20 bytes were transferred, but this is different from what was captured by Wireshark.

What could be the problem?

like image 955
SOS Avatar asked Apr 05 '11 02:04

SOS


1 Answers

It is possible that Perl program is working properly.

I've seen wireshark truncate the USB packets (one other reference: http://www.mail-archive.com/[email protected]/msg04042.html).

I had to use "usbmon" application to get the full capture: http://people.redhat.com/zaitcev/linux/

like image 132
theamk Avatar answered Oct 19 '22 23:10

theamk