Skip to content
2 changes: 1 addition & 1 deletion include/device/hid/hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,4 @@ Result HidAttach(struct UsbDevice *device, u32 interfaceNumber);
}
#endif

#endif HID_H_
#endif // HID_H_
11 changes: 9 additions & 2 deletions source/device/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,16 +382,23 @@ 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)
LOGF("HUB: Failed to get hub port status (1) for %s.Port%d.\n", UsbGetDescription(device), port + 1);
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);
}
Expand Down Expand Up @@ -549,4 +556,4 @@ Result HubAttach(struct UsbDevice *device, u32 interfaceNumber) {
}

return OK;
}
}
6 changes: 3 additions & 3 deletions source/hcd/dwc/designware20.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down