qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: nix.wie.weg@gmx.de
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Large USB patch
Date: Sat, 22 Apr 2006 17:38:29 +0200	[thread overview]
Message-ID: <444A4DF5.2060905@gmx.de> (raw)
In-Reply-To: <444A4D8C.3090004@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 39 bytes --]

Sorry have forgotten the patch.


>   

[-- Attachment #2: multiple-portadds.patch --]
[-- Type: text/x-patch, Size: 4223 bytes --]

--- qemu-2006-04-22/hw/usb.c	2006-04-22 14:44:21.000000000 +0200
+++ qemu/hw/usb.c	2006-04-22 17:24:06.000000000 +0200
@@ -403,73 +403,74 @@
 
 /* this function adds a newly created device and cares for the attach and
    handles all errors */
-int add_usb_device (USBTree *tree) 
+int add_usb_device (USBTree **tree) 
 {
     char father[USB_PATH_MAX_LENGTH];
     char child[USB_PATH_MAX_LENGTH];
     int port;
     USBDevice *fatherdev;
-    if (tree->dev == NULL) {
-        usb_remove_device(&tree);
+    if ((*tree)->dev == NULL) {
+        usb_remove_device(tree);
         return -1;
     }
-    usb_str_father_and_child (tree->path, father, child);
+    usb_str_father_and_child ((*tree)->path, father, child);
     fatherdev= usb_find_device (father);
     if (!fatherdev ) {
 #ifdef DEBUG                
-        printf ( "Could not find father father USB for %s.\n", tree->name);
+        printf ( "Could not find father father USB for %s.\n", (*tree)->name);
 #endif
-        usb_remove_device(&tree);
+        usb_remove_device(tree);
         return -1;
     }
-    tree->dev->father= fatherdev;
     port= atoi (child)-1;
-    port= fatherdev->handle_attach(fatherdev, tree->dev, port);
+    port= fatherdev->handle_attach(fatherdev, (*tree)->dev, port);
     if( port < 0 ) {
 #ifdef DEBUG                
-        printf ( "Could not attach USB host device %s.\n", tree->name);
-#endif          
+        printf ( "Could not attach USB host device %s.\n", (*tree)->name);
+#endif  
+        usb_remove_device(tree);        
         return -1;
     }
-    tree->dev->father_port= port;
-    snprintf( tree->path, USB_PATH_MAX_LENGTH,"%s:%03i", father, port+1);
+    (*tree)->dev->father= fatherdev;
+    (*tree)->dev->father_port= port;
+    snprintf( (*tree)->path, USB_PATH_MAX_LENGTH,"%s:%03i", father, port+1);
     return 0;
 }
 
 
 /* this function does decide which device should be added, if you write a new
    device driver than you must add it here */
-int usb_add_device( PCIBus *pci_bus, USBTree *tree ) 
+int usb_add_device (PCIBus *pci_bus, USBTree **tree) 
 {
-    if (strcmp(tree->name, "uhci") == 0) {
+    if (strcmp((*tree)->name, "uhci") == 0) {
         /* uhci controller found */
         /* controller are allways root devices, so no add is tried */
         if (pci_bus != NULL) {
-            tree->dev= usb_uhci_init (pci_bus);
-            if( tree->dev != NULL ) {
+            (*tree)->dev= usb_uhci_init (pci_bus);
+            if( (*tree)->dev != NULL ) {
                 return 0;
             }
         }
-        usb_remove_device(&tree);
+        usb_remove_device(tree);
         return -1;
-    } else if (strstr (tree->name, "host:") == tree->name) {
+    } else if (strstr ((*tree)->name, "host:") == (*tree)->name) {
         /* we found a host device */
-        tree->dev= usb_host_init (tree->name);
+        (*tree)->dev= usb_host_init ((*tree)->name);
         return add_usb_device (tree);
-    } else if (strcmp (tree->name,"usbhub") == 0) {
+    } else if (strcmp ((*tree)->name,"usbhub") == 0) {
         /* we found a guest usb hub */
-        tree->dev= usb_hub_init (4);
+        (*tree)->dev= usb_hub_init (4);
         return add_usb_device (tree);
-    } else if (strcmp (tree->name,"mouse") == 0) {
+    } else if (strcmp ((*tree)->name,"mouse") == 0) {
         /* we found a guest usb mouse */
-        tree->dev= usb_mouse_init ();
+        (*tree)->dev= usb_mouse_init ();
         return add_usb_device (tree);
-    } else if (strcmp (tree->name,"tablet") == 0) {
+    } else if (strcmp ((*tree)->name,"tablet") == 0) {
         /* we found a guest usb tablet */
-        tree->dev = usb_tablet_init ();
+        (*tree)->dev = usb_tablet_init ();
         return add_usb_device (tree);
     } else {
-        usb_remove_device(&tree);
+        usb_remove_device(tree);
         return -1;
     }
 }
@@ -482,7 +483,7 @@
     for (;tmp != NULL; tmp= tmp->next) {
         switch (tmp->device_status) {
         case USB_ADD_DEVICE:
-            if (usb_add_device (pci_bus, tmp) < 0)
+            if (usb_add_device (pci_bus, &tmp) < 0)
                 ret= -1;
             else
                 tmp->device_status= USB_STANDARD_DEVICE;

  reply	other threads:[~2006-04-22 15:38 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-20 19:59 [Qemu-devel] Large USB patch nix.wie.weg
2006-04-21  2:23 ` Lonnie Mendez
2006-04-21  5:59   ` nix.wie.weg
2006-04-21  7:04     ` Lonnie Mendez
2006-04-21 14:53 ` Lonnie Mendez
2006-04-21 15:00   ` Lonnie Mendez
2006-04-21 15:50   ` Lonnie Mendez
2006-04-21 16:19     ` Lonnie Mendez
2006-04-21 16:29       ` nix.wie.weg
2006-04-21 17:28         ` Lonnie Mendez
2006-04-21 18:06           ` Lonnie Mendez
2006-04-21 18:38             ` Lonnie Mendez
2006-04-21 20:50               ` Lonnie Mendez
2006-04-22  9:33                 ` nix.wie.weg
2006-04-22 14:36                   ` Lonnie Mendez
2006-04-22 15:36                     ` nix.wie.weg
2006-04-22 15:38                       ` nix.wie.weg [this message]
2006-04-22 16:00                     ` nix.wie.weg
2006-04-22 16:19                       ` Lonnie Mendez
2006-04-22 16:35                         ` nix.wie.weg
2006-04-23  3:38                           ` Lonnie Mendez
2006-04-23 21:54                             ` nix.wie.weg
2006-04-29  1:03                             ` Lonnie Mendez
2006-04-29  3:29                               ` Lonnie Mendez
2006-04-30  0:46                                 ` Lonnie Mendez
2006-04-30 20:56                                   ` Lonnie Mendez
2006-04-21 16:26     ` nix.wie.weg
2006-04-22 14:15 ` nix.wie.weg
2006-04-23 15:02 ` Fabrice Bellard
2006-04-23 16:11   ` nix.wie.weg
2006-04-24 23:50 ` [Qemu-devel] Update for cvs 2006-04-24 nix.wie.weg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=444A4DF5.2060905@gmx.de \
    --to=nix.wie.weg@gmx.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).