简体   繁体   English

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

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

I know that there is a javascript (maybe library?) that can handle this, but what is the syntax and how do I do this? 我知道有一个可以处理此问题的javascript(也许是库?),但是语法是什么,我该怎么做? Also, how do I code the usb to send the signal to the JS or HTML? 另外,如何编码USB以将信号发送到JS或HTML?

(sorry, but I am a noob at all things hardware, and I need this to work XD) (对不起,但是我在所有硬件上都不是菜鸟,而我需要这个才能使用XD)

you can use node-usb for this https://github.com/tessel/node-usb , compare the docs to the USB basics in http://www.beyondlogic.org/usbnutshell/usb1.shtml 您可以为此https://github.com/tessel/node-usb使用node-usb ,将文档与http://www.beyondlogic.org/usbnutshell/usb1.shtml中的USB基础知识进行比较

in general for accessing a USB device the following steps have to be done : 通常,要访问USB设备,必须完成以下步骤:

  • device 设备

  • configuration ( in node-usb only the default configuration is supported ) 配置(在node-usb中,仅支持默认配置)

  • claim interface 索取界面

  • access endpoints ( writing and reading the actual data ) 访问端点(写入和读取实际数据)

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

a general example for node-usb is in How to send data to USB device in node.js using libusb node-usb的一般示例是如何使用libusb将数据发送到node.js中的USB设备

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

a more advanced example ( kinect control ) is in https://github.com/schakko/node-usb/blob/master/examples/kinect/kinect.js https://github.com/schakko/node-usb/blob/master/examples/kinect/kinect.js中有一个更高级的示例(kinect控件)

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM