我正在开发一个JavaScript库,以通过chrome webusb API使用CCID协议执行智能卡操作。当我在Linux和MacOS上插入智能卡读卡器时,一切都会顺利进行,但是当尝试声明该接口时,我却卡在了Windows上。我试图以管理员身份运行chrome,在Windows上禁用智能卡服务/ CCID驱动程序,以防万一有人声称该接口,但是却无济于事。我一直显示“无法声明接口:访问被拒绝(权限不足)”消息。这真的是权限问题吗?还是我不知道阻止某些Windows服务访问?
编辑:我尝试在另一台Mac,读者无法正常工作。从CCID驱动程序info.plist中删除了特定的供应商ID /产品ID之后,我设法使其工作。所以我想在Windows上也会发生同样的问题,一个CCID驱动程序正在“阻塞”访问接口。我有什么选择?
设备描述符:
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x1a44 VASCO Data Security International
idProduct 0x0001 Digipass 905 SmartCard Reader
bcdDevice 1.02
iManufacturer 1 VASCO
iProduct 2 DP905v1.1
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 93
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 50mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0 …Run Code Online (Sandbox Code Playgroud) 在一个项目中,我尝试使用 Chrome 中可用的 WebUSB API 来使用 Zebra LP2844 打印机进行打印。
我在 OSX 上毫无问题地取得了成功,并最终在 Ubuntu 和 ChromeOS 上取得了成功,这要归功于这篇讨论解除内核驱动程序绑定以便 Chrome 能够访问设备的帖子。
我为此使用的页面通过https 提供,因为文档需要它。
但是,在 Windows 10 上,我可以使用 navigator.usb.requestDevice 连接到打印机,如下所示
但是当我在打印例程期间在连接的打印机上调用 open() 时,我不断收到下一个错误
错误 DOMException:访问被拒绝。
这是打印方法代码:
print : async function(printString) {
let startTime = new Date().getTime();
if (!this.pairedPrinter) {
console.log("No printer connected");
return;
}
try {
if (!this.pairedPrinter.opened) {
await this.pairedPrinter.open();
}
await this.pairedPrinter.claimInterface(0);
let encoder = new TextEncoder();
const printBuffer = encoder.encode(printString);
let printResult = await this.pairedPrinter.transferOut(6, …Run Code Online (Sandbox Code Playgroud)