RE: Configfs composite gadget with CCID and mass storage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> ConfigFS is used to compose a gadget of existing functions.
> As far as I can tell there is no smart card CCID usb function in kernel, so either you need to have your own out-of-tree implementation or implement it in userspace with FunctionFS.

I also could not find a CCID usb function in the kernel so my intention is to implement it in user space with FunctionFS.

> FunctionFS is a specific USB function which forwards most of USB traffic to userspace. FunctionFS can be composed into a gadget with ConfigFS, but, by design, its function directory in ConfigFS is _empty_. In other words, if you
> 
> mkdir functions/ffs.ccid
> 
> you have empty functions/ffs.ccid. You need to mount corresponding FunctionFS instance (ccid) and provide all the descriptors the way FunctionFS expects it.

I mounted the FunctionFS instance (ccid) by doing

mount -t functionfs ccid /dev/gadget

Note that "/dev/gadget" is not there because of GadgetFS. It is an empty directory. The mount is successful and "ep0" appears in "/dev/gadget". After the mount I start the user space application which writes the descriptors, as the structure "descriptors" listed below, to "/dev/gadget/ep0". The application only writes the interface descriptor, CCID class descriptor and endpoint descriptors.

struct {
  struct usb_functionfs_descs_head header;
  struct {
    struct usb_interface_descriptor intf;
    struct ccid_class_descriptor ccid;
    struct usb_endpoint_descriptor_no_audio source; 
    struct usb_endpoint_descriptor_no_audio sink;
  } __attribute__((packed)) fs_descs, hs_descs;
} __attribute__((packed)) descriptors;

Then I get the kernel error "invalid length: 54 (descriptor 33)". How should I pass the CCID class descriptor?

Thanks for the help,
Pieter

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux