Modules/USB - Fixed debugging typo in devinit
[tpg/acess2.git] / KernelLand / Modules / USB / Core / usb_devinit.c
index fb44bb0..d260f62 100644 (file)
@@ -13,7 +13,7 @@
 #include "usb_proto.h"
 #include "usb_lowlevel.h"
 
-#define DUMP_DESCRIPTORS       0
+#define DUMP_DESCRIPTORS       1
 
 // === PROTOTYPES ===
 void   USB_DeviceConnected(tUSBHub *Hub, int Port);
@@ -61,18 +61,18 @@ void USB_DeviceConnected(tUSBHub *Hub, int Port)
                LOG("Device Descriptor = {");
                LOG(" .Length = %i", desc.Length);
                LOG(" .Type = %i", desc.Type);
-               LOG(" .USBVersion = 0x%04x", desc.USBVersion);
+               LOG(" .USBVersion = 0x%04x", LittleEndian16(desc.USBVersion));
                LOG(" .DeviceClass = 0x%02x", desc.DeviceClass);
                LOG(" .DeviceSubClass = 0x%02x", desc.DeviceSubClass);
                LOG(" .DeviceProtocol = 0x%02x", desc.DeviceProtocol);
                LOG(" .MaxPacketSize = 0x%02x", desc.MaxPacketSize);
-               LOG(" .VendorID = 0x%04x", desc.VendorID);
-               LOG(" .ProductID = 0x%04x", desc.ProductID);
-               LOG(" .DeviceID = 0x%04x", desc.DeviceID);
+               LOG(" .VendorID = 0x%04x",  LittleEndian16(desc.VendorID));
+               LOG(" .ProductID = 0x%04x", LittleEndian16(desc.ProductID));
+               LOG(" .DeviceID = 0x%04x",  LittleEndian16(desc.DeviceID));
                LOG(" .ManufacturerStr = Str %i", desc.ManufacturerStr);
                LOG(" .ProductStr = Str %i", desc.ProductStr);
                LOG(" .SerialNumberStr = Str %i", desc.SerialNumberStr);
-               LOG(" .NumConfigurations = %i", desc.SerialNumberStr);
+               LOG(" .NumConfigurations = %i", desc.NumConfigurations);
                LOG("}");
        
                #if DEBUG       
@@ -102,6 +102,8 @@ void USB_DeviceConnected(tUSBHub *Hub, int Port)
                }
                #endif
                #endif
+               
+               memcpy(&dev->DevDesc, &desc, sizeof(desc));
        }
 
        // TODO: Support alternate configurations
@@ -150,10 +152,10 @@ void USB_DeviceConnected(tUSBHub *Hub, int Port)
                total_length = LittleEndian16(desc.TotalLength);
                full_buf = malloc( total_length );
                USB_int_ReadDescriptor(dev, 0, 2, i, total_length, full_buf);
-
                ptr_ofs += desc.Length;
 
-               // TODO: Interfaces
+
+               // Interfaces!
                for( int j = 0; ptr_ofs < total_length && j < desc.NumInterfaces; j ++ )
                {
                        struct sDescriptor_Interface *iface;
@@ -193,11 +195,15 @@ void USB_DeviceConnected(tUSBHub *Hub, int Port)
                        LOG("}");
                        #endif
 
-                       dev_if = malloc(sizeof(tUSBInterface) + iface->NumEndpoints*sizeof(dev_if->Endpoints[0]));
+                       dev_if = malloc(
+                               sizeof(tUSBInterface)
+                               + iface->NumEndpoints*sizeof(dev_if->Endpoints[0])
+                               );
                        dev_if->Dev = dev;
                        dev_if->Driver = NULL;
                        dev_if->Data = NULL;
                        dev_if->nEndpoints = iface->NumEndpoints;
+                       memcpy(&dev_if->IfaceDesc, iface, sizeof(*iface));
                        dev->Interfaces[j] = dev_if;
 
                        // Copy interface data

UCC git Repository :: git.ucc.asn.au