19 bool USBHub::bResetInitiated =
false;
44 uint8_t
USBHub::Init(uint8_t parent, uint8_t port,
bool lowspeed) {
88 len = (buf[0] > 32) ? 32 : buf[0];
111 rcode = pUsb->
setAddr(0, 0, bAddress);
127 rcode = pUsb->
getDevDescr(bAddress, 0, len, (uint8_t*)buf);
130 goto FailGetDevDescr;
136 goto FailSetDevTblEntry;
145 goto FailGetHubDescr;
158 rcode = pUsb->
getConfDescr(bAddress, 0, cd_len, 0, buf);
161 goto FailGetConfDescr;
168 rcode = pUsb->
getConfDescr(bAddress, 0, buf[0], 0, buf2);
171 goto FailGetConfDescr;
175 rcode = pUsb->
setConf(bAddress, 0, buf[5]);
178 goto FailSetConfDescr;
184 for(uint8_t j = 1; j <= bNbrPorts; j++)
235 if(((int32_t)((uint32_t)millis() - qNextPollTime) >= 0
L)) {
236 rcode = CheckHubStatus();
237 qNextPollTime = (uint32_t)millis() + 100;
242 uint8_t USBHub::CheckHubStatus() {
247 rcode = pUsb->
inTransfer(bAddress, 1, &read, buf);
263 for(uint8_t port = 1, mask = 0x02; port < 8; mask <<= 1, port++) {
273 rcode = PortStatusChange(port, evt);
283 for(uint8_t port = 1; port <= bNbrPorts; port++) {
298 rcode = PortStatusChange(port, evt);
319 for(
int i = 0; i < 3; i++) {
332 uint8_t USBHub::PortStatusChange(uint8_t port,
HubEvent &evt) {
343 bResetInitiated =
true;
350 bResetInitiated =
false;
371 bResetInitiated =
false;
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
#define bmHUB_PORT_STATE_CHECK_DISABLED
#define bmHUB_PORT_EVENT_LS_RESET_COMPLETE
#define bmHUB_PORT_STATUS_PORT_CONNECTION
#define bmHUB_PORT_STATUS_C_PORT_SUSPEND
#define USB_ERROR_EPINFO_IS_NULL
#define HUB_ERROR_PORT_HAS_BEEN_RESET
#define HUB_FEATURE_PORT_POWER
#define bmHUB_PORT_STATUS_PORT_LOW_SPEED
#define bmHUB_PORT_STATUS_PORT_SUSPEND
#define HUB_FEATURE_C_PORT_RESET
#define bmHUB_PORT_STATUS_PORT_OVER_CURRENT
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
void ResetHubPort(uint8_t port)
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
virtual void FreeAddress(uint8_t addr)=0
#define bmHUB_PORT_STATUS_C_PORT_ENABLE
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
#define USB_NAK_MAX_POWER
#define bmHUB_PORT_STATE_DISABLED
uint8_t GetHubDescriptor(uint8_t index, uint16_t nbytes, uint8_t *dataptr)
#define bmHUB_PORT_STATUS_PORT_POWER
#define bmHUB_PORT_STATUS_PORT_HIGH_SPEED
uint8_t ClearPortFeature(uint8_t fid, uint8_t port, uint8_t sel=0)
#define bmHUB_PORT_STATUS_C_PORT_OVER_CURRENT
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
#define bmHUB_PORT_STATUS_C_PORT_RESET
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
#define HUB_FEATURE_C_PORT_CONNECTION
void PrintHubPortStatus(USBHub *hubptr, uint8_t addr, uint8_t port, bool print_changes)
#define bmHUB_PORT_STATUS_PORT_RESET
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
uint8_t GetPortStatus(uint8_t port, uint16_t nbytes, uint8_t *dataptr)
#define bmHUB_PORT_EVENT_CONNECT
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
#define HUB_FEATURE_PORT_RESET
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
#define bmHUB_PORT_STATUS_PORT_ENABLE
AddressPool & GetAddressPool()
uint8_t Configuring(uint8_t parent, uint8_t port, bool lowspeed)
#define bmHUB_PORT_STATUS_PORT_INDICATOR
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
#define bmHUB_PORT_STATUS_PORT_TEST
#define bmHUB_PORT_EVENT_LS_CONNECT
#define bmHUB_PORT_STATUS_C_PORT_CONNECTION
#define bmHUB_PORT_EVENT_RESET_COMPLETE
uint8_t SetPortFeature(uint8_t fid, uint8_t port, uint8_t sel=0)
#define HUB_FEATURE_C_PORT_ENABLE
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
uint8_t ReleaseDevice(uint8_t addr)
#define bmHUB_PORT_EVENT_DISCONNECT