I am trying to develop a webusb api using html and javascript and operating system is Ubuntu 16.04. I am able to connect and open the usb device from browser, but I got an error 'Failed to claim interface 0: Device or resource busy (16)'. Please give me a proper solution.
This is the script code, var device;
function setup(device) {
alert(device.productName+" open");
return device.open()
.then(() => device.selectConfiguration(1))
.then(() => device.claimInterface(0))
.then(() => this.device_.selectAlternateInterface(1, 0))
}
function connect() {
if (device == null) {
navigator.usb.requestDevice({ filters: [{ vendorId : 2352 }] })
.then(selectedDevice => {
device = selectedDevice;
console.log(device);
return setup(device);
alert("usb connected");
})
.catch(error => { console.log(error); })
}
}
navigator.usb.getDevices()
.then(devices => {
if (devices.length > 0) {
device = devices[0];
return setup(device);
}
})
.catch(error => { console.log(error); });
and this is the rule file I added
SUBSYSTEM=="usb", ATTR{idVendor}=="0930",ATTR{idProduct}=="6544", MODE="0666", GROUP="plugdev"
Whether I can done this by detaching the device from kernal? How it is possible?