mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2025-01-09 07:45:34 +00:00
Apply suggestions from code review
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
This commit is contained in:
parent
811402a423
commit
e554c2756a
2 changed files with 2 additions and 4 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
When the host issues a GET_DESCRIPTOR *Configuration* request the device needs to respond with the requested configuration descriptor *plus* all the interface and endpoint descriptors associated to that configuration descriptor during the DATA stage.
|
||||
|
||||
A GET_DESCRIPTOR Configuration request is a GERT_DESCRIPTOR request where the descriptor type encoded in the high bit of `wValue` is CONFIGURATION.
|
||||
A GET_DESCRIPTOR Configuration request is a GET_DESCRIPTOR request where the descriptor type encoded in the high bit of `wValue` is CONFIGURATION.
|
||||
|
||||
We have covered configurations and endpoints but what is an *interface*?
|
||||
|
||||
|
@ -80,4 +80,3 @@ The interface descriptor in the response should contain these fields:
|
|||
Again, we strongly recommend that you use the `usb2::configuration::Descriptor` and `usb2::interface::Descriptor` abstractions here. Each descriptor instance can be transformed into its byte representation using the `bytes` method -- the method returns an array. To concatenate both arrays you can use an stack-allocated [`heapless::Vec`] buffer. If you haven't the `heapless` crate before you can find example usage in the the `src/bin/vec.rs` file.
|
||||
|
||||
[`heapless::Vec`]: https://docs.rs/heapless/0.5.5/heapless/struct.Vec.html
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ The definition of `Descriptor::Configuration` as well as the associated test has
|
|||
Your task now is to parse the data of this SETUP stage. We will start with the GET_DESCRIPTOR request, which is described in detail in section 9.4.3 of the USB specification. All the constants you will need are described in Tables 9-3, 9-4 and 9-5.
|
||||
|
||||
The fields of a GET_DESCRIPTOR request are as follows:
|
||||
- `bmrequesttype` is 0b10000000
|
||||
- `bmRequestType` is 0b10000000
|
||||
- `bRequest` is GET_DESCRIPTOR
|
||||
- the high byte of `wValue` contains the descriptor type, whereas the low byte contains the descriptor index
|
||||
- `wIndex` is set to 0 for our purposes
|
||||
|
@ -56,4 +56,3 @@ INFO:usb_2 -- Goal reached; move to the next section
|
|||
|
||||
You can find a solution to step 1. in `advanced/common/usb/get-descriptor-device.rs`.
|
||||
You can find a solution to step 2. in `advanced/firmware/src/bin/usb-2-solution.rs`.
|
||||
|
||||
|
|
Loading…
Reference in a new issue