~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/usb/functionfs.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/usb/functionfs.rst (Version linux-6.12-rc7) and /Documentation/usb/functionfs.rst (Version linux-4.9.337)


  1 ====================                              
  2 How FunctionFS works                              
  3 ====================                              
  4                                                   
  5 Overview                                          
  6 ========                                          
  7                                                   
  8 From kernel point of view it is just a composi    
  9 unique behaviour.  It may be added to an USB c    
 10 the user space driver has registered by writin    
 11 strings (the user space program has to provide    
 12 that kernel level composite functions provide     
 13 the configuration).                               
 14                                                   
 15 This in particular means that the composite in    
 16 may not be in init section (ie. may not use th    
 17                                                   
 18 From user space point of view it is a file sys    
 19 mounted provides an "ep0" file.  User space dr    
 20 write descriptors and strings to that file.  I    
 21 to worry about endpoints, interfaces or string    
 22 simply provide descriptors such as if the func    
 23 only one (endpoints and strings numbers starti    
 24 interface numbers starting from zero).  The Fu    
 25 them as needed also handling situation when nu    
 26 different configurations.                         
 27                                                   
 28 For more information about FunctionFS descript    
 29                                                   
 30 When descriptors and strings are written "ep#"    
 31 (one for each declared endpoint) which handle     
 32 a single endpoint.  Again, FunctionFS takes ca    
 33 numbers and changing of the configuration (whi    
 34 "ep1" file may be really mapped to (say) endpo    
 35 configuration changes to (say) endpoint 2)).      
 36 for receiving events and handling setup reques    
 37                                                   
 38 When all files are closed the function disable    
 39                                                   
 40 What I also want to mention is that the Functi    
 41 a way that it is possible to mount it several     
 42 a gadget could use several FunctionFS function    
 43 each FunctionFS instance is identified by the     
 44 when mounting.                                    
 45                                                   
 46 One can imagine a gadget that has an Ethernet,    
 47 where the last two are implemented via Functio    
 48 level it would look like this::                   
 49                                                   
 50   $ insmod g_ffs.ko idVendor=<ID> iSerialNumbe    
 51   $ mkdir /dev/ffs-mtp && mount -t functionfs     
 52   $ ( cd /dev/ffs-mtp && mtp-daemon ) &           
 53   $ mkdir /dev/ffs-hid && mount -t functionfs     
 54   $ ( cd /dev/ffs-hid && hid-daemon ) &           
 55                                                   
 56 On kernel level the gadget checks ffs_data->de    
 57 whether its FunctionFS is designed for MTP ("m    
 58                                                   
 59 If no "functions" module parameters is supplie    
 60 just one function with any name.                  
 61                                                   
 62 When "functions" module parameter is supplied,    
 63 with listed names are accepted. In particular,    
 64 parameter's value is just a one-element list,     
 65 is similar to when there is no "functions" at     
 66 only a function with the specified name is acc    
 67                                                   
 68 The gadget is registered only after all the de    
 69 filesystems have been mounted and USB descript    
 70 have been written to their ep0's.                 
 71                                                   
 72 Conversely, the gadget is unregistered after t    
 73 closes its endpoints.                             
 74                                                   
 75 DMABUF interface                                  
 76 ================                                  
 77                                                   
 78 FunctionFS additionally supports a DMABUF base    
 79 userspace can attach DMABUF objects (externall    
 80 and subsequently use them for data transfers.     
 81                                                   
 82 A userspace application can then use this inte    
 83 objects between several interfaces, allowing i    
 84 zero-copy fashion, for instance between IIO an    
 85                                                   
 86 As part of this interface, three new IOCTLs ha    
 87 IOCTLs have to be performed on a data endpoint    
 88                                                   
 89   ``FUNCTIONFS_DMABUF_ATTACH(int)``               
 90     Attach the DMABUF object, identified by it    
 91     data endpoint. Returns zero on success, an    
 92     on error.                                     
 93                                                   
 94   ``FUNCTIONFS_DMABUF_DETACH(int)``               
 95     Detach the given DMABUF object, identified    
 96     from the data endpoint. Returns zero on su    
 97     errno value on error. Note that closing th    
 98     descriptor will automatically detach all a    
 99                                                   
100   ``FUNCTIONFS_DMABUF_TRANSFER(struct usb_ffs_    
101     Enqueue the previously attached DMABUF to     
102     The argument is a structure that packs the    
103     the size in bytes to transfer (which shoul    
104     the size of the DMABUF), and a 'flags' fie    
105     for now. Returns zero on success, and a ne    
106     error.                                        
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php