【问题标题】:Why is a USB bulk transfer with Perl's Device::USB cut off?为什么使用 Perl 的 Device::USB 进行 USB 批量传输会被切断?
【发布时间】:2011-07-29 15:03:48
【问题描述】:

我在 Linux 上运行了这个 Perl 代码:

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);

使用Wireshark,我发现实际传输的应用数据是

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

打印$bytesWritten 显示传输了 20 个字节,但这与 Wireshark 捕获的不同。

可能是什么问题?

【问题讨论】:

  • 谁能告诉我形成bulk_transfer URB的正确方法? byte 变量是否应该只包含我想发送的命令/数据,还是我需要在其中放入任何其他内容?
  • @daxim,感谢您向我展示如何使我的帖子更具可读性:)
  • wiki.wireshark.org/CaptureSetup/USB 上的信息有什么启示吗?即,您是否使用内核 >= 2.6.21 和 libpcap >= 1.1.0?
  • perl 的 strace 显示什么?通过系统调用请求推送多少,系统调用说发送了多少?
  • 你使用的是什么版本的 libusb?

标签: linux perl usb


【解决方案1】:

Perl 程序可能工作正常。

我见过wireshark截断USB数据包(另一个参考: http://www.mail-archive.com/tcpdump-workers@lists.tcpdump.org/msg04042.html)。

我必须使用“usbmon”应用程序来获取完整的捕获: http://people.redhat.com/zaitcev/linux/

【讨论】:

    猜你喜欢
    • 2017-02-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-15
    • 1970-01-01
    相关资源
    最近更新 更多