OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Connect device using WebUSB and Flutter

  • Thread starter Thread starter mohammed_sajid
  • Start date Start date
M

mohammed_sajid

Guest
I'm trying to connect a device using WebUSB and Flutter. But I get this error when trying to connect:

Code:
NetworkError: Failed to execute 'claimInterface' on 'USBDevice': Unable to claim interface.

The code in JavaScript:

Code:
async function requestADBDevice() {
try {
    const device = await navigator.usb.requestDevice({ filters: [] });
    await device.open();
    await device.selectConfiguration(1);
    await device.claimInterface(0);
    console.log('Device connected:', device);

    window.adbDevice = device;

    return device;
} catch (error) {
    console.error('Error: ' + error);
}

}

<p>I'm trying to connect a device using WebUSB and Flutter.
But I get this error when trying to connect:</p>
<pre><code>NetworkError: Failed to execute 'claimInterface' on 'USBDevice': Unable to claim interface.
</code></pre>
<p>The code in JavaScript:</p>
<pre><code>async function requestADBDevice() {
try {
const device = await navigator.usb.requestDevice({ filters: [] });
await device.open();
await device.selectConfiguration(1);
await device.claimInterface(0);
console.log('Device connected:', device);

window.adbDevice = device;

return device;
} catch (error) {
console.error('Error: ' + error);
}
</code></pre>
<p>}</p>
 

Latest posts

Top