functionfs.h revision 96c1db7b9d601c31d103389cac074a6cce0d7633
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_FUNCTIONFS_H__
20#define _UAPI__LINUX_FUNCTIONFS_H__
21#include <linux/types.h>
22#include <linux/ioctl.h>
23#include <linux/usb/ch9.h>
24enum {
25  FUNCTIONFS_DESCRIPTORS_MAGIC = 1,
26  FUNCTIONFS_STRINGS_MAGIC = 2,
27  FUNCTIONFS_DESCRIPTORS_MAGIC_V2 = 3,
28};
29enum functionfs_flags {
30  FUNCTIONFS_HAS_FS_DESC = 1,
31  FUNCTIONFS_HAS_HS_DESC = 2,
32  FUNCTIONFS_HAS_SS_DESC = 4,
33  FUNCTIONFS_HAS_MS_OS_DESC = 8,
34  FUNCTIONFS_VIRTUAL_ADDR = 16,
35  FUNCTIONFS_EVENTFD = 32,
36  FUNCTIONFS_ALL_CTRL_RECIP = 64,
37  FUNCTIONFS_CONFIG0_SETUP = 128,
38};
39struct usb_endpoint_descriptor_no_audio {
40  __u8 bLength;
41  __u8 bDescriptorType;
42  __u8 bEndpointAddress;
43  __u8 bmAttributes;
44  __le16 wMaxPacketSize;
45  __u8 bInterval;
46} __attribute__((packed));
47struct usb_functionfs_descs_head_v2 {
48  __le32 magic;
49  __le32 length;
50  __le32 flags;
51} __attribute__((packed));
52struct usb_functionfs_descs_head {
53  __le32 magic;
54  __le32 length;
55  __le32 fs_count;
56  __le32 hs_count;
57} __attribute__((packed, deprecated));
58struct usb_os_desc_header {
59  __u8 interface;
60  __le32 dwLength;
61  __le16 bcdVersion;
62  __le16 wIndex;
63  union {
64    struct {
65      __u8 bCount;
66      __u8 Reserved;
67    };
68    __le16 wCount;
69  };
70} __attribute__((packed));
71struct usb_ext_compat_desc {
72  __u8 bFirstInterfaceNumber;
73  __u8 Reserved1;
74  __u8 CompatibleID[8];
75  __u8 SubCompatibleID[8];
76  __u8 Reserved2[6];
77};
78struct usb_ext_prop_desc {
79  __le32 dwSize;
80  __le32 dwPropertyDataType;
81  __le16 wPropertyNameLength;
82} __attribute__((packed));
83struct usb_functionfs_strings_head {
84  __le32 magic;
85  __le32 length;
86  __le32 str_count;
87  __le32 lang_count;
88} __attribute__((packed));
89enum usb_functionfs_event_type {
90  FUNCTIONFS_BIND,
91  FUNCTIONFS_UNBIND,
92  FUNCTIONFS_ENABLE,
93  FUNCTIONFS_DISABLE,
94  FUNCTIONFS_SETUP,
95  FUNCTIONFS_SUSPEND,
96  FUNCTIONFS_RESUME
97};
98struct usb_functionfs_event {
99  union {
100    struct usb_ctrlrequest setup;
101  } __attribute__((packed)) u;
102  __u8 type;
103  __u8 _pad[3];
104} __attribute__((packed));
105#define FUNCTIONFS_FIFO_STATUS _IO('g', 1)
106#define FUNCTIONFS_FIFO_FLUSH _IO('g', 2)
107#define FUNCTIONFS_CLEAR_HALT _IO('g', 3)
108#define FUNCTIONFS_INTERFACE_REVMAP _IO('g', 128)
109#define FUNCTIONFS_ENDPOINT_REVMAP _IO('g', 129)
110#define FUNCTIONFS_ENDPOINT_DESC _IOR('g', 130, struct usb_endpoint_descriptor)
111#endif
112