usb: pack the CDC line coding struct to its 7 wire bytes
uint32_t plus three uint8_t pads to 8, so sizeof(line) was 8 where CDC defines 7. Hosts asking for more than 7 got a byte of uninitialised static padding. The commented out SET_LINE_CODING loop already hardcodes i < 7, so the wire format was understood; the struct just did not match. No observable change for cdc_acm or usbser.sys, which both ask for exactly 7. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
5cf1b18c1e
commit
fcb61153f8
2 files changed
+4
-1
No files matched your search
@@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
|
||||
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
|
||||
|
||||
## [unreleased][unreleased]
|
||||
- Fixed `GET_LINE_CODING` - the CDC line coding struct is now packed to the 7 bytes the spec defines (@iceman1001)
|
||||
- Fixed USB control transfers - a descriptor whose length is an exact multiple of the 8 byte control endpoint now ends with a zero length packet (@iceman1001)
|
||||
- Fixed USB WCID descriptors - the device advertised Microsoft OS descriptor support in string 0xEE but stalled the vendor request that follows (@iceman1001)
|
||||
- Added `hf mfdes sim` - answers GetDFNames and GetISOFileIDs, so a reader sees the ISO file ids and DF names of the simulated card (@iceman1001)
|
||||
|
||||
@@ -140,12 +140,14 @@ static const char *getStringDescriptor(uint8_t idx) {
|
||||
}
|
||||
|
||||
|
||||
// CDC LineCoding is 7 bytes on the wire, so this must not pick up the padding
|
||||
// byte that natural alignment would add after DataBits.
|
||||
typedef struct {
|
||||
uint32_t BitRate;
|
||||
uint8_t Format;
|
||||
uint8_t ParityType;
|
||||
uint8_t DataBits;
|
||||
} AT91S_CDC_LINE_CODING, *AT91PS_CDC_LINE_CODING;
|
||||
} PACKED AT91S_CDC_LINE_CODING, *AT91PS_CDC_LINE_CODING;
|
||||
|
||||
static AT91S_CDC_LINE_CODING line = { // purely informative, actual values don't matter
|
||||
USART_BAUD_RATE, // baudrate
|
||||
|
||||
Reference in new issue
Block a user