WICG / webusb

Connecting hardware to the web.
https://wicg.github.io/webusb/
Other
1.3k stars 126 forks source link

Support Landing Page for Any Device #225

Closed codembed closed 1 year ago

codembed commented 1 year ago

Does WebUSB require at least one interface not claimed by the OS?

I like the landing page feature, however I have only got this to work when there is an interface not claimed by an OS class driver.

I use WebHID and Web Serial to access my composite device, but it seems I have to add a dummy interface in order to facilitate the landing page functionality of WebUSB. I have no need to access USB interfaces or endpoints directly, but I'd like the user to see the URL hint.

Is this by design? Could the landing page be supported for any device that exposes the WebUSB platform capability descriptor, regardless of the interface availability?

The downside of my 'dummy interface' work-around is that Windows now refuses to initiate selective suspend for this device; while the serial and HID class drivers support low power modes, the WinUSB driver assigned to the unused interface does not.

reillyeon commented 1 year ago

What you're hitting is a limitation in the Windows APIs. Without an interface that the WinUSB driver has attached to applications like the browser can't make the custom USB requests necessary to request the landing page descriptor. When I recently rewrote the code Chrome uses on Windows to make better use of the USB hub driver API I tried using it to make these custom descriptor requests but it doesn't work, we need to go through the WinUSB driver.

codembed commented 1 year ago

Ah, yet another beloved Windows USB API quirk...

@reillyeon Thanks for the explanation.