Elliott Hughes | 180edef | 2023-11-02 00:08:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is auto-generated. Modifications will be lost. |
| 3 | * |
| 4 | * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ |
| 5 | * for more information. |
| 6 | */ |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 7 | #ifndef _UAPI__LINUX_USB_RAW_GADGET_H |
| 8 | #define _UAPI__LINUX_USB_RAW_GADGET_H |
| 9 | #include <asm/ioctl.h> |
| 10 | #include <linux/types.h> |
| 11 | #include <linux/usb/ch9.h> |
| 12 | #define UDC_NAME_LENGTH_MAX 128 |
| 13 | struct usb_raw_init { |
| 14 | __u8 driver_name[UDC_NAME_LENGTH_MAX]; |
| 15 | __u8 device_name[UDC_NAME_LENGTH_MAX]; |
| 16 | __u8 speed; |
| 17 | }; |
| 18 | enum usb_raw_event_type { |
| 19 | USB_RAW_EVENT_INVALID = 0, |
| 20 | USB_RAW_EVENT_CONNECT = 1, |
| 21 | USB_RAW_EVENT_CONTROL = 2, |
| 22 | }; |
| 23 | struct usb_raw_event { |
| 24 | __u32 type; |
| 25 | __u32 length; |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 26 | __u8 data[]; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 27 | }; |
| 28 | #define USB_RAW_IO_FLAGS_ZERO 0x0001 |
| 29 | #define USB_RAW_IO_FLAGS_MASK 0x0001 |
| 30 | struct usb_raw_ep_io { |
| 31 | __u16 ep; |
| 32 | __u16 flags; |
| 33 | __u32 length; |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 34 | __u8 data[]; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 35 | }; |
| 36 | #define USB_RAW_EPS_NUM_MAX 30 |
| 37 | #define USB_RAW_EP_NAME_MAX 16 |
| 38 | #define USB_RAW_EP_ADDR_ANY 0xff |
| 39 | struct usb_raw_ep_caps { |
| 40 | __u32 type_control : 1; |
| 41 | __u32 type_iso : 1; |
| 42 | __u32 type_bulk : 1; |
| 43 | __u32 type_int : 1; |
| 44 | __u32 dir_in : 1; |
| 45 | __u32 dir_out : 1; |
| 46 | }; |
| 47 | struct usb_raw_ep_limits { |
| 48 | __u16 maxpacket_limit; |
| 49 | __u16 max_streams; |
| 50 | __u32 reserved; |
| 51 | }; |
| 52 | struct usb_raw_ep_info { |
| 53 | __u8 name[USB_RAW_EP_NAME_MAX]; |
| 54 | __u32 addr; |
| 55 | struct usb_raw_ep_caps caps; |
| 56 | struct usb_raw_ep_limits limits; |
| 57 | }; |
| 58 | struct usb_raw_eps_info { |
| 59 | struct usb_raw_ep_info eps[USB_RAW_EPS_NUM_MAX]; |
| 60 | }; |
| 61 | #define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init) |
| 62 | #define USB_RAW_IOCTL_RUN _IO('U', 1) |
| 63 | #define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event) |
| 64 | #define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io) |
| 65 | #define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io) |
| 66 | #define USB_RAW_IOCTL_EP_ENABLE _IOW('U', 5, struct usb_endpoint_descriptor) |
| 67 | #define USB_RAW_IOCTL_EP_DISABLE _IOW('U', 6, __u32) |
| 68 | #define USB_RAW_IOCTL_EP_WRITE _IOW('U', 7, struct usb_raw_ep_io) |
| 69 | #define USB_RAW_IOCTL_EP_READ _IOWR('U', 8, struct usb_raw_ep_io) |
| 70 | #define USB_RAW_IOCTL_CONFIGURE _IO('U', 9) |
| 71 | #define USB_RAW_IOCTL_VBUS_DRAW _IOW('U', 10, __u32) |
| 72 | #define USB_RAW_IOCTL_EPS_INFO _IOR('U', 11, struct usb_raw_eps_info) |
| 73 | #define USB_RAW_IOCTL_EP0_STALL _IO('U', 12) |
| 74 | #define USB_RAW_IOCTL_EP_SET_HALT _IOW('U', 13, __u32) |
| 75 | #define USB_RAW_IOCTL_EP_CLEAR_HALT _IOW('U', 14, __u32) |
| 76 | #define USB_RAW_IOCTL_EP_SET_WEDGE _IOW('U', 15, __u32) |
| 77 | #endif |