WebUSB接口示例

WebUSB interface example

我了解安全问题和实施的更改,如下所述: https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/LZXocaeCwDw/GLfAffGLAAAJ

但是由于我的设备不再工作了,我想知道:

  1. 是否有一个示例接口描述符,我可以使用它来实现我的 USB 设备(如果它在没有 udev 规则或必须由用户安装的 Windows 驱动程序的情况下工作会有所帮助)?
  2. 是否有首选 类 使用哪个将支持更长时间(例如 0xFF 供应商特定)?

如有任何帮助,我们将不胜感激。

  1. 您现有的接口描述符,将 bInterfaceClass 设置为供应商特定的 0xff 而不是其当前值将工作正常。在 Linux 上,需要一个 udev 规则才能使 USB 设备节点可由浏览器写入。在 Windows 上,您将需要实施 Microsoft OS 2.0 descriptor platform capability descriptor in order to instruct Windows to load the right driver by default when the device is connected. An example of all of these descriptors is included in the WebUSB Arduino library in WebUSB.cpp.
  2. 您的接口可能应该是特定于供应商的 (0xff),除非它实现的是标准化设备 class,该设备不是受保护接口 classes 之一。