greatscottgadgets/luna

Add Microsoft OS Descriptors for WinUSB support

supersat opened this issue · 3 comments

Upon running ViewSB on Windows with the LUNA backend, I get this mysterious message:

  File "C:\Users\supersat\Downloads\git\ViewSB\luna\gateware\applets\analyzer.py", line 193, in build_and_configure
    raise RuntimeError('Timeout! The analyzer device did not show up.')
RuntimeError: Timeout! The analyzer device did not show up.

It turns out the device did show up in the Windows Device Manager, but it didn't know what to do with it. (Apollo seems to work out of the box). Adding a WINUSB-compatible descriptor to the analyzer backend would allow Windows to automatically load the WinUSB driver for this device, and thus make it immediately available to libusb and thus ViewSB

It looks like doing this properly would require updating python-usb-protocol to support BOS and MS OS 2.0 descriptors. But python-usb-protocol also seems to not support descriptor fields that don't have a standard type prefix (e.g., w, b, i, etc.), but USB 3.0 added GUIDs as a potential descriptor field with no corresponding prefix...

Note that the analyzer gateware has now moved to the Cynthion repo, but adding WCID descriptors is a feature that belongs in LUNA, so keeping this here. We'll need to add this before Cynthion release to ensure easy use on Windows.

Microsoft OS 1.0 descriptors were implemented in #251, and are now in use on Cynthion gateware.

There is also some work in progress by @mndza to add the 2.0 version of the spec, based on previous work from orbtrace, but the 1.0 version is sufficient to achieve Windows compatibility for most use cases.