javascriptgoogle-chromeusbwebusb

WebUSB access mass storage USB serial number


I am trying to access a USB mass storage device using the WebUSB interface. I have read that USB mass storage devices cannot be accessed:

We are currently using usb sticks for a standalone version of the app where the serial number of the usb stick is important to identify the license. For our new software I also need to access the serial number of the usb mass storage device, but best would be if I could do so in the browser.

Google Chrome does recognise the device as can be seen here.

Chrome is recognizing the device

But when asking for access to a device via WebUSB it is not shown in the list: enter image description here

My code is pretty straight forward:

navigator.usb.requestDevice({ filters: [] }).then(e => {console.log(e)});

Is there any way to access the serial number of the USB mass storage device using a browser interface?


Solution

  • The short answer is no.

    The internal page about:usb-internals should show you interfaces that are blocked in WebUSB. As you can see in the screenshot below, "Mass Storage" USB devices are indeed not accessible in WebUSB for security reasons.

    screenshot