-
Notifications
You must be signed in to change notification settings - Fork 780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix some HUB related issues #414
base: master
Are you sure you want to change the base?
Conversation
ardi69
commented
Oct 11, 2018
- fix Issue The HID device is not recognized through the USB hub. #334 in USB::AttemptConfig on failure the device is not correctly reseted because devConfig[parent] does not the right thing. Added function USB::ResetHubPort dues the job.
- is a HUB is unplugged from a parent HUB the unplugged HUB is not released.
- is a HUB released its childs are not released
Re #334 will test later today. Thank you! |
i have forgotten: insert in usbhub.h |
@xxxajk did you ever test this? |
@xxxajk ping? |
Pong! will check today. Been overloaded with work... |
PR #414 fixes problems I had with hub + USB mouse + USB keyboard using the hub_demo example. Looks fine. The USBHIDBootKbdAndMouse example also works fine. Moving mouse and pressing keys results in serial console output as expected. I will see if the same fixes apply to the SAMD port. |
UsbDeviceAddress a; | ||
a.devAddress = bAddress; | ||
a.bmHub = 0; | ||
a.bmAddress = port ? : 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what this does when port is non-zero. Is it the equivalent of
if (port) {
a.bmAddress = ;
} else {
a.bmAddress = 1;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Port numbers start at 1.
Right now commits are stopped, but eventually should be resumed.
} else { | ||
for(uint8_t i = 0; i < USB_NUMDEVICES; i++) { | ||
if(!devConfig[i]) continue; | ||
if(devConfig[i]->GetPortAddress() == addr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would be better to replace this with:
if((a.bmHub && devConfig[i]->GetAddress() == addr) || (!a.bmHub && devConfig[i]->GetPortAddress() == addr))
And then get rid of the if(a.bmHub)
if-statement above.
virtual uint8_t GetPortAddress() { | ||
return GetAddress(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the indentation here.
return bPortAddress; | ||
}; | ||
|
||
virtual bool DEVCLASSOK(uint8_t klass) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also fix indentation here.