* usb_devinit.c
* - USB Device Initialisation
*/
-#define DEBUG 0
+#define DEBUG 1
#include <acess.h>
#include <vfs.h>
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);
LOG("SerialNumbertStr = '%s'", tmp);
free(tmp);
}
+ #endif
}
// TODO: Support alternate configurations
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
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]));