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

TOMOYO Linux Cross Reference
Linux/include/uapi/linux/usb/gadgetfs.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2 /*
  3  * Filesystem based user-mode API to USB Gadget controller hardware
  4  *
  5  * Other than ep0 operations, most things are done by read() and write()
  6  * on endpoint files found in one directory.  They are configured by
  7  * writing descriptors, and then may be used for normal stream style
  8  * i/o requests.  When ep0 is configured, the device can enumerate;
  9  * when it's closed, the device disconnects from usb.  Operations on
 10  * ep0 require ioctl() operations.
 11  *
 12  * Configuration and device descriptors get written to /dev/gadget/$CHIP,
 13  * which may then be used to read usb_gadgetfs_event structs.  The driver
 14  * may activate endpoints as it handles SET_CONFIGURATION setup events,
 15  * or earlier; writing endpoint descriptors to /dev/gadget/$ENDPOINT
 16  * then performing data transfers by reading or writing.
 17  */
 18 
 19 #ifndef __LINUX_USB_GADGETFS_H
 20 #define __LINUX_USB_GADGETFS_H
 21 
 22 #include <linux/types.h>
 23 #include <linux/ioctl.h>
 24 
 25 #include <linux/usb/ch9.h>
 26 
 27 /*
 28  * Events are delivered on the ep0 file descriptor, when the user mode driver
 29  * reads from this file descriptor after writing the descriptors.  Don't
 30  * stop polling this descriptor.
 31  */
 32 
 33 enum usb_gadgetfs_event_type {
 34         GADGETFS_NOP = 0,
 35 
 36         GADGETFS_CONNECT,
 37         GADGETFS_DISCONNECT,
 38         GADGETFS_SETUP,
 39         GADGETFS_SUSPEND,
 40         /* and likely more ! */
 41 };
 42 
 43 /* NOTE:  this structure must stay the same size and layout on
 44  * both 32-bit and 64-bit kernels.
 45  */
 46 struct usb_gadgetfs_event {
 47         union {
 48                 /* NOP, DISCONNECT, SUSPEND: nothing
 49                  * ... some hardware can't report disconnection
 50                  */
 51 
 52                 /* CONNECT: just the speed */
 53                 enum usb_device_speed   speed;
 54 
 55                 /* SETUP: packet; DATA phase i/o precedes next event
 56                  *(setup.bmRequestType & USB_DIR_IN) flags direction
 57                  * ... includes SET_CONFIGURATION, SET_INTERFACE
 58                  */
 59                 struct usb_ctrlrequest  setup;
 60         } u;
 61         enum usb_gadgetfs_event_type    type;
 62 };
 63 
 64 
 65 /* The 'g' code is also used by printer gadget ioctl requests.
 66  * Don't add any colliding codes to either driver, and keep
 67  * them in unique ranges (size 0x20 for now).
 68  */
 69 
 70 /* endpoint ioctls */
 71 
 72 /* IN transfers may be reported to the gadget driver as complete
 73  *      when the fifo is loaded, before the host reads the data;
 74  * OUT transfers may be reported to the host's "client" driver as
 75  *      complete when they're sitting in the FIFO unread.
 76  * THIS returns how many bytes are "unclaimed" in the endpoint fifo
 77  * (needed for precise fault handling, when the hardware allows it)
 78  */
 79 #define GADGETFS_FIFO_STATUS    _IO('g', 1)
 80 
 81 /* discards any unclaimed data in the fifo. */
 82 #define GADGETFS_FIFO_FLUSH     _IO('g', 2)
 83 
 84 /* resets endpoint halt+toggle; used to implement set_interface.
 85  * some hardware (like pxa2xx) can't support this.
 86  */
 87 #define GADGETFS_CLEAR_HALT     _IO('g', 3)
 88 
 89 #endif /* __LINUX_USB_GADGETFS_H */
 90 

~ [ 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