• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  */
7 #ifndef _UAPI__LINUX_FUNCTIONFS_H__
8 #define _UAPI__LINUX_FUNCTIONFS_H__
9 #include <linux/const.h>
10 #include <linux/types.h>
11 #include <linux/ioctl.h>
12 #include <linux/usb/ch9.h>
13 enum {
14   FUNCTIONFS_DESCRIPTORS_MAGIC = 1,
15   FUNCTIONFS_STRINGS_MAGIC = 2,
16   FUNCTIONFS_DESCRIPTORS_MAGIC_V2 = 3,
17 };
18 enum functionfs_flags {
19   FUNCTIONFS_HAS_FS_DESC = 1,
20   FUNCTIONFS_HAS_HS_DESC = 2,
21   FUNCTIONFS_HAS_SS_DESC = 4,
22   FUNCTIONFS_HAS_MS_OS_DESC = 8,
23   FUNCTIONFS_VIRTUAL_ADDR = 16,
24   FUNCTIONFS_EVENTFD = 32,
25   FUNCTIONFS_ALL_CTRL_RECIP = 64,
26   FUNCTIONFS_CONFIG0_SETUP = 128,
27 };
28 struct usb_endpoint_descriptor_no_audio {
29   __u8 bLength;
30   __u8 bDescriptorType;
31   __u8 bEndpointAddress;
32   __u8 bmAttributes;
33   __le16 wMaxPacketSize;
34   __u8 bInterval;
35 } __attribute__((packed));
36 struct usb_dfu_functional_descriptor {
37   __u8 bLength;
38   __u8 bDescriptorType;
39   __u8 bmAttributes;
40   __le16 wDetachTimeOut;
41   __le16 wTransferSize;
42   __le16 bcdDFUVersion;
43 } __attribute__((packed));
44 #define DFU_FUNC_ATT_CAN_DOWNLOAD _BITUL(0)
45 #define DFU_FUNC_ATT_CAN_UPLOAD _BITUL(1)
46 #define DFU_FUNC_ATT_MANIFEST_TOLERANT _BITUL(2)
47 #define DFU_FUNC_ATT_WILL_DETACH _BITUL(3)
48 struct usb_functionfs_descs_head_v2 {
49   __le32 magic;
50   __le32 length;
51   __le32 flags;
52 } __attribute__((packed));
53 struct usb_functionfs_descs_head {
54   __le32 magic;
55   __le32 length;
56   __le32 fs_count;
57   __le32 hs_count;
58 } __attribute__((packed, deprecated));
59 struct usb_os_desc_header {
60   __u8 interface;
61   __le32 dwLength;
62   __le16 bcdVersion;
63   __le16 wIndex;
64   union {
65     struct {
66       __u8 bCount;
67       __u8 Reserved;
68     };
69     __le16 wCount;
70   };
71 } __attribute__((packed));
72 struct usb_ext_compat_desc {
73   __u8 bFirstInterfaceNumber;
74   __u8 Reserved1;
75   __struct_group(, IDs,, __u8 CompatibleID[8];
76   __u8 SubCompatibleID[8];
77  );
78   __u8 Reserved2[6];
79 };
80 struct usb_ext_prop_desc {
81   __le32 dwSize;
82   __le32 dwPropertyDataType;
83   __le16 wPropertyNameLength;
84 } __attribute__((packed));
85 #define USB_FFS_DMABUF_TRANSFER_MASK 0x0
86 struct usb_ffs_dmabuf_transfer_req {
87   int fd;
88   __u32 flags;
89   __u64 length;
90 } __attribute__((packed));
91 struct usb_functionfs_strings_head {
92   __le32 magic;
93   __le32 length;
94   __le32 str_count;
95   __le32 lang_count;
96 } __attribute__((packed));
97 enum usb_functionfs_event_type {
98   FUNCTIONFS_BIND,
99   FUNCTIONFS_UNBIND,
100   FUNCTIONFS_ENABLE,
101   FUNCTIONFS_DISABLE,
102   FUNCTIONFS_SETUP,
103   FUNCTIONFS_SUSPEND,
104   FUNCTIONFS_RESUME
105 };
106 struct usb_functionfs_event {
107   union {
108     struct usb_ctrlrequest setup;
109   } __attribute__((packed)) u;
110   __u8 type;
111   __u8 _pad[3];
112 } __attribute__((packed));
113 #define FUNCTIONFS_FIFO_STATUS _IO('g', 1)
114 #define FUNCTIONFS_FIFO_FLUSH _IO('g', 2)
115 #define FUNCTIONFS_CLEAR_HALT _IO('g', 3)
116 #define FUNCTIONFS_INTERFACE_REVMAP _IO('g', 128)
117 #define FUNCTIONFS_ENDPOINT_REVMAP _IO('g', 129)
118 #define FUNCTIONFS_ENDPOINT_DESC _IOR('g', 130, struct usb_endpoint_descriptor)
119 #define FUNCTIONFS_DMABUF_ATTACH _IOW('g', 131, int)
120 #define FUNCTIONFS_DMABUF_DETACH _IOW('g', 132, int)
121 #define FUNCTIONFS_DMABUF_TRANSFER _IOW('g', 133, struct usb_ffs_dmabuf_transfer_req)
122 #endif
123