1 #ifndef __LINUX_HUB_H
2 #define __LINUX_HUB_H
3
4 #include <linux/list.h>
5
6 /*
7 * Hub request types
8 */
9
10 #define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
11 #define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
12
13 /*
14 * Hub Class feature numbers
15 */
16 #define C_HUB_LOCAL_POWER 0
17 #define C_HUB_OVER_CURRENT 1
18
19 /*
20 * Port feature numbers
21 */
22 #define USB_PORT_FEAT_CONNECTION 0
23 #define USB_PORT_FEAT_ENABLE 1
24 #define USB_PORT_FEAT_SUSPEND 2
25 #define USB_PORT_FEAT_OVER_CURRENT 3
26 #define USB_PORT_FEAT_RESET 4
27 #define USB_PORT_FEAT_POWER 8
28 #define USB_PORT_FEAT_LOWSPEED 9
29 #define USB_PORT_FEAT_C_CONNECTION 16
30 #define USB_PORT_FEAT_C_ENABLE 17
31 #define USB_PORT_FEAT_C_SUSPEND 18
32 #define USB_PORT_FEAT_C_OVER_CURRENT 19
33 #define USB_PORT_FEAT_C_RESET 20
34
35 struct usb_port_status {
36 __u16 wPortStatus;
37 __u16 wPortChange;
38 } __attribute__ ((packed));
39
40 /* wPortStatus bits */
41 #define USB_PORT_STAT_CONNECTION 0x0001
42 #define USB_PORT_STAT_ENABLE 0x0002
43 #define USB_PORT_STAT_SUSPEND 0x0004
44 #define USB_PORT_STAT_OVERCURRENT 0x0008
45 #define USB_PORT_STAT_RESET 0x0010
46 #define USB_PORT_STAT_POWER 0x0100
47 #define USB_PORT_STAT_LOW_SPEED 0x0200
48
49 /* wPortChange bits */
50 #define USB_PORT_STAT_C_CONNECTION 0x0001
51 #define USB_PORT_STAT_C_ENABLE 0x0002
52 #define USB_PORT_STAT_C_SUSPEND 0x0004
53 #define USB_PORT_STAT_C_OVERCURRENT 0x0008
54 #define USB_PORT_STAT_C_RESET 0x0010
55
56 /* wHubCharacteristics (masks) */
57 #define HUB_CHAR_LPSM 0x0003
58 #define HUB_CHAR_COMPOUND 0x0004
59 #define HUB_CHAR_OCPM 0x0018
60
61 struct usb_hub_status {
62 __u16 wHubStatus;
63 __u16 wHubChange;
64 } __attribute__ ((packed));
65
66 /*
67 *Hub Status & Hub Change bit masks
68 */
69 #define HUB_STATUS_LOCAL_POWER 0x0001
70 #define HUB_STATUS_OVERCURRENT 0x0002
71
72 #define HUB_CHANGE_LOCAL_POWER 0x0001
73 #define HUB_CHANGE_OVERCURRENT 0x0002
74
75 #define HUB_DESCRIPTOR_MAX_SIZE 39 /* enough for 127 ports on a hub */
76
77 /* Hub descriptor */
78 struct usb_hub_descriptor {
79 __u8 bLength;
80 __u8 bDescriptorType;
81 __u8 bNbrPorts;
82 __u16 wHubCharacteristics;
83 __u8 bPwrOn2PwrGood;
84 __u8 bHubContrCurrent;
85
86 /* DeviceRemovable and PortPwrCtrlMask want to be variable-length
87 bitmaps that hold max 256 entries, but for now they're ignored */
88 __u8 bitmap[0];
89 } __attribute__ ((packed));
90
91 struct usb_device;
92
93 struct usb_hub {
94 struct usb_device *dev;
95
96 struct urb *urb; /* Interrupt polling pipe */
97
98 char buffer[(USB_MAXCHILDREN + 1 + 7) / 8]; /* add 1 bit for hub status change */
99 /* and add 7 bits to round up to byte boundary */
100 int error;
101 int nerrors;
102
103 struct list_head hub_list;
104
105 struct list_head event_list;
106
107 /* Number of ports on the hub */
108 int nports;
109
110 struct usb_hub_descriptor *descriptor;
111 };
112
113 #endif
114
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.