用于 USB 目标用户 space 驱动程序的 libusb

libusb for USB target user space driver

我想通过 libusb 在用户 space 中实现一个 USB 设备驱动程序。我正在使用支持 USB OTG 控制器的 Linux 机器,该控制器已切换到设备模式。 USB 主机是另一台机器,它需要通过具有批量 in/out 接口的 USB 供应商特定接口与我的 Linux 机器通信。

我想知道是否可以使用 libusb 与另一端的 USB 主机通信。或者,如果 libusb 只能用于主机端功能。

如果 libusb 不能使用,有没有其他方法可以在用户 space 中实现设备驱动程序?

谢谢。

据我所知,这是不可能的。 (Vanilla) libusb 仅供主机使用,因为如何使用 libusb 的整个过程只能提供这种模式。

你可以在老libusb的FAQ中找到答案(libusbx之前,老libusb的废弃,libusbx重命名为新libusb): libusb FAQ

还有一个关于这个主题的问题和一些建议: How to communicate with the USB Host from a Linux USB Client