Changes

551 bytes added ,  05:26, 17 May 2015
→‎Interface Profile: Figured out endpoint descriptors, but it's kind of weird
Line 96: Line 96:  
     UhsConfigDescriptor cfg_desc;
 
     UhsConfigDescriptor cfg_desc;
 
     UhsInterfaceDescriptor if_desc;
 
     UhsInterfaceDescriptor if_desc;
     char unknown4c[0x16c - 0x4c];
+
     char in_endpoints[0xdc - 0x4c];
 +
    char out_endpoints[0x16c - 0xdc];
 
} UhsInterfaceProfile;
 
} UhsInterfaceProfile;
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
in_endpoints and out_endpoints are arrays of USB endpoint descriptors, but parsing them isn't exactly straightforward. The USB specification defines endpoint descriptors as 7-bytes, but UHS also supports 9-byte endpoints. Anyone programming with this API will have to iterate through the lists, applying casts as necessary. All USB endpoint descriptors start with a length, so check that first. If it's 0, assume the endpoint is empty and go 9-bytes forward for the next one. If it specifies a size, use that.
203

edits