+ LOG("Port %i: status = {0b%b, 0b%b}", Port, status[0], status[1]);
+
+ // Handle connections / disconnections
+ if( status[1] & 0x0001 )
+ {
+ if( status[0] & 0x0001 ) {
+ // Connected
+ // - Power on port
+ USB_Request(Dev, 0, 0x23, SET_FEATURE, PORT_POWER, Port, 0, NULL);
+ Time_Delay(info->PowerOnDelay);
+ // - Reset
+ USB_Request(Dev, 0, 0x23, SET_FEATURE, PORT_RESET, Port, 0, NULL);
+ Time_Delay(20); // Spec says 10ms after reset, but how long is reset?
+ // - Enable
+ USB_Request(Dev, 0, 0x23, SET_FEATURE, PORT_ENABLE, Port, 0, NULL);
+ // - Poke USB Stack
+ USB_DeviceConnected(info->HubPtr, Port);
+ }
+ else {
+ // Disconnected
+ USB_DeviceDisconnected(info->HubPtr, Port);
+ }
+
+ USB_Request(Dev, 0, 0x23, CLEAR_FEATURE, C_PORT_CONNECTION, Port, 0, NULL);
+ }
+
+ // Reset change
+ if( status[1] & 0x0010 )
+ {
+ if( status[0] & 0x0010 ) {
+ // Reset complete
+ }
+ else {
+ // Useful?
+ }
+ // ACK
+ USB_Request(Dev, 0, 0x23, CLEAR_FEATURE, C_PORT_RESET, Port, 0, NULL);
+ }
+}