10#ifndef __PACKET_USB_H__
11#define __PACKET_USB_H__
25#define USB_ADDR_LEN (sizeof(usb_address_t))
30#define INTERFACE_PORT 0x80000000
48 USB_HEADER_LINUX_48_BYTES,
49 USB_HEADER_LINUX_64_BYTES,
54 USB_HEADER_PSEUDO_URB,
57#define USB_HEADER_IS_LINUX(type) \
58 ((type) == USB_HEADER_LINUX_48_BYTES || (type) == USB_HEADER_LINUX_64_BYTES)
62 uint8_t transfer_type;
63 uint8_t device_address;
74 usb_header_t header_type;
101 uint8_t interface_endpoint;
107enum usb_conv_class_data_type {
108 USB_CONV_UNKNOWN = 0,
112 USB_CONV_MASS_STORAGE_BOT,
113 USB_CONV_MASS_STORAGE_UASP,
120 uint8_t descriptor_transfer_type;
121 uint16_t max_packet_size;
123 uint16_t interfaceClass;
124 uint16_t interfaceSubclass;
125 uint16_t interfaceProtocol;
126 uint8_t interfaceNum;
128 uint16_t deviceVendor;
129 uint32_t deviceProduct;
130 uint16_t deviceVersion;
131 uint8_t iSerialNumber;
135 enum usb_conv_class_data_type class_data_type;
143 uint16_t device_address;
146 uint8_t transfer_type;
147 uint32_t device_protocol;
150 uint8_t setup_requesttype;
161 uint8_t transfer_type;
168#define NO_ENDPOINT 0xffffffff
171#define NO_ENDPOINT8 ((uint8_t)(NO_ENDPOINT& UINT8_MAX))
180#define URB_SUBMIT 'S'
181#define URB_COMPLETE 'C'
187#define URB_ISOCHRONOUS 0x0
188#define URB_INTERRUPT 0x1
189#define URB_CONTROL 0x2
191#define URB_UNKNOWN 0xFF
193#define URB_TRANSFER_IN 0x80
197#define IF_CLASS_DEVICE 0x00
198#define IF_CLASS_AUDIO 0x01
199#define IF_CLASS_COMMUNICATIONS 0x02
200#define IF_CLASS_HID 0x03
201#define IF_CLASS_PHYSICAL 0x05
202#define IF_CLASS_IMAGE 0x06
203#define IF_CLASS_PRINTER 0x07
204#define IF_CLASS_MASS_STORAGE 0x08
205#define IF_CLASS_HUB 0x09
206#define IF_CLASS_CDC_DATA 0x0a
207#define IF_CLASS_SMART_CARD 0x0b
208#define IF_CLASS_CONTENT_SECURITY 0x0d
209#define IF_CLASS_VIDEO 0x0e
210#define IF_CLASS_PERSONAL_HEALTHCARE 0x0f
211#define IF_CLASS_AUDIO_VIDEO 0x10
212#define IF_CLASS_BILLBOARD 0x11
213#define IF_CLASS_USB_C_BRIDGE 0x12
214#define IF_CLASS_BULK_DISPLAY_PROTO 0x13
215#define IF_CLASS_MCTP_USB_EP 0x14
216#define IF_CLASS_I3C 0x3c
217#define IF_CLASS_DIAGNOSTIC_DEVICE 0xdc
218#define IF_CLASS_WIRELESS_CONTROLLER 0xe0
219#define IF_CLASS_MISCELLANEOUS 0xef
220#define IF_CLASS_APPLICATION_SPECIFIC 0xfe
221#define IF_CLASS_VENDOR_SPECIFIC 0xff
223#define IF_CLASS_UNKNOWN 0xffff
224#define IF_SUBCLASS_UNKNOWN 0xffff
225#define IF_PROTOCOL_UNKNOWN 0xffff
226#define DEV_VENDOR_UNKNOWN 0x0000
227#define DEV_PRODUCT_UNKNOWN 0xfffffff
228#define DEV_VERSION_UNKNOWN 0xffff
230#define IF_SUBCLASS_MISC_U3V 0x05
232#define IF_SUBCLASS_APP_DFU 0x01
234#define IF_PROTOCOL_DFU_RUNTIME 0x01
235#define IF_PROTOCOL_DFU_MODE 0x02
244#define USB_PROTOCOL_KEY(class, subclass, protocol) \
245 (1u << 31 | (class & 0xff) << 16 | (subclass & 0xff) << 8 | (protocol & 0xff))
249#define USB_DIR_IN 0x80
251#define USB_TYPE_MASK (0x03 << 5)
252#define USB_TYPE(type) (((type) & USB_TYPE_MASK) >> 5)
253#define RQT_SETUP_TYPE_STANDARD 0
254#define RQT_SETUP_TYPE_CLASS 1
255#define RQT_SETUP_TYPE_VENDOR 2
257#define USB_RECIPIENT_MASK 0x1F
258#define USB_RECIPIENT(type) ((type) & USB_RECIPIENT_MASK)
259#define RQT_SETUP_RECIPIENT_DEVICE 0
260#define RQT_SETUP_RECIPIENT_INTERFACE 1
261#define RQT_SETUP_RECIPIENT_ENDPOINT 2
262#define RQT_SETUP_RECIPIENT_OTHER 3
265#define ENDPOINT_TYPE(ep_attrib) ((ep_attrib) & 0x03)
266#define ENDPOINT_TYPE_CONTROL 0
267#define ENDPOINT_TYPE_ISOCHRONOUS 1
268#define ENDPOINT_TYPE_BULK 2
269#define ENDPOINT_TYPE_INTERRUPT 3
270#define ENDPOINT_TYPE_NOT_SET 255
273#define USB_MPS_EP_SIZE(max_packet_size) ((max_packet_size) & 0x07FF)
274#define USB_MPS_ADDNL(max_packet_size) (((max_packet_size) & 0x1800) >> 11)
275#define USB_MPS(ep_size, addnl) (((addnl) << 11) | (ep_size))
276#define USB_MPS_TPL(max_packet_size) \
277 ((USB_MPS_ADDNL(max_packet_size) + 1) * USB_MPS_EP_SIZE(max_packet_size))
279#define USB_SETUP_GET_STATUS 0
280#define USB_SETUP_CLEAR_FEATURE 1
281#define USB_SETUP_SET_FEATURE 3
282#define USB_SETUP_SET_ADDRESS 5
283#define USB_SETUP_GET_DESCRIPTOR 6
284#define USB_SETUP_SET_DESCRIPTOR 7
285#define USB_SETUP_GET_CONFIGURATION 8
286#define USB_SETUP_SET_CONFIGURATION 9
287#define USB_SETUP_GET_INTERFACE 10
288#define USB_SETUP_SET_INTERFACE 11
289#define USB_SETUP_SYNCH_FRAME 12
290#define USB_SETUP_SET_SEL 48
291#define USB_SETUP_SET_ISOCH_DELAY 49
294#define URB_SHORT_NOT_OK 0x0001
295#define URB_ISO_ASAP 0x0002
297#define URB_NO_TRANSFER_DMA_MAP 0x0004
298#define URB_NO_FSBR 0x0020
299#define URB_ZERO_PACKET 0x0040
300#define URB_NO_INTERRUPT 0x0080
302#define URB_FREE_BUFFER 0x0100
305#define URB_DIR_IN 0x0200
307#define URB_DIR_MASK URB_DIR_IN
309#define URB_DMA_MAP_SINGLE 0x00010000
310#define URB_DMA_MAP_PAGE 0x00020000
311#define URB_DMA_MAP_SG 0x00040000
312#define URB_MAP_LOCAL 0x00080000
313#define URB_SETUP_MAP_SINGLE 0x00100000
314#define URB_SETUP_MAP_LOCAL 0x00200000
315#define URB_DMA_SG_COMBINED 0x00400000
316#define URB_ALIGNED_TEMP_BUFFER 0x00800000
326 uint16_t device_address,
int endpoint);
335sanitize_usb_max_packet_size(uint8_t ep_type, usb_speed_t speed,
336 unsigned int max_packet_size);
342 uint8_t *out_ep_type, usb_speed_t speed);
350dissect_urb_transfer_flags(
tvbuff_t *tvb,
int offset,
proto_tree* tree,
int hf,
int endian);
356 usb_header_t header_type,
void *extra_data);
358void usb_lpm_besl_str(
char *buf, uint32_t value);
Definition packet_info.h:43
Definition packet-usb.h:141
Definition packet-usb.h:20
Definition packet-usb.h:119
Definition packet-usb.h:60
Definition packet-usb.h:159
Definition packet-usb.h:77
Definition packet-usb.h:70
Definition value_string.h:169
Definition wmem_array.c:27
Definition wmem_tree-int.h:48
Definition tvbuff-int.h:35