Error in response to usb.claimInterface: Error claiming interface.
I got the same error on chrome 60 too.
Here are the codes:
1. chrome.usb.getDevices( DEVICE_INFO, function(devices) {
{device: 0, manufacturerName: "ACS", productId: 37068, productName: "CCID USB Reader", serialNumber: "",
2. chrome.usb.openDevice(devices[0], function(connection) {
{handle: 1, productId: 37068, vendorId: 1839}
3. chrome.usb.listInterfaces(openedDevice, function(interfaces) {
{alternateSetting: 0, endpoints: Array(3), extra_data: ArrayBuffer, interfaceClass: 11, interfaceNumber: 0, …}
endPoint = interfaces[0].endpoints[0];
{address:
129, direction: "in", extra_data: ArrayBuffer, maximumPacketSize: 8,
pollingInterval: 16, …} var interfaceNumber =
interfaces[0].interfaceNumber;
claimInterface(interfaceNumber);
4.
function claimInterface(interfaceNumber) {
console.log("claimInterface() is called,",interfaceNumber);
console.log(openedDevice);
// interfaceNumber is always zero
//Error in response to usb.claimInterface: Error claiming interface.
chrome.usb.claimInterface(openedDevice, interfaceNumber,function() {
if ( ! chrome.runtime.lastError) {
//console.log("claimInterface.",claimInterfaces);
//callback(foundDevice);
console.log(chrome.runtime.lastError);
} else {
console.log(chrome.runtime.lastError);
throw chrome.runtime.lastError.message;
}
});
}
manifest.json file
{
"name": "Acs Card Reader",
"description": "Chang Shin, Macate",
"version": "0.1",
"manifest_version": 2,
"app": {
"background": {
"scripts": ["background.js"]
}
},
"icons": { "16": "add-icon-16.png", "128": "add-icon-128.png" },
"permissions": ["usb","hid",
{
"usbDevices": [
{ "vendorId": 1839, "productId": 37068 }
]
}
]
}