libusb 接口已声明
我正在使用 libusb 为 USB 设备编写设备驱动程序。当我尝试认领该设备时,我收到错误代码 LIBUSB_ERROR_BUSY (-6)。根据文档,这意味着该设备已被认领(链接 )。
我如何找出哪个驱动程序/程序已声明该设备,更重要的是,我自己如何在设备声明后声明该设备。
代码片段:
r = libusb_claim_interface(handle[0], 0);
if (r < 0) {
fprintf(stderr, "libusb_claim_interface error %d\n", r);
goto out_release;
}
printf("claimed interface\n");
输出:
libusb_claim_interface error -6
I'm writing a device driver for a usb device using libusb. When I attempt to claim the device I get the error code LIBUSB_ERROR_BUSY (-6). According to the documentation that means that the device has already been claimed (link).
How do I find out which driver/program has claimed the device and more importantly, how can I, myself, claim the device once it's claimed.
Code snippet:
r = libusb_claim_interface(handle[0], 0);
if (r < 0) {
fprintf(stderr, "libusb_claim_interface error %d\n", r);
goto out_release;
}
printf("claimed interface\n");
Output:
libusb_claim_interface error -6
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否在
libusb_claim_interface()
之前调用libusb_detach_kernel_driver()
?这可能是必要的。Do you call
libusb_detach_kernel_driver()
beforelibusb_claim_interface()
? This may be necessary.该问题很可能是另一个 Linux 驱动程序声明了该接口。调用 libusb_detach_kernel_driver() 并指定接口号,然后您应该能够连接它。
The issue is most likely that interface is claimed by another Linux driver. call
libusb_detach_kernel_driver()
and specify the interface number and then you should be able to connect it.您是否在
libusb_claim_interface()
之前调用了libusb_set_configuration()
?即使描述符中只有一种配置,也必须调用此函数。
Did you call
libusb_set_configuration()
beforelibusb_claim_interface()
?This must be called even if there is only one configuration in the descriptor.