1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _UAPI__LINUX_USB_RAW_GADGET_H
20 #define _UAPI__LINUX_USB_RAW_GADGET_H
21 #include <asm/ioctl.h>
22 #include <linux/types.h>
23 #include <linux/usb/ch9.h>
24 #define UDC_NAME_LENGTH_MAX 128
25 struct usb_raw_init {
26   __u8 driver_name[UDC_NAME_LENGTH_MAX];
27   __u8 device_name[UDC_NAME_LENGTH_MAX];
28   __u8 speed;
29 };
30 enum usb_raw_event_type {
31   USB_RAW_EVENT_INVALID = 0,
32   USB_RAW_EVENT_CONNECT = 1,
33   USB_RAW_EVENT_CONTROL = 2,
34 };
35 struct usb_raw_event {
36   __u32 type;
37   __u32 length;
38   __u8 data[0];
39 };
40 #define USB_RAW_IO_FLAGS_ZERO 0x0001
41 #define USB_RAW_IO_FLAGS_MASK 0x0001
42 struct usb_raw_ep_io {
43   __u16 ep;
44   __u16 flags;
45   __u32 length;
46   __u8 data[0];
47 };
48 #define USB_RAW_EPS_NUM_MAX 30
49 #define USB_RAW_EP_NAME_MAX 16
50 #define USB_RAW_EP_ADDR_ANY 0xff
51 struct usb_raw_ep_caps {
52   __u32 type_control : 1;
53   __u32 type_iso : 1;
54   __u32 type_bulk : 1;
55   __u32 type_int : 1;
56   __u32 dir_in : 1;
57   __u32 dir_out : 1;
58 };
59 struct usb_raw_ep_limits {
60   __u16 maxpacket_limit;
61   __u16 max_streams;
62   __u32 reserved;
63 };
64 struct usb_raw_ep_info {
65   __u8 name[USB_RAW_EP_NAME_MAX];
66   __u32 addr;
67   struct usb_raw_ep_caps caps;
68   struct usb_raw_ep_limits limits;
69 };
70 struct usb_raw_eps_info {
71   struct usb_raw_ep_info eps[USB_RAW_EPS_NUM_MAX];
72 };
73 #define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
74 #define USB_RAW_IOCTL_RUN _IO('U', 1)
75 #define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
76 #define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
77 #define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
78 #define USB_RAW_IOCTL_EP_ENABLE _IOW('U', 5, struct usb_endpoint_descriptor)
79 #define USB_RAW_IOCTL_EP_DISABLE _IOW('U', 6, __u32)
80 #define USB_RAW_IOCTL_EP_WRITE _IOW('U', 7, struct usb_raw_ep_io)
81 #define USB_RAW_IOCTL_EP_READ _IOWR('U', 8, struct usb_raw_ep_io)
82 #define USB_RAW_IOCTL_CONFIGURE _IO('U', 9)
83 #define USB_RAW_IOCTL_VBUS_DRAW _IOW('U', 10, __u32)
84 #define USB_RAW_IOCTL_EPS_INFO _IOR('U', 11, struct usb_raw_eps_info)
85 #define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
86 #define USB_RAW_IOCTL_EP_SET_HALT _IOW('U', 13, __u32)
87 #define USB_RAW_IOCTL_EP_CLEAR_HALT _IOW('U', 14, __u32)
88 #define USB_RAW_IOCTL_EP_SET_WEDGE _IOW('U', 15, __u32)
89 #endif
90