supercollider / hidapi

A Simple library for communicating with USB and Bluetooth HID devices on Linux, Mac, and Windows.
http://www.signal11.us/oss/hidapi/
Other
13 stars 14 forks source link

usage tables are inconsistent and incomplete #20

Open beatboxchad opened 3 months ago

beatboxchad commented 3 months ago

This repository currently includes some custom YAML files to store the usage metadata for HID. This is how you get useful descriptions of the control data coming from your devices. The report just has numbers, this metadata has the names. There's a "Digitizer" page with "Touchscreen" and "X" and "Y". The semantics are in the HID report structure (how many "X" and "Y" axes does a touchscreen send?)

SuperCollider reads these files as-needed in HIDUsage.getUsageDescription, but they're an incomplete and inconsistent representation of the official tables. I just wrote some tests for the HIDUsage class and discovered that the usage/page names in SuperCollider's version are underscored some places, truncated in others -- there's no consistent formatting scheme. In addition, the usage tables are incomplete, and it looks like they were last updated around 2016. They were likely built by hand -- the committer is not a Github user or I'd @ them to ask.

The official doc -- which anyone developing HID code will find super useful for its detailed descriptions of the usage data -- includes a JSON attachment that has all the data, updated annually. I think SuperCollider ought to just use that.

beatboxchad commented 3 months ago

Although this change has a small potential to break somebody's code if they used HIDUsage.getUsageIds with one of the reformatted names, I'd guess that such issues would be minimal and easy to document. SuperCollider's HIDUsage, per the documentation, is mostly used internally.