Dear Linux USB hackers, I am currently trying to implement a CCID (chip card reader) using usb-configf + usb-functionfs. As per the USB CCID class specification, there's a class-specific functional descriptor that follows the interface descriptor. When trying to send this descriptor from userspace as part of the FUNCTIONFS_DESCRIPTORS_MAGIC_V2 write to the "ep0" file, it fails. Enabling DEBUG/VERBOSE_DEBUG, I can see the following: [16189.883174] Buffer from user space: [16189.883176] : 03 00 00 00 64 00 00 00 01 00 00 00 05 00 00 00 ....d........... [16189.883177] : 09 04 00 00 03 0b 00 00 01 36 21 10 01 07 07 01 .........6!..... [16189.883177] : 00 00 00 88 13 00 00 20 4e 00 00 00 80 25 00 00 ....... N....%.. [16189.883178] : 00 10 0e 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ [16189.883178] : 00 10 00 00 00 10 01 00 00 ff ff 00 00 00 08 07 ................ [16189.883179] : 05 81 03 40 00 00 07 05 02 02 00 00 00 07 05 83 ...@............ [16189.883180] : 02 00 00 00 .... [16189.883180] read descriptors [16189.883187] __ffs_data_got_descs() [16189.883189] ffs_do_descs() [16189.883190] __ffs_data_do_entity() [16189.883191] ffs_do_single_desc() [16189.883192] interface descriptor [16189.883193] entity INTERFACE(00) [16189.883194] __ffs_data_do_entity() [16189.883194] entity STRING(01) [16189.883195] __ffs_data_do_entity() [16189.883196] __ffs_data_do_entity() [16189.883196] ffs_do_single_desc() [16189.883197] hid descriptor [16189.883198] invalid length: 54 (descriptor 33) [16189.883199] ffs_do_descs returns -22 This shows that somehow the kernel assumes I'm sending a HID descriptor, despite sending a CCID descriptor. AFAICT, ffs_do_single_desc() is unilaterally assuming that 0x21 would be a HID descriptor, without verifying whether the interface class actually is HID. IMHO, ffs_do_single_desc() should not make assumptions about class-specific descriptors without ensuring that the current interface actually matches that class. I'm not familiar with the entire variety of class specific descriptors. Is it customary to have string descriptor indexes in them? If not, why doesn't ffs_do_single_desc() simply bypass/ignore any class-specifid descriptors? IMHO it's rather cumbersome if f_fs.c would have to explicitly implement code for each and every class descriptor that some current or future usb class specifies. That sort-of defeats the idea of having a generic kernel module enabling the implementation of whatver usb interface/class in userspace. Please let me know what your thoughts are. I'm happy to work on a a related patch, but I'd like to know what the USB developers' position is on how this is best resolved. I'm not a subscribe to the linux-usb list. Please keep me in Cc of the related responses/thread. Thanks. Regards, Harald -- - Harald Welte <laforge@xxxxxxxxxxxx> http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6)