diff -u qemu-0.9.0+20070816/debian/changelog qemu-0.9.0+20070816/debian/changelog --- qemu-0.9.0+20070816/debian/changelog +++ qemu-0.9.0+20070816/debian/changelog @@ -1,3 +1,11 @@ +qemu (0.9.0+20070816-1ubuntu2) hardy; urgency=low + + * debian/patches/92_use_dev_bus_usb_not_proc_bus_usb.patch: + + Fixes broken USB device access since /proc/bus/usb/devices was replaced by + /dev/bus/usb/devices. (LP #156085) + + -- TJ Thu, 8 Nov 2007 14:00:00 +0000 + qemu (0.9.0+20070816-1ubuntu1) hardy; urgency=low * Merge from debian unstable, remaining changes: diff -u qemu-0.9.0+20070816/debian/patches/series qemu-0.9.0+20070816/debian/patches/series --- qemu-0.9.0+20070816/debian/patches/series +++ qemu-0.9.0+20070816/debian/patches/series @@ -31,0 +32 @@ +92_use_dev_bus_usb_not_proc_bus_usb.patch only in patch2: unchanged: --- qemu-0.9.0+20070816.orig/debian/patches/92_use_dev_bus_usb_not_proc_bus_usb.patch +++ qemu-0.9.0+20070816/debian/patches/92_use_dev_bus_usb_not_proc_bus_usb.patch @@ -0,0 +1,66 @@ +Fixes broken USB device access since /proc/bus/usb/devices was replaced by /dev/bus/usb/devices. (LP #156085) + +Index: qemu-0.9.0+20070816/usb-linux.c +=================================================================== +--- qemu-0.9.0+20070816.orig/usb-linux.c 2007-11-08 15:13:17.000000000 +0000 ++++ qemu-0.9.0+20070816/usb-linux.c 2007-11-08 15:19:10.000000000 +0000 +@@ -49,7 +49,17 @@ + + //#define DEBUG + +-#define USBDEVFS_PATH "/proc/bus/usb" ++/* ++ * TJ 2007-11-02 ++ * Now defaults to /dev/bus/usb/devices which was introduced into kernel version 2.6.14 with ++ * commit fbf82fd2e1f4e679c60516d772d1862c941ca845 on Jul 31st 2005. ++ * ++ * If the 'devices' file doesn't exist, code checks for the older "/proc/bus/usb/devices" ++ * before reporting an error. ++*/ ++static unsigned char usb_devfs_path[16]; ++#define USB_DEVFS_PATH_PRE_2_6_14 "/proc/bus/usb" ++#define USB_DEVFS_PATH "/dev/bus/usb" + #define PRODUCT_NAME_SZ 32 + + typedef struct USBHostDevice { +@@ -162,7 +172,7 @@ + devname) < 0) + return NULL; + +- snprintf(buf, sizeof(buf), USBDEVFS_PATH "/%03d/%03d", ++ snprintf(buf, sizeof(buf), "%s/%03d/%03d", usb_devfs_path, + bus_num, addr); + fd = open(buf, O_RDWR); + if (fd < 0) { +@@ -285,11 +295,27 @@ + int bus_num, addr, speed, device_count, class_id, product_id, vendor_id; + int ret; + char product_name[512]; +- +- f = fopen(USBDEVFS_PATH "/devices", "r"); ++ ++ /* TJ 2007-11-02 ++ * Auto-detect USB devices file-system location ++ * pre 2.6.14 kernels used /proc/bus/usb ++ * Standard location is now /dev/bus/usb ++ * Retain correct location in static variable for use by usb_host_device_open() ++ */ ++ snprintf(usb_devfs_path, sizeof(usb_devfs_path), "%s", USB_DEVFS_PATH); ++ /* use buf temporarily to build path to devices file */ ++ snprintf(buf, sizeof(buf), "%s/devices", usb_devfs_path); ++ f = fopen(buf, "r"); + if (!f) { +- term_printf("Could not open %s\n", USBDEVFS_PATH "/devices"); +- return 0; ++ term_printf("Could not open USB devices file %s\n", buf); ++ snprintf(usb_devfs_path, sizeof(usb_devfs_path), "%s", USB_DEVFS_PATH_PRE_2_6_14); ++ snprintf(buf, sizeof(buf), "%s/devices", usb_devfs_path); ++ f = fopen(buf, "r"); ++ if (!f) { ++ term_printf("Could not open USB devices file %s\n", buf); ++ return 0; ++ } ++ term_printf("Opened USB device file %s\n", buf); + } + device_count = 0; + bus_num = addr = speed = class_id = product_id = vendor_id = 0;