Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full descriptor dumps for lsusb verbose output #23

Merged
merged 63 commits into from
Jul 15, 2024
Merged

Full descriptor dumps for lsusb verbose output #23

merged 63 commits into from
Jul 15, 2024

Conversation

tuna-f1sh
Copy link
Owner

@tuna-f1sh tuna-f1sh commented Jul 9, 2024

Provides full functionality of the --lsusb --verbose mode, closing #15:

  • Getting strings at strings indexes in descriptors.
  • Getting extra descriptor information with USB control messages for HID reports etc.
  • Dumping all the descriptor types supported by lsusb verbose mode; audio, video, MIDI etc.
  • Getting extra device descriptors: hub, debug, device qualifiers, device status and binary object stores.

A lot of work reviewing and porting lsusb.c, desc-defs.c and desc-dumps.c, plus grunt work creating all the types. I'm not entirely happy with all the types but they enable the --verbose dump and can expand as the crate develops. For example, It would be good to add extra enum/impl helpers for some of the in-dump decoding still done in lsusb.rs.

There are quite possibly still some bugs in the formatting of some of the descriptor dumps and perhaps parsing; it's so comprehensive and scope so large I can't test it all - I've done my best to avoid any panics though; it should be more robust than the lsusb code.

  • I believe the only thing outstanding is the do_otg dump. I'll look at doing this.
  • I'd also like to refactor the MIDI code into the MIDI subtypes and put within the audio class.
  • And while I'm at it refactor CDC into subtypes.
  • Possibly the StreamingFormatType.

@tuna-f1sh tuna-f1sh linked an issue Jul 9, 2024 that may be closed by this pull request
tuna-f1sh added 21 commits July 9, 2024 15:10
Mostly a port of the desc-defs.c and desc-dumps.c, trying to make more
Rust like but some C style lingering. Should probably refactor all
descriptors into specific structs, so they are useful as a module not
just for lsusb dumps.

Need to finish UAC descriptors, dump then maybe take it from there. Also
left is do_hub, superspeed etc.
just audio controls to finish. It's not pretty and not Rusty but works
for consistency with `--lsusb --verbose` mode. In future the descriptor
structs could probably have traits/impl/more enum for getting the
String placeholders
file size was getting too large. Sub-modules for descriptors makes sense
with intention to add more; video, hub, otg, dfu etc.
Allows storage in ClassDescriptor::Audio rather than storing
GenericDescriptor and converting on demand. Also allows profiler to grab
strings at defined index.

Need to convert remaining Audio Streaming descriptors to use custom
types rather than raw decode in lsusb.rs.

Intend to use same style for UvcDescriptor in a video.rs file.
@tuna-f1sh tuna-f1sh mentioned this pull request Jul 13, 2024
3 tasks
@tuna-f1sh tuna-f1sh merged commit 54a834e into main Jul 15, 2024
4 checks passed
@tuna-f1sh tuna-f1sh deleted the dumps branch July 15, 2024 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HID Device Descriptor support
1 participant