X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FModules%2FUSB%2FCore%2Fusb_devinit.c;h=06efd217f46935c7c18d901d61cf9231b87bade0;hb=849329d50395b44ac97c5b5145fc2df0749eace2;hp=4b18b30a582c7e5c9e1b0c220a4082d00122f795;hpb=1ba64c63a4a3a8ce27155f9463f0442ea7f7dc89;p=tpg%2Facess2.git diff --git a/KernelLand/Modules/USB/Core/usb_devinit.c b/KernelLand/Modules/USB/Core/usb_devinit.c index 4b18b30a..06efd217 100644 --- a/KernelLand/Modules/USB/Core/usb_devinit.c +++ b/KernelLand/Modules/USB/Core/usb_devinit.c @@ -5,7 +5,7 @@ * usb_devinit.c * - USB Device Initialisation */ -#define DEBUG 0 +#define DEBUG 1 #include #include @@ -72,7 +72,8 @@ void USB_DeviceConnected(tUSBHub *Hub, int Port) LOG(" .SerialNumberStr = Str %i", desc.SerialNumberStr); LOG(" .NumConfigurations = %i", desc.SerialNumberStr); LOG("}"); - + + #if DEBUG if( desc.ManufacturerStr ) { char *tmp = USB_int_GetDeviceString(dev, 0, desc.ManufacturerStr); @@ -91,6 +92,7 @@ void USB_DeviceConnected(tUSBHub *Hub, int Port) LOG("SerialNumbertStr = '%s'", tmp); free(tmp); } + #endif } // TODO: Support alternate configurations @@ -142,6 +144,10 @@ void USB_DeviceConnected(tUSBHub *Hub, int Port) size_t iface_base_ofs; iface = (void*)(full_buf + ptr_ofs); + if( iface->Length == 0 ) { + Log_Warning("USB", "Bad USB descriptor (length = 0)"); + break ; + } ptr_ofs += iface->Length; if( ptr_ofs > total_length ) { // Sanity fail @@ -161,11 +167,13 @@ void USB_DeviceConnected(tUSBHub *Hub, int Port) LOG(" .InterfaceClass = 0x%x", iface->InterfaceClass); LOG(" .InterfaceSubClass = 0x%x", iface->InterfaceSubClass); LOG(" .InterfaceProcol = 0x%x", iface->InterfaceProtocol); + #if DEBUG if( iface->InterfaceStr ) { char *tmp = USB_int_GetDeviceString(dev, 0, iface->InterfaceStr); LOG(" .InterfaceStr = %i '%s'", iface->InterfaceStr, tmp); free(tmp); } + #endif LOG("}"); dev_if = malloc(sizeof(tUSBInterface) + iface->NumEndpoints*sizeof(dev_if->Endpoints[0]));