diff --git a/include/device/hid/hid.h b/include/device/hid/hid.h index cc9d0f9..f74289b 100644 --- a/include/device/hid/hid.h +++ b/include/device/hid/hid.h @@ -161,4 +161,4 @@ Result HidAttach(struct UsbDevice *device, u32 interfaceNumber); } #endif -#endif HID_H_ +#endif // HID_H_ diff --git a/source/device/hub.c b/source/device/hub.c index bfb4ebc..c0753ce 100644 --- a/source/device/hub.c +++ b/source/device/hub.c @@ -382,8 +382,10 @@ Result HubCheckConnection(struct UsbDevice *device, u8 port) { Result result; struct HubPortFullStatus *portStatus; struct HubDevice *data; + int prevConnected; data = (struct HubDevice*)device->DriverData; + prevConnected = data->PortStatus[port].Status.Connected; if ((result = HubPortGetStatus(device, port)) != OK) { if (result != ErrorDisconnected) @@ -391,7 +393,12 @@ Result HubCheckConnection(struct UsbDevice *device, u8 port) { return result; } portStatus = &data->PortStatus[port]; - + if (device == UsbGetRootHub()) { + if (prevConnected != portStatus->Status.Connected) { + portStatus->Change.ConnectedChanged = true; + } + } + if (portStatus->Change.ConnectedChanged) { HubPortConnectionChanged(device, port); } @@ -549,4 +556,4 @@ Result HubAttach(struct UsbDevice *device, u32 interfaceNumber) { } return OK; -} \ No newline at end of file +} diff --git a/source/hcd/dwc/designware20.c b/source/hcd/dwc/designware20.c index 34d21ad..a8e4c8b 100644 --- a/source/hcd/dwc/designware20.c +++ b/source/hcd/dwc/designware20.c @@ -247,7 +247,7 @@ Result HcdPrepareChannel(struct UsbDevice *device, u8 channel, // Clear split control. ClearReg(&Host->Channel[channel].SplitControl); - if (pipe->Speed != High) { + if ((pipe->Speed != High) && (device->Parent != NULL) && (device->Parent->Speed == High) && (device->Parent->Parent != NULL)) { Host->Channel[channel].SplitControl.SplitEnable = true; Host->Channel[channel].SplitControl.HubAddress = device->Parent->Number; Host->Channel[channel].SplitControl.PortAddress = device->PortNumber; @@ -367,8 +367,8 @@ Result HcdChannelSendWaitOne(struct UsbDevice *device, } while (true); ReadBackReg(&Host->Channel[channel].TransferSize); - if (Host->Channel[channel].SplitControl.SplitEnable) { - if (Host->Channel[channel].Interrupt.Acknowledgement) { + if (pipe->Speed != High) { + if ((Host->Channel[channel].Interrupt.Acknowledgement) && (Host->Channel[channel].SplitControl.SplitEnable)) { for (tries = 0; tries < 3; tries++) { SetReg(&Host->Channel[channel].Interrupt); WriteThroughReg(&Host->Channel[channel].Interrupt);