如何从 USB 端口向 HTML 网站发送信号?

How do I send a signal from a USB port to a HTML website?

我知道有一个 javascript(也许是图书馆?)可以处理这个问题,但语法是什么,我该怎么做?另外,我如何编码 usb 以将信号发送到 JS 或 HTML?

(抱歉,我对所有硬件都是菜鸟,我需要这个才能工作 XD)

你可以使用 node-usb 这个 https://github.com/tessel/node-usb, compare the docs to the USB basics in http://www.beyondlogic.org/usbnutshell/usb1.shtml

一般来说,访问 USB 设备必须完成以下步骤:

  • 设备

  • 配置(在node-usb中只支持默认配置)

  • 认领界面

  • 访问端点(写入和读取实际数据)

cf http://www.dreamincode.net/forums/topic/148707-introduction-to-using-libusb-10/ 和其他 libusb 教程

node-usb 的一般示例在 How to send data to USB device in node.js using libusb

http://mikeheavers.com/tutorials/reading_data_from_usb_devices_using_javascript/

一个更高级的例子(kinect控制)在https://github.com/schakko/node-usb/blob/master/examples/kinect/kinect.js

( https://developers.google.com/web/updates/2016/03/access-usb-devices-on-the-web )