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

[WIP] Add support for UAC3 descriptors #61

Closed
wants to merge 8 commits into from
Closed

[WIP] Add support for UAC3 descriptors #61

wants to merge 8 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Nov 29, 2017

This adds a new way of dumping descriptors, which splits the knowledge of how to interpret descriptor data from the actual dumping. This has two advantages:

  1. It is easy to add support for new descriptors, since they are now simple definitions that resemble the tables in the USB specifications.
  2. The code for dumping descriptors is common, so the output is easy to keep consistent. It is also consistent and thorough in its handling of insufficient descriptor data buffer, and junk data at the end of a descriptor.

UAC1 and UAC2 are converted to use the new mechanism, and finally initial support for UAC3 is added.

@ghost
Copy link
Author

ghost commented Nov 29, 2017

I would be really grateful for any feedback on this.

For the descriptor definitions stuff, my aim was to make the definitions as readable as possible, and make them easy to write from the tables in the USB specifications.

I have not moved all the the descriptor dumping over to the new mechanism, just the ones where I've added support for UAC3 variants.

For UAC3, the changes here give much more useful output, however there are more parts of UAC3 that I have not yet added support for.

@ghost
Copy link
Author

ghost commented Nov 30, 2017

I've tweaked desc_dump(). Previously it took an buffer, buf, and the descriptor definition desc, and it assumed that the buffer started at the start of the descriptor (i.e. pointing at bLength), but that the first three bytes of the buffer had already been dumped. Now this assumption is removed, making the API more generally useful.

UAC1 and UAC2 have different different meanings for the same subtype
value.  This splits the subtype mapping out.
These descriptor definitions descibe how raw descriptor data
should be interpreted.
@ghost
Copy link
Author

ghost commented Dec 3, 2017

Added support for dumping the USB3 BOS Configuration Summary Descriptor and improved the comment for get_uac_interface_subtype().

This adds a new way of dumping descriptors.  It takes the descriptor
data to be dumped, and a descriptor definition as input.

The descriptor definition takes the form of a NULL terminated array
of descriptor field definitions.

These definitions describe how the raw descriptor data buffer should
be interpreted.

Thus the knowledge of how to interpret a descriptor buffer is separate
from the shared code that renders the descriptor dump.  This has two
advantages:

1. The code for dumping descriptors is common, so the output is easy
   to keep consistent.  It is also consistent and thorough in its
   handling of insufficient descriptor data buffer, and junk data
   at the end of a descriptor.

2. It is easy to add support for new descriptors, since they are now
   simple definitions that resemble the tables in the USB specifications.
This gives us more consistency in handling of incorrect descriptor
buffer lengths, and improves whitespace/alignment consistency.
@ghost
Copy link
Author

ghost commented Dec 5, 2017

Added the option to tell the descriptor dumper to read the buffer length from the first field in the descriptor definition, and made the Configuration Summary use that.

This will be simpler going forwards with USB Audio Class 3 high capability descriptors, which have a two byte wLength field instead of the one byte bLength; the descriptor dumper will be able to do the right thing itself if the definition includes these common fields.

@gregkh
Copy link
Owner

gregkh commented Dec 5, 2017

This series is getting long, how about just posting it on the linux-usb mailing list and we can review it and iterate there? That should be easier overall, as I have a lot of individual code comments which is a pain to do in github :)

@ghost
Copy link
Author

ghost commented Dec 5, 2017

OK, I've subscribed to the list. It seems git send-email is currently not configured right, so I'll post my series there once I've worked out this config issue.

@gregkh
Copy link
Owner

gregkh commented Dec 5, 2017 via email

@ghost
Copy link
Author

ghost commented Dec 5, 2017

Ah, thanks! I'll unsubscribe if I find it too high-volume then. :)

@ghost
Copy link
Author

ghost commented Dec 5, 2017

Looks like I found the right runes. :) Sent to the linux-usb list.

@ghost
Copy link
Author

ghost commented Dec 7, 2017

I sent v2 to the list. Should I close this merge request, or update it with what I sent to the list?

@gregkh
Copy link
Owner

gregkh commented Dec 7, 2017 via email

@ghost
Copy link
Author

ghost commented Dec 7, 2017

OK, suits me too. :)

Closing: Discussion has moved to linux-usb mailing list.

@ghost ghost closed this Dec 7, 2017
This pull request was closed.
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.

None yet

2 participants