我想要制作一个Chrome,可以访问一个USB SmartCard阅读器(HID全球OmniKey 3121)。
有人成功过吗?
不幸的是,我无法看到它使用usb.getDevices。
script.js (由index.html调用,其本身由background.js onLaunched调用):
//dom elements
var findBtn = document.querySelector( "button#find-btn" )
var deviceInfo = document.querySelector( "p#device-info" )
//{click}
findBtn.addEventListener( "click", findDevice )
/*
* Try to find HID OmniKey 3x21
*/
function findDevice ()
{
var options = {
filters: [
{
vendorId: 1899, //OmniKey AG
productId: 12321 //CardMan 3121 but PID=0x3021
}
]
}
chrome.usb.getDevices( options, function ( devices )
{
console.log( devices )
deviceInfo.innerHTML = JSON.stringify( devices[0] )
} )
}该设备在清单中声明,并在扩展页面中由Chrome识别。
提前谢谢你的帮助。
编辑
这是我的manifest.json
{
"manifest_version": 2,
"name": "Card Reader",
"description": "Smartcard reader",
"version": "0.0.2",
"minimum_chrome_version": "43",
"app": {
"background": {
"scripts": [ "js/background.js" ]
}
},
"permissions": [
"usb",
{
"usbDevices": [
{
"vendorId": 1057,
"productId": 1633
},
{
"vendorId": 1133,
"productId": 49271
},
{
"vendorId": 1899,
"productId": 12321
}
]
}
]
}这3种允许的装置是:
只有鼠标才能被usb.getDevices或usb.findDevices识别。只有鼠标被usb.getUserSelectedDevices列出。
发布于 2015-10-02 07:52:46
当使用HID Global的本地驱动程序时,Chrome无法识别该设备。
解决方法是使用备用USB驱动程序,例如Zadig安装程序从zadig.akeo.ie提供的驱动程序。
我在HID设备上开了一个箱子,但是他们的技术支持还没有理解这个问题(他们不知道Chrome平台是什么.)然后把我转到谷歌。
我在谷歌开了个案,但他们回答我,我应该在StackOverflow上发帖!!他们似乎不介意他们的平台不能识别标准的USB SmartCard设备,尽管在Windows设备管理器中可以看到.
更新
HID技术支持部门表示,他们的司机将在2016年前支持该平台。古尔格的支持还在..。不合适。
Windows7-10更新
在Windows 7和10上,我不需要安装通用驱动程序。相反,我只编辑Windows设备管理器中的Smartcard Reader并选择前面的驱动程序。它将恢复到Windows通用的USB驱动程序,该驱动程序可以与我的遗留PC/SC Winscard应用程序和我的Chrome应用程序一起工作。
https://stackoverflow.com/questions/32737190
复制相似问题