Sorry have forgotten the 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;
_______________________________________________ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel