Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include/linux/usb
File: functionfs.h
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
[0] Fix | Delete
#ifndef __LINUX_FUNCTIONFS_H__
[1] Fix | Delete
#define __LINUX_FUNCTIONFS_H__
[2] Fix | Delete
[3] Fix | Delete
[4] Fix | Delete
#include <linux/types.h>
[5] Fix | Delete
#include <linux/ioctl.h>
[6] Fix | Delete
[7] Fix | Delete
#include <linux/usb/ch9.h>
[8] Fix | Delete
[9] Fix | Delete
[10] Fix | Delete
enum {
[11] Fix | Delete
FUNCTIONFS_DESCRIPTORS_MAGIC = 1,
[12] Fix | Delete
FUNCTIONFS_STRINGS_MAGIC = 2,
[13] Fix | Delete
FUNCTIONFS_DESCRIPTORS_MAGIC_V2 = 3,
[14] Fix | Delete
};
[15] Fix | Delete
[16] Fix | Delete
enum functionfs_flags {
[17] Fix | Delete
FUNCTIONFS_HAS_FS_DESC = 1,
[18] Fix | Delete
FUNCTIONFS_HAS_HS_DESC = 2,
[19] Fix | Delete
FUNCTIONFS_HAS_SS_DESC = 4,
[20] Fix | Delete
FUNCTIONFS_HAS_MS_OS_DESC = 8,
[21] Fix | Delete
FUNCTIONFS_VIRTUAL_ADDR = 16,
[22] Fix | Delete
FUNCTIONFS_EVENTFD = 32,
[23] Fix | Delete
FUNCTIONFS_ALL_CTRL_RECIP = 64,
[24] Fix | Delete
FUNCTIONFS_CONFIG0_SETUP = 128,
[25] Fix | Delete
};
[26] Fix | Delete
[27] Fix | Delete
/* Descriptor of an non-audio endpoint */
[28] Fix | Delete
struct usb_endpoint_descriptor_no_audio {
[29] Fix | Delete
__u8 bLength;
[30] Fix | Delete
__u8 bDescriptorType;
[31] Fix | Delete
[32] Fix | Delete
__u8 bEndpointAddress;
[33] Fix | Delete
__u8 bmAttributes;
[34] Fix | Delete
__le16 wMaxPacketSize;
[35] Fix | Delete
__u8 bInterval;
[36] Fix | Delete
} __attribute__((packed));
[37] Fix | Delete
[38] Fix | Delete
struct usb_functionfs_descs_head_v2 {
[39] Fix | Delete
__le32 magic;
[40] Fix | Delete
__le32 length;
[41] Fix | Delete
__le32 flags;
[42] Fix | Delete
/*
[43] Fix | Delete
* __le32 fs_count, hs_count, fs_count; must be included manually in
[44] Fix | Delete
* the structure taking flags into consideration.
[45] Fix | Delete
*/
[46] Fix | Delete
} __attribute__((packed));
[47] Fix | Delete
[48] Fix | Delete
/* Legacy format, deprecated as of 3.14. */
[49] Fix | Delete
struct usb_functionfs_descs_head {
[50] Fix | Delete
__le32 magic;
[51] Fix | Delete
__le32 length;
[52] Fix | Delete
__le32 fs_count;
[53] Fix | Delete
__le32 hs_count;
[54] Fix | Delete
} __attribute__((packed, deprecated));
[55] Fix | Delete
[56] Fix | Delete
/* MS OS Descriptor header */
[57] Fix | Delete
struct usb_os_desc_header {
[58] Fix | Delete
__u8 interface;
[59] Fix | Delete
__le32 dwLength;
[60] Fix | Delete
__le16 bcdVersion;
[61] Fix | Delete
__le16 wIndex;
[62] Fix | Delete
union {
[63] Fix | Delete
struct {
[64] Fix | Delete
__u8 bCount;
[65] Fix | Delete
__u8 Reserved;
[66] Fix | Delete
};
[67] Fix | Delete
__le16 wCount;
[68] Fix | Delete
};
[69] Fix | Delete
} __attribute__((packed));
[70] Fix | Delete
[71] Fix | Delete
struct usb_ext_compat_desc {
[72] Fix | Delete
__u8 bFirstInterfaceNumber;
[73] Fix | Delete
__u8 Reserved1;
[74] Fix | Delete
__u8 CompatibleID[8];
[75] Fix | Delete
__u8 SubCompatibleID[8];
[76] Fix | Delete
__u8 Reserved2[6];
[77] Fix | Delete
};
[78] Fix | Delete
[79] Fix | Delete
struct usb_ext_prop_desc {
[80] Fix | Delete
__le32 dwSize;
[81] Fix | Delete
__le32 dwPropertyDataType;
[82] Fix | Delete
__le16 wPropertyNameLength;
[83] Fix | Delete
} __attribute__((packed));
[84] Fix | Delete
[85] Fix | Delete
[86] Fix | Delete
/*
[87] Fix | Delete
* Descriptors format:
[88] Fix | Delete
*
[89] Fix | Delete
* | off | name | type | description |
[90] Fix | Delete
* |-----+-----------+--------------+--------------------------------------|
[91] Fix | Delete
* | 0 | magic | LE32 | FUNCTIONFS_DESCRIPTORS_MAGIC_V2 |
[92] Fix | Delete
* | 4 | length | LE32 | length of the whole data chunk |
[93] Fix | Delete
* | 8 | flags | LE32 | combination of functionfs_flags |
[94] Fix | Delete
* | | eventfd | LE32 | eventfd file descriptor |
[95] Fix | Delete
* | | fs_count | LE32 | number of full-speed descriptors |
[96] Fix | Delete
* | | hs_count | LE32 | number of high-speed descriptors |
[97] Fix | Delete
* | | ss_count | LE32 | number of super-speed descriptors |
[98] Fix | Delete
* | | os_count | LE32 | number of MS OS descriptors |
[99] Fix | Delete
* | | fs_descrs | Descriptor[] | list of full-speed descriptors |
[100] Fix | Delete
* | | hs_descrs | Descriptor[] | list of high-speed descriptors |
[101] Fix | Delete
* | | ss_descrs | Descriptor[] | list of super-speed descriptors |
[102] Fix | Delete
* | | os_descrs | OSDesc[] | list of MS OS descriptors |
[103] Fix | Delete
*
[104] Fix | Delete
* Depending on which flags are set, various fields may be missing in the
[105] Fix | Delete
* structure. Any flags that are not recognised cause the whole block to be
[106] Fix | Delete
* rejected with -ENOSYS.
[107] Fix | Delete
*
[108] Fix | Delete
* Legacy descriptors format (deprecated as of 3.14):
[109] Fix | Delete
*
[110] Fix | Delete
* | off | name | type | description |
[111] Fix | Delete
* |-----+-----------+--------------+--------------------------------------|
[112] Fix | Delete
* | 0 | magic | LE32 | FUNCTIONFS_DESCRIPTORS_MAGIC |
[113] Fix | Delete
* | 4 | length | LE32 | length of the whole data chunk |
[114] Fix | Delete
* | 8 | fs_count | LE32 | number of full-speed descriptors |
[115] Fix | Delete
* | 12 | hs_count | LE32 | number of high-speed descriptors |
[116] Fix | Delete
* | 16 | fs_descrs | Descriptor[] | list of full-speed descriptors |
[117] Fix | Delete
* | | hs_descrs | Descriptor[] | list of high-speed descriptors |
[118] Fix | Delete
*
[119] Fix | Delete
* All numbers must be in little endian order.
[120] Fix | Delete
*
[121] Fix | Delete
* Descriptor[] is an array of valid USB descriptors which have the following
[122] Fix | Delete
* format:
[123] Fix | Delete
*
[124] Fix | Delete
* | off | name | type | description |
[125] Fix | Delete
* |-----+-----------------+------+--------------------------|
[126] Fix | Delete
* | 0 | bLength | U8 | length of the descriptor |
[127] Fix | Delete
* | 1 | bDescriptorType | U8 | descriptor type |
[128] Fix | Delete
* | 2 | payload | | descriptor's payload |
[129] Fix | Delete
*
[130] Fix | Delete
* OSDesc[] is an array of valid MS OS Feature Descriptors which have one of
[131] Fix | Delete
* the following formats:
[132] Fix | Delete
*
[133] Fix | Delete
* | off | name | type | description |
[134] Fix | Delete
* |-----+-----------------+------+--------------------------|
[135] Fix | Delete
* | 0 | inteface | U8 | related interface number |
[136] Fix | Delete
* | 1 | dwLength | U32 | length of the descriptor |
[137] Fix | Delete
* | 5 | bcdVersion | U16 | currently supported: 1 |
[138] Fix | Delete
* | 7 | wIndex | U16 | currently supported: 4 |
[139] Fix | Delete
* | 9 | bCount | U8 | number of ext. compat. |
[140] Fix | Delete
* | 10 | Reserved | U8 | 0 |
[141] Fix | Delete
* | 11 | ExtCompat[] | | list of ext. compat. d. |
[142] Fix | Delete
*
[143] Fix | Delete
* | off | name | type | description |
[144] Fix | Delete
* |-----+-----------------+------+--------------------------|
[145] Fix | Delete
* | 0 | inteface | U8 | related interface number |
[146] Fix | Delete
* | 1 | dwLength | U32 | length of the descriptor |
[147] Fix | Delete
* | 5 | bcdVersion | U16 | currently supported: 1 |
[148] Fix | Delete
* | 7 | wIndex | U16 | currently supported: 5 |
[149] Fix | Delete
* | 9 | wCount | U16 | number of ext. compat. |
[150] Fix | Delete
* | 11 | ExtProp[] | | list of ext. prop. d. |
[151] Fix | Delete
*
[152] Fix | Delete
* ExtCompat[] is an array of valid Extended Compatiblity descriptors
[153] Fix | Delete
* which have the following format:
[154] Fix | Delete
*
[155] Fix | Delete
* | off | name | type | description |
[156] Fix | Delete
* |-----+-----------------------+------+-------------------------------------|
[157] Fix | Delete
* | 0 | bFirstInterfaceNumber | U8 | index of the interface or of the 1st|
[158] Fix | Delete
* | | | | interface in an IAD group |
[159] Fix | Delete
* | 1 | Reserved | U8 | 1 |
[160] Fix | Delete
* | 2 | CompatibleID | U8[8]| compatible ID string |
[161] Fix | Delete
* | 10 | SubCompatibleID | U8[8]| subcompatible ID string |
[162] Fix | Delete
* | 18 | Reserved | U8[6]| 0 |
[163] Fix | Delete
*
[164] Fix | Delete
* ExtProp[] is an array of valid Extended Properties descriptors
[165] Fix | Delete
* which have the following format:
[166] Fix | Delete
*
[167] Fix | Delete
* | off | name | type | description |
[168] Fix | Delete
* |-----+-----------------------+------+-------------------------------------|
[169] Fix | Delete
* | 0 | dwSize | U32 | length of the descriptor |
[170] Fix | Delete
* | 4 | dwPropertyDataType | U32 | 1..7 |
[171] Fix | Delete
* | 8 | wPropertyNameLength | U16 | bPropertyName length (NL) |
[172] Fix | Delete
* | 10 | bPropertyName |U8[NL]| name of this property |
[173] Fix | Delete
* |10+NL| dwPropertyDataLength | U32 | bPropertyData length (DL) |
[174] Fix | Delete
* |14+NL| bProperty |U8[DL]| payload of this property |
[175] Fix | Delete
*/
[176] Fix | Delete
[177] Fix | Delete
struct usb_functionfs_strings_head {
[178] Fix | Delete
__le32 magic;
[179] Fix | Delete
__le32 length;
[180] Fix | Delete
__le32 str_count;
[181] Fix | Delete
__le32 lang_count;
[182] Fix | Delete
} __attribute__((packed));
[183] Fix | Delete
[184] Fix | Delete
/*
[185] Fix | Delete
* Strings format:
[186] Fix | Delete
*
[187] Fix | Delete
* | off | name | type | description |
[188] Fix | Delete
* |-----+------------+-----------------------+----------------------------|
[189] Fix | Delete
* | 0 | magic | LE32 | FUNCTIONFS_STRINGS_MAGIC |
[190] Fix | Delete
* | 4 | length | LE32 | length of the data chunk |
[191] Fix | Delete
* | 8 | str_count | LE32 | number of strings |
[192] Fix | Delete
* | 12 | lang_count | LE32 | number of languages |
[193] Fix | Delete
* | 16 | stringtab | StringTab[lang_count] | table of strings per lang |
[194] Fix | Delete
*
[195] Fix | Delete
* For each language there is one stringtab entry (ie. there are lang_count
[196] Fix | Delete
* stringtab entires). Each StringTab has following format:
[197] Fix | Delete
*
[198] Fix | Delete
* | off | name | type | description |
[199] Fix | Delete
* |-----+---------+-------------------+------------------------------------|
[200] Fix | Delete
* | 0 | lang | LE16 | language code |
[201] Fix | Delete
* | 2 | strings | String[str_count] | array of strings in given language |
[202] Fix | Delete
*
[203] Fix | Delete
* For each string there is one strings entry (ie. there are str_count
[204] Fix | Delete
* string entries). Each String is a NUL terminated string encoded in
[205] Fix | Delete
* UTF-8.
[206] Fix | Delete
*/
[207] Fix | Delete
[208] Fix | Delete
[209] Fix | Delete
[210] Fix | Delete
/*
[211] Fix | Delete
* Events are delivered on the ep0 file descriptor, when the user mode driver
[212] Fix | Delete
* reads from this file descriptor after writing the descriptors. Don't
[213] Fix | Delete
* stop polling this descriptor.
[214] Fix | Delete
*/
[215] Fix | Delete
[216] Fix | Delete
enum usb_functionfs_event_type {
[217] Fix | Delete
FUNCTIONFS_BIND,
[218] Fix | Delete
FUNCTIONFS_UNBIND,
[219] Fix | Delete
[220] Fix | Delete
FUNCTIONFS_ENABLE,
[221] Fix | Delete
FUNCTIONFS_DISABLE,
[222] Fix | Delete
[223] Fix | Delete
FUNCTIONFS_SETUP,
[224] Fix | Delete
[225] Fix | Delete
FUNCTIONFS_SUSPEND,
[226] Fix | Delete
FUNCTIONFS_RESUME
[227] Fix | Delete
};
[228] Fix | Delete
[229] Fix | Delete
/* NOTE: this structure must stay the same size and layout on
[230] Fix | Delete
* both 32-bit and 64-bit kernels.
[231] Fix | Delete
*/
[232] Fix | Delete
struct usb_functionfs_event {
[233] Fix | Delete
union {
[234] Fix | Delete
/* SETUP: packet; DATA phase i/o precedes next event
[235] Fix | Delete
*(setup.bmRequestType & USB_DIR_IN) flags direction */
[236] Fix | Delete
struct usb_ctrlrequest setup;
[237] Fix | Delete
} __attribute__((packed)) u;
[238] Fix | Delete
[239] Fix | Delete
/* enum usb_functionfs_event_type */
[240] Fix | Delete
__u8 type;
[241] Fix | Delete
__u8 _pad[3];
[242] Fix | Delete
} __attribute__((packed));
[243] Fix | Delete
[244] Fix | Delete
[245] Fix | Delete
/* Endpoint ioctls */
[246] Fix | Delete
/* The same as in gadgetfs */
[247] Fix | Delete
[248] Fix | Delete
/* IN transfers may be reported to the gadget driver as complete
[249] Fix | Delete
* when the fifo is loaded, before the host reads the data;
[250] Fix | Delete
* OUT transfers may be reported to the host's "client" driver as
[251] Fix | Delete
* complete when they're sitting in the FIFO unread.
[252] Fix | Delete
* THIS returns how many bytes are "unclaimed" in the endpoint fifo
[253] Fix | Delete
* (needed for precise fault handling, when the hardware allows it)
[254] Fix | Delete
*/
[255] Fix | Delete
#define FUNCTIONFS_FIFO_STATUS _IO('g', 1)
[256] Fix | Delete
[257] Fix | Delete
/* discards any unclaimed data in the fifo. */
[258] Fix | Delete
#define FUNCTIONFS_FIFO_FLUSH _IO('g', 2)
[259] Fix | Delete
[260] Fix | Delete
/* resets endpoint halt+toggle; used to implement set_interface.
[261] Fix | Delete
* some hardware (like pxa2xx) can't support this.
[262] Fix | Delete
*/
[263] Fix | Delete
#define FUNCTIONFS_CLEAR_HALT _IO('g', 3)
[264] Fix | Delete
[265] Fix | Delete
/* Specific for functionfs */
[266] Fix | Delete
[267] Fix | Delete
/*
[268] Fix | Delete
* Returns reverse mapping of an interface. Called on EP0. If there
[269] Fix | Delete
* is no such interface returns -EDOM. If function is not active
[270] Fix | Delete
* returns -ENODEV.
[271] Fix | Delete
*/
[272] Fix | Delete
#define FUNCTIONFS_INTERFACE_REVMAP _IO('g', 128)
[273] Fix | Delete
[274] Fix | Delete
/*
[275] Fix | Delete
* Returns real bEndpointAddress of an endpoint. If endpoint shuts down
[276] Fix | Delete
* during the call, returns -ESHUTDOWN.
[277] Fix | Delete
*/
[278] Fix | Delete
#define FUNCTIONFS_ENDPOINT_REVMAP _IO('g', 129)
[279] Fix | Delete
[280] Fix | Delete
/*
[281] Fix | Delete
* Returns endpoint descriptor. If endpoint shuts down during the call,
[282] Fix | Delete
* returns -ESHUTDOWN.
[283] Fix | Delete
*/
[284] Fix | Delete
#define FUNCTIONFS_ENDPOINT_DESC _IOR('g', 130, \
[285] Fix | Delete
struct usb_endpoint_descriptor)
[286] Fix | Delete
[287] Fix | Delete
[288] Fix | Delete
[289] Fix | Delete
#endif /* __LINUX_FUNCTIONFS_H__ */
[290] Fix | Delete
[291] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function