开发者

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

开发者 https://www.devze.com 2023-02-22 05:38 出处:网络
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}\\开发者_开发知识库

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?


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/tcpdump-workers@lists.tcpdump.org/msg04042.html).

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号