1

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?

Greeshma
  • 11
  • 3
  • 1
    Could you please add your code? [See how to ask question](https://meta.stackexchange.com/help/how-to-ask) – edkeveked Dec 07 '17 at 10:42
  • Possible duplicate of [Failed to claim interface 0: Device or resource busy](https://stackoverflow.com/questions/47695160/failed-to-claim-interface-0-device-or-resource-busy) – Reilly Grant Dec 12 '17 at 23:53

1 Answers1

-1

This question is a duplicate of "Failed to claim interface 0: Device or resource busy ".

Reilly Grant
  • 5,590
  • 1
  • 13
  • 23