00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00035 #ifndef LIBUSB_CLASS_HUB_H_
00036 #define LIBUSB_CLASS_HUB_H_
00037
00038 #include <sys/types.h>
00039
00044 typedef enum {
00045 USB_HUB_FEATURE_HUB_LOCAL_POWER = 0,
00046 USB_HUB_FEATURE_HUB_OVER_CURRENT = 1,
00047 USB_HUB_FEATURE_C_HUB_LOCAL_POWER = 0,
00048 USB_HUB_FEATURE_C_HUB_OVER_CURRENT = 1,
00049 USB_HUB_FEATURE_PORT_CONNECTION = 0,
00050 USB_HUB_FEATURE_PORT_ENABLE = 1,
00051 USB_HUB_FEATURE_PORT_SUSPEND = 2,
00052 USB_HUB_FEATURE_PORT_OVER_CURRENT = 3,
00053 USB_HUB_FEATURE_PORT_RESET = 4,
00054 USB_HUB_FEATURE_PORT_POWER = 8,
00055 USB_HUB_FEATURE_PORT_LOW_SPEED = 9,
00056 USB_HUB_FEATURE_C_PORT_CONNECTION = 16,
00057 USB_HUB_FEATURE_C_PORT_ENABLE = 17,
00058 USB_HUB_FEATURE_C_PORT_SUSPEND = 18,
00059 USB_HUB_FEATURE_C_PORT_OVER_CURRENT = 19,
00060 USB_HUB_FEATURE_C_PORT_RESET = 20,
00061
00062 } usb_hub_class_feature_t;
00063
00064
00066 typedef struct {
00068 uint8_t length;
00070 uint8_t descriptor_type;
00072 uint8_t port_count;
00074 uint16_t characteristics;
00076 uint8_t power_good_time;
00078 uint8_t max_current;
00079 } __attribute__ ((packed)) usb_hub_descriptor_header_t;
00080
00086 typedef struct usb_hub_descriptor_type {
00088
00089
00091
00092
00094 uint8_t ports_count;
00095
00120 uint16_t hub_characteristics;
00121
00129 uint8_t pwr_on_2_good_time;
00130
00135 uint8_t current_requirement;
00136
00154 uint8_t devices_removable[32];
00155
00164
00165 } usb_hub_descriptor_t;
00166
00167
00168
00173 typedef enum {
00175 USB_HUB_REQ_TYPE_CLEAR_HUB_FEATURE = 0x20,
00177 USB_HUB_REQ_TYPE_CLEAR_PORT_FEATURE = 0x23,
00179 USB_HUB_REQ_TYPE_GET_STATE = 0xA3,
00181 USB_HUB_REQ_TYPE_GET_DESCRIPTOR = 0xA0,
00183 USB_HUB_REQ_TYPE_GET_HUB_STATUS = 0xA0,
00185 USB_HUB_REQ_TYPE_GET_PORT_STATUS = 0xA3,
00187 USB_HUB_REQ_TYPE_SET_DESCRIPTOR = 0x20,
00189 USB_HUB_REQ_TYPE_SET_HUB_FEATURE = 0x20,
00191 USB_HUB_REQ_TYPE_SET_PORT_FEATURE = 0x23
00192 } usb_hub_bm_request_type_t;
00193
00195
00196 typedef enum {
00198 USB_HUB_REQUEST_GET_STATUS = 0,
00200 USB_HUB_REQUEST_CLEAR_FEATURE = 1,
00202 USB_HUB_REQUEST_GET_STATE = 2,
00204 USB_HUB_REQUEST_SET_FEATURE = 3,
00206 USB_HUB_REQUEST_GET_DESCRIPTOR = 6,
00208 USB_HUB_REQUEST_SET_DESCRIPTOR = 7
00209 } usb_hub_request_t;
00210
00214 extern size_t USB_HUB_MAX_DESCRIPTOR_SIZE;
00215
00216
00217
00218
00219
00220
00221
00222 #endif
00223