qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Large USB patch


From: nix . wie . weg
Subject: Re: [Qemu-devel] Large USB patch
Date: Sat, 22 Apr 2006 18:35:49 +0200
User-agent: Mail/News 1.5 (X11/20060228)


Lonnie Mendez wrote:
> address@hidden wrote:
>
> Sorry about that.  I was used to the previous syntax:
> usb_add host:04b6:0005
>
>   My guess is that the new syntax is to distinguish it from the
> busaddr:addr syntax?  It would seem checking for length would
> differentiate the two in that case.
Yes maybe, but not a real good solution, especially if you know that
with the solution we have now, you can omit leading zeros.
>
>   For the linux guest problem which distro is being used?
I don't have this problem any more. It was an incomplete merged patch.

I have attached a small patch, with which you can really add a device to
a hub, if this is then working is another question, but it should only
depend on the implementation of usb-hub.c

With kind regards,
Tino H. Seifert
diff -Nur qemu-last-snapshot/hw/usb-hub.c qemu/hw/usb-hub.c
--- qemu-last-snapshot/hw/usb-hub.c     2006-04-22 17:53:27.000000000 +0200
+++ qemu/hw/usb-hub.c   2006-04-22 18:24:11.000000000 +0200
@@ -172,18 +172,16 @@
 
 static int usb_hub_attach (USBDevice *hub, USBDevice *dev, int portnum)
 {
-    USBHubState *s = (USBHubState *)(dev->father->opaque);
+    USBHubState *s = (USBHubState *)(hub->opaque);
     USBHubPort  *port;
     int i;
     
     if (dev) {
-         if( portnum >= MAX_PORTS ) {
+         if (portnum >= MAX_PORTS || portnum < 0) {
 #ifdef DEBUG        
-            printf( "Not so many ports available on USB hub \n" );
+            printf( "This usb hub port does not exist.\n" );
 #endif
             portnum= 0;
-        } else if( portnum < 0 ){
-            portnum= 0;
         }
         if (s->ports[portnum].dev != NULL) {
 #ifdef DEBUG
@@ -201,7 +199,7 @@
             }
             if( portnum < 0 ) {
 #ifdef DEBUG    
-                printf( "Could not find a Hub Port to connect to!" );        
+                printf( "Could not find a Hub Port to connect to! \n" );       
 
 #endif
                 return 0;
             }
@@ -215,7 +213,8 @@
         else
             port->wPortStatus &= ~PORT_STAT_LOW_SPEED;
         port->dev = dev;
-        return 1;    
+        port->dev->handle_msg (port->dev, USB_MSG_ATTACH);
+        return portnum;    
     } else {
         port = &s->ports[portnum];
         dev = port->dev;
@@ -226,11 +225,13 @@
                 port->wPortStatus &= ~PORT_STAT_ENABLE;
                 port->wPortChange |= PORT_STAT_C_ENABLE;
             }
+            port->dev->handle_msg(port->dev, USB_MSG_DETACH);
             port->dev = NULL;
-            return 1;
+            return portnum;
+        } else {
+            return -1;
         }
     }
-    return -1;
 }
 
 int usb_hub_handle_reset(USBDevice *dev)
diff -Nur qemu-last-snapshot/usb-libusb.c qemu/usb-libusb.c
--- qemu-last-snapshot/usb-libusb.c     2006-04-22 17:53:29.000000000 +0200
+++ qemu/usb-libusb.c   2006-04-22 18:03:47.000000000 +0200
@@ -230,8 +230,8 @@
 }
 
 /* the syntax is : 
-   'bus.addr' (decimal numbers) or 
-   'vendor_id:product_id' (hexa numbers) */
+   'bus:addr' (decimal numbers) or 
+   'vendor_idxproduct_id' (hexa numbers) */
 void usb_host_find_device(const char *devname, struct usb_device **device)
 {
     *device= NULL;
@@ -399,7 +399,7 @@
     usbVersion[1]= (bcd >> 8) & 7;
     usbVersion[2]= (bcd >> 4) & 7;
     usbVersion[3]= bcd & 7;
-    term_printf("     VendorID:ProductID %04x:%04x, USB-Standard: %i%i.%i%i\n",
+    term_printf("     VendorID:ProductID %04xx%04x, USB-Standard: %i%i.%i%i\n",
                 dev->descriptor.idVendor, dev->descriptor.idProduct, 
                 usbVersion[0], usbVersion[1], usbVersion[2], usbVersion[3] );
 }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]