-1

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:

  • "For example, if the device is a USB mass storage device that interface is not claimable and if there are no other interfaces the device will be hidden." (Link)
  • "The following set of USB interface classes, which should not be claimed using the WebUSB API, will be explicitly blocked by Blink: Audio, Video, HID, Mass Storage[...]" (Link)
  • "It cannot. USB mass storage devices are claimed by the system's generic USB mass storage class driver and are therefore unavailable to the browser." (Link)

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?

  • 1
    thanks but as mentioned the usb device is not listed, thus USBDevice.serialNumber cannot be accessed. – user3691763 Jan 05 '22 at 10:56
  • Looks like mass storage devices are only available via the [WebHID API](https://developer.mozilla.org/en-US/docs/Web/API/WebHID_API). But a `HIDDevice` has no serial number -> [Serial number · Issue #34 · WICG/webhid · GitHub](https://github.com/WICG/webhid/issues/34) – Andreas Jan 05 '22 at 11:07
  • Unfortunately also when using HID the device is not recognized... (and of course the serial number problem is still there) – user3691763 Jan 05 '22 at 11:22

1 Answers1

0

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

François Beaufort
  • 4,843
  • 3
  • 29
  • 38