X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FModules%2FUSB%2FCore%2Fhub.c;h=7bc4dc270047d53e65f28f5715d4a2e349ad276c;hb=4ebe00546574e97c5316881881f7f2562deea74b;hp=eccaa3fce94a7ce76be9b9cd9251c5b86484fc43;hpb=934d0f535e1929fd90ae0606e77794484aa55284;p=tpg%2Facess2.git diff --git a/KernelLand/Modules/USB/Core/hub.c b/KernelLand/Modules/USB/Core/hub.c index eccaa3fc..7bc4dc27 100644 --- a/KernelLand/Modules/USB/Core/hub.c +++ b/KernelLand/Modules/USB/Core/hub.c @@ -5,7 +5,7 @@ * hub.c * - Basic hub driver */ -#define DEBUG 1 +#define DEBUG 0 #include #include @@ -52,7 +52,7 @@ struct sHubInfo }; // === PROTOTYPES === -void Hub_Connected(tUSBInterface *Dev); +void Hub_Connected(tUSBInterface *Dev, void *Descriptors, size_t Length); void Hub_Disconnected(tUSBInterface *Dev); void Hub_PortStatusChange(tUSBInterface *Dev, int Endpoint, int Length, void *Data); void Hub_int_HandleChange(tUSBInterface *Dev, int Port); @@ -78,13 +78,13 @@ int Hub_DriverInitialise(char **Arguments) } #endif -void Hub_Connected(tUSBInterface *Dev) +void Hub_Connected(tUSBInterface *Dev, void *Descriptors, size_t Length) { struct sHubDescriptor hub_desc; struct sHubInfo *info; - // Read hub descriptor (Class descriptor 0x29) - USB_ReadDescriptor(Dev, 0x129, 0, sizeof(hub_desc), &hub_desc); + // Read hub descriptor (Class descriptor 0x9, destined for device) + USB_ReadDescriptor(Dev, 0x0129, 0, sizeof(hub_desc), &hub_desc); LOG("%i Ports", hub_desc.NbrPorts); LOG("Takes %i ms for power to stabilise", hub_desc.PwrOn2PwrGood*2); @@ -123,8 +123,9 @@ void Hub_PortStatusChange(tUSBInterface *Dev, int Endpoint, int Length, void *Da for( i = 0; i < info->nPorts; i += 8, status ++ ) { if( i/8 >= Length ) break; - if( *status == 0 ) continue; - + LOG("status[%i] = %x", i/8, *status); + if( *status == 0 ) continue; + for( int j = 0; j < 8; j ++ ) if( *status & (1 << j) ) Hub_int_HandleChange(Dev, i+j);