1 #include "devices/usb.h"
2 #include "devices/usb_hub.h"
5 #define USB_CLASS_HUB 0x09
7 #define REQ_HUB_GET_STATUS 0
8 #define REQ_HUB_CLEAR_FEATURE 1
9 #define REQ_HUB_SET_FEATURE 2
10 #define REQ_HUB_GET_DESC 6
11 #define REQ_HUB_SET_DESC 7
12 #define REQ_HUB_CLEAR_TT_BUF 8
13 #define REQ_HUB_RESET_TT 9
14 #define REQ_HUB_GET_TT_STATE 10
15 #define REQ_HUB_STOP_TT 11
17 #define HUB_SEL_HUB_POWER 0
18 #define HUB_SEL_OVER_CURRENT 1
19 #define HUB_SEL_PORT_CONN 0
20 #define HUB_SEL_PORT_ENABLE 1
21 #define HUB_SEL_PORT_SUSPEND 2
22 #define HUB_SEL_PORT_OVER_CURRENT 3
23 #define HUB_SEL_PORT_RESET 4
24 #define HUB_SEL_PORT_POWER 8
25 #define HUB_SEL_PORT_LOW_SPEED 9
27 #define SETUP_DESC_HUB 0x29
29 static void* hub_attached(struct usb_iface*);
30 static void hub_detached(class_info);
32 static struct usb_class hub_class = {
33 .attached = hub_attached,
34 .detached = hub_detached,
35 .class_id = USB_CLASS_HUB,
40 void usb_hub_init(void)
42 usb_register_class(&hub_class);
46 static void* hub_attached(struct usb_iface* ui UNUSED)
51 static void hub_detached(class_info info UNUSED)