Can I access USB HID device via a Chrome App?

陌路散爱 提交于 2019-12-12 08:54:53

问题


I have a simple little dongle I want to debug by sending/receiving basic USB messages. It enumerates as an HID device (like an additional mouse), but am worried that I won't have access to it. I forgot the hardware and can't test with it for a couple days.

Is it a futile effort to continue building a chrome extension to test it?

Chrome App, USB documentation: https://developer.chrome.com/apps/app_usb Getting-started example: https://github.com/GoogleChrome/chrome-app-samples/tree/master/usb/knob


回答1:


Google Chrome now proposes a USB HID API. Have a look at the API: https://developer.chrome.com/apps/hid

The API is still defined as experimental at the time of this message. But it is functional. I have just written a tutorial to explain how to use this API.

Have a look: http://www.appnearme.com/blog/2014/7/21/chrome-usb-hid-controlling-your-usb-device-javascr/




回答2:


You can't build a Chrome Extension to use that API, only Apps are allowed access.

That said, the JS side of things will probably not be the hard part, the example you linked provides an ample starting point. But I can't quickly find a ready library to do so, so prepare for relatively low-level hardware stuff.

Edit: Seems like there will be an API for that: https://code.google.com/p/chromium/issues/detail?id=290428



来源:https://stackoverflow.com/questions/23037402/can-i-access-usb-hid-device-via-a-chrome-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!