19 bool USBHub::bResetInitiated =
false;
42 uint8_t
USBHub::Init(uint8_t parent, uint8_t port,
bool lowspeed) {
82 len = (buf[0] > 32) ? 32 : buf[0];
105 rcode = pUsb->
setAddr(0, 0, bAddress);
121 rcode = pUsb->
getDevDescr(bAddress, 0, len, (uint8_t*)buf);
124 goto FailGetDevDescr;
130 goto FailSetDevTblEntry;
139 goto FailGetHubDescr;
152 rcode = pUsb->
getConfDescr(bAddress, 0, cd_len, 0, buf);
155 goto FailGetConfDescr;
162 rcode = pUsb->
getConfDescr(bAddress, 0, buf[0], 0, buf2);
165 goto FailGetConfDescr;
169 rcode = pUsb->
setConf(bAddress, 0, buf[5]);
172 goto FailSetConfDescr;
178 for (uint8_t j = 1; j <= bNbrPorts; j++)
211 if (bAddress == 0x41)
227 if (qNextPollTime <= millis()) {
228 rcode = CheckHubStatus();
229 qNextPollTime = millis() + 100;
234 uint8_t USBHub::CheckHubStatus() {
239 rcode = pUsb->
inTransfer(bAddress, 1, &read, buf);
255 for (uint8_t port = 1, mask = 0x02; port < 8; mask <<= 1, port++) {
265 rcode = PortStatusChange(port, evt);
275 for (uint8_t port = 1; port <= bNbrPorts; port++) {
290 rcode = PortStatusChange(port, evt);
301 uint8_t USBHub::PortStatusChange(uint8_t port,
HubEvent &evt) {
312 bResetInitiated =
true;
319 bResetInitiated =
false;
339 bResetInitiated =
false;
353 Serial.println(
"ERROR!");
356 Serial.print(
"\r\nPort ");
357 Serial.println(port, DEC);
359 Serial.println(
"Status");
360 Serial.print(
"CONNECTION:\t");
362 Serial.print(
"ENABLE:\t\t");
364 Serial.print(
"SUSPEND:\t");
366 Serial.print(
"OVER_CURRENT:\t");
368 Serial.print(
"RESET:\t\t");
370 Serial.print(
"POWER:\t\t");
372 Serial.print(
"LOW_SPEED:\t");
374 Serial.print(
"HIGH_SPEED:\t");
376 Serial.print(
"TEST:\t\t");
378 Serial.print(
"INDICATOR:\t");
384 Serial.println(
"\r\nChange");
385 Serial.print(
"CONNECTION:\t");
387 Serial.print(
"ENABLE:\t\t");
389 Serial.print(
"SUSPEND:\t");
391 Serial.print(
"OVER_CURRENT:\t");
393 Serial.print(
"RESET:\t\t");