X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FUSB%2FCore%2Fhub.c;h=849e8a3fd6c58a69149c6c2a54d43ce037ab9800;hb=1267ed57f39ebc3e6cdd9ec8835a881a2bcde32c;hp=b737f0789c15761c12c098f5296a5ea50b1a235d;hpb=89e41793b9d495d98633f90e6595722b8e5979d3;p=tpg%2Facess2.git diff --git a/Modules/USB/Core/hub.c b/Modules/USB/Core/hub.c index b737f078..849e8a3f 100644 --- a/Modules/USB/Core/hub.c +++ b/Modules/USB/Core/hub.c @@ -10,13 +10,26 @@ #define MAX_PORTS 32 // Not actually a max, but used for DeviceRemovable + #define GET_STATUS 0 +#define CLEAR_FEATURE 1 +// resvd #define SET_FEATURE 3 #define PORT_CONNECTION 0 #define PORT_ENABLE 1 +#define PORT_SUSPEND 2 +#define PORT_OVER_CURRENT 3 #define PORT_RESET 4 #define PORT_POWER 8 +#define PORT_LOW_SPEED 9 +#define C_PORT_CONNECTION 16 +#define C_PORT_ENABLE 17 +#define C_PORT_SUSPEND 18 +#define C_PORT_OVER_CURRENT 19 +#define C_PORT_RESET 20 +#define PORT_TEST 21 +#define PORT_INDICATOR 21 struct sHubDescriptor { @@ -124,6 +137,8 @@ void Hub_int_HandleChange(tUSBInterface *Dev, int Port) // Get port status USB_Request(Dev, 0, 0xA3, GET_STATUS, 0, Port, 4, status); + + LOG("Port %i: status = {0b%b, 0b%b}", Port, status[0], status[1]); // Handle connections / disconnections if( status[1] & 0x0001 ) @@ -145,6 +160,20 @@ void Hub_int_HandleChange(tUSBInterface *Dev, int Port) // 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); } } -