From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FXKBt-0003UX-Lf for qemu-devel@nongnu.org; Sat, 22 Apr 2006 11:38:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FXKBs-0003UL-3D for qemu-devel@nongnu.org; Sat, 22 Apr 2006 11:38:33 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FXKBr-0003UI-SR for qemu-devel@nongnu.org; Sat, 22 Apr 2006 11:38:31 -0400 Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.52) id 1FXKDf-0007ml-QK for qemu-devel@nongnu.org; Sat, 22 Apr 2006 11:40:24 -0400 Message-ID: <444A4DF5.2060905@gmx.de> Date: Sat, 22 Apr 2006 17:38:29 +0200 From: nix.wie.weg@gmx.de MIME-Version: 1.0 Subject: Re: [Qemu-devel] Large USB patch References: <4447E811.1040403@gmx.de> <4448F1F6.4090609@austin.rr.com> <4448FF3F.3030009@austin.rr.com> <44490614.50406@austin.rr.com> <44490852.2080608@gmx.de> <44491659.30804@austin.rr.com> <44491F0A.2090608@austin.rr.com> <444926AC.3070104@austin.rr.com> <44494596.3070808@austin.rr.com> <4449F860.1060809@gmx.de> <444A3F7E.6070107@austin.rr.com> <444A4D8C.3090004@gmx.de> In-Reply-To: <444A4D8C.3090004@gmx.de> Content-Type: multipart/mixed; boundary="------------060802010804060707020308" Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------060802010804060707020308 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sorry have forgotten the patch. > --------------060802010804060707020308 Content-Type: text/x-patch; name="multiple-portadds.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="multiple-portadds.patch" --- 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; --------------060802010804060707020308--