On Thu, Mar 16, 2000 at 10:37:08PM +0000, Matthew Dharm wrote:
> Could someone with more experience than I with the virtual root hub code
> hack somehting in for me?  I'd like some of the string descriptors to be
> usable to identify which one it is.  On my system, I have a Tyan MB which

Try the attached patch for usb-uhci. It's a quick 5-minute hack and may not
exactly reflect the information you want to see, but it's a start. Since the
virtual root hub code is more or less the same in all HCDs (developed by
Roman Weissgaerber), it should be easy to patch the other drivers.

The patch should not break anything, so if you like it, include it in 
2.3.99-pre??.
-- 
        Bye
         Georg Acher, [EMAIL PROTECTED]         
         http://www.in.tum.de/~acher/
          "Oh no, not again !" The bowl of petunias          
diff -u linux/drivers/usb/usb-uhci.c linux.afs/drivers/usb/usb-uhci.c
--- linux/drivers/usb/usb-uhci.c        Mon Mar 20 23:36:45 2000
+++ linux.afs/drivers/usb/usb-uhci.c    Mon Mar 20 23:36:26 2000
@@ -1618,9 +1618,9 @@
        0x00,
        0x00,                   /*  __u16 bcdDevice; */
        0x00,
-       0x00,                   /*  __u8  iManufacturer; */
-       0x00,                   /*  __u8  iProduct; */
-       0x00,                   /*  __u8  iSerialNumber; */
+       0x01,                   /*  __u8  iManufacturer; */
+       0x02,                   /*  __u8  iProduct; */
+       0x03,                   /*  __u8  iSerialNumber; */
        0x01                    /*  __u8  bNumConfigurations; */
 };
 
@@ -1674,6 +1674,14 @@
        0xff                    /*  __u8  PortPwrCtrlMask; *** 7 ports max *** */
 };
 
+_static __u8  root_hub_langid_des[] =
+{
+       0x04,
+       0x03,
+       0x00,
+       0x00
+};
+
 /*-------------------------------------------------------------------------*/
 /* prepare Interrupt pipe transaction data; HUB INTERRUPT ENDPOINT */
 _static int rh_send_irq (urb_t *urb)
@@ -1780,6 +1788,10 @@
        __u16 wIndex;
        __u16 wLength;
 
+       int stlen,n;
+       char* stringd;
+
+
        if (usb_pipetype (pipe) == PIPE_INTERRUPT) {
                dbg("Root-Hub submit IRQ: every %d ms", urb->interval);
                uhci->rh.urb = urb;
@@ -1917,8 +1929,46 @@
                        len = min (leni, min (sizeof (root_hub_config_des), wLength));
                        memcpy (data, root_hub_config_des, len);
                        OK (len);
+
                case (0x03):    /*string descriptors */
-                       stat = -EPIPE;
+                       if ((wValue&0xff) == 0 ) {
+                               len = min (leni, min (sizeof (root_hub_langid_des), 
+wLength));  
+                               memcpy (data, root_hub_langid_des, len);
+                               OK(len);
+                       }
+                       else if ((wValue&0xff) <= 3 ) {
+                               stringd = (char*)kmalloc(128,KMALLOC_FLAG);
+                               if (stringd) {
+                                       struct pci_dev *pcd=uhci->uhci_pci;
+                                       
+                                       if ((wValue&0xff) == 1 )
+                                               memcpy(stringd, 
+pcd->name,sizeof(pcd->name));
+                                       else if ((wValue&0xff) == 2 )
+                                               sprintf(stringd, "UHCI controller & 
+root hub, PCI-Vendor: %04x PCI-ID: %04x",
+                                                       pcd->vendor, pcd->device);
+                                       else
+                                               sprintf(stringd,"PCI-Bus %i, device 
+%i, function %i",
+                                                       pcd->bus->number, 
+PCI_SLOT(pcd->devfn), PCI_FUNC(pcd->devfn));
+                                                       
+                                       stlen = 2 + 2*strlen(stringd);
+                                       len = min (leni, min (stlen, wLength));
+                                       for(n=0;n<stlen;n++)
+                                       {
+                                               if (n == 0)
+                                                       ((char*)data)[0] = stlen;
+                                               else if (n == 1)
+                                                       ((char*)data)[1] = 3;
+                                               else if (!(n&1))
+                                                       ((char*)data)[n] = stringd[n/2 
+- 1];
+                                               else
+                                                       ((char*)data)[n] = 0;
+                                       }
+                                       kfree(stringd);
+                               }
+                               OK(len);
+                       }
+                       else
+                               stat = -EPIPE;
                }
                break;
 
@@ -2608,7 +2658,7 @@
 #endif
        printk(KERN_INFO __FILE__ ": USB UHCI at I/O 0x%x, IRQ %s\n",
                io_addr, bufp);
-                                        
+       
        s = kmalloc (sizeof (uhci_t), GFP_KERNEL);
        if (!s)
                return -1;
@@ -2626,7 +2676,8 @@
        s->io_size = io_size;
        s->next = devs; //chain new uhci device into global list        
        s->frame_counter = 0;
-       
+       s->uhci_pci=dev;
+
        bus = usb_alloc_bus (&uhci_device_operations);
        if (!bus) {
                kfree (s);
diff -u linux/drivers/usb/usb-uhci.h linux.afs/drivers/usb/usb-uhci.h
--- linux/drivers/usb/usb-uhci.h        Mon Mar 20 23:33:24 2000
+++ linux.afs/drivers/usb/usb-uhci.h    Mon Mar 20 22:42:57 2000
@@ -209,6 +209,7 @@
 
        struct list_head urb_unlinked;  // list of all unlinked  urbs
        int frame_counter;
+       struct pci_dev *uhci_pci;
 } uhci_t, *puhci_t;
 
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to