I'm trying to connect a USB Thermal Printer to my Android Tablet (Samsung Galaxy Tab S4, Android 9) via WEBUSB but I'm getting this error when trying to claim the interface: "Failed to claim interface 0: Device or resource busy (16)"
I'm posting the code but I don't think the issue is here since it works fine on Windows 10(after changing the default driver to WinUSB using Zadig):
this.printerProvider = navigator['usb'];
this.printerProvider.requestDevice({filters: []})
.then(selectedDevice => {
this.device = selectedDevice;
return this.device.open();
})
.then(() => {
return this.device.selectConfiguration(1);
})
.then(() => {
return this.device.claimInterface(this.device.configuration.interfaces[0].interfaceNumber);
})
.then(() => {
for (let ep of this.device.configuration.interfaces[0].alternate.endpoints) {
if (ep.direction == 'out') {
this.endpoint = ep;
console.log('USB PRINTER CONNECTED')
}
}
})
.catch((err) => {
console.log(err);
})
and in fact I got the same result using the nice tool provided in this article: https://labs.mwrinfosecurity.com/blog/webusb/ this tool basically tries to claim all the interfaces.
So, my guess is that Android itself has claimed the interface. I've also tried to enable the developer options to see if there was something useful there but I didn't find anything.
Any help is very appreciated.
Mat