Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

fix some HUB related issues #414

wants to merge 2 commits into from

Conversation

ardi69
Copy link

@ardi69 ardi69 commented Oct 11, 2018

  1. 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.
  2. is a HUB is unplugged from a parent HUB the unplugged HUB is not released.
  3. is a HUB released its childs are not released

@xxxajk
Copy link
Contributor

xxxajk commented Oct 11, 2018

Re #334 will test later today. Thank you!

@xxxajk xxxajk added the BUG label Oct 11, 2018
@ardi69
Copy link
Author

ardi69 commented Oct 11, 2018

i have forgotten: insert in usbhub.h
virtual uint8_t GetPortAddress() { return bPortAddress; };

@Lauszus
Copy link
Collaborator

Lauszus commented Oct 24, 2018

@xxxajk did you ever test this?

@Lauszus
Copy link
Collaborator

Lauszus commented Jan 6, 2019

@xxxajk ping?

@xxxajk
Copy link
Contributor

xxxajk commented Jan 6, 2019

Pong! will check today. Been overloaded with work...

@gdsports
Copy link
Contributor

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;
Copy link
Contributor

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;
}

Copy link
Contributor

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)
Copy link
Collaborator

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();
}

Copy link
Collaborator

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) {
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants