Gentoo Archives: gentoo-commits

From: "Jorge Manuel B. S. Vicetto (jmbsvicetto)" <jmbsvicetto@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in app-emulation/qemu-kvm/files: qemu-kvm-guest-hang-on-usb-add.patch qemu-kvm-0.12.1-kvm_save_mpstate-workaround.patch
Date: Tue, 02 Nov 2010 16:29:22
Message-Id: 20101102162919.842C12003C@flycatcher.gentoo.org
1 jmbsvicetto 10/11/02 16:29:19
2
3 Added: qemu-kvm-guest-hang-on-usb-add.patch
4 Removed: qemu-kvm-0.12.1-kvm_save_mpstate-workaround.patch
5 Log:
6 Synced the qemu-kvm-0.13.0-r1 ebuild with qemu-kvm-9999 ebuild.
7 Added missing jpeg and png use flags. Dropped the non-existent kvm-trace use flag - fixes bug 343317.
8 Moved some checks from pkg_setup to src_configure. Applied the fix to the $(prefix)/etc issue.
9 Dropped unused qemu-kvm-0.12.1-kvm_save_mpstate-workaround.patch file - fixes bug 340727.
10 Included patch file to fix issues with usb, bug 337988 , but won't use it until upstream commits it to the git tree or gives an ok.
11 Dropped old version.
12
13 (Portage version: 2.2.0_alpha3/cvs/Linux x86_64)
14
15 Revision Changes Path
16 1.1 app-emulation/qemu-kvm/files/qemu-kvm-guest-hang-on-usb-add.patch
17
18 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/qemu-kvm/files/qemu-kvm-guest-hang-on-usb-add.patch?rev=1.1&view=markup
19 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/qemu-kvm/files/qemu-kvm-guest-hang-on-usb-add.patch?rev=1.1&content-type=text/plain
20
21 Index: qemu-kvm-guest-hang-on-usb-add.patch
22 ===================================================================
23 From 485b75728884a052b74d5458199ad45f0acbf190 Mon Sep 17 00:00:00 2001
24 From: Timothy Jones <one.timothy.jones@×××××.com>
25 Date: Mon, 28 Jun 2010 10:38:18 -0400
26 Subject: [PATCH v2] Guest OS hangs on usb_add
27
28 This is a small patch to sligtly "intelligentify" usb device and
29 config descriptor parsing and to handle bug with certain usb
30 device (URC MX-950) reporting device desriptor length as 0x18
31 instead of 18 with added vendor_id/product_id check
32 ---
33 hw/usb.h | 5 +++++
34 usb-linux.c | 37 ++++++++++++++++++++++---------------
35 2 files changed, 27 insertions(+), 15 deletions(-)
36
37 diff --git a/hw/usb.h b/hw/usb.h
38 index 00d2802..5c3528f 100644
39 --- a/hw/usb.h
40 +++ b/hw/usb.h
41 @@ -117,6 +117,11 @@
42 #define USB_DT_INTERFACE 0x04
43 #define USB_DT_ENDPOINT 0x05
44
45 +#define USB_DT_DEVICE_LEN 18
46 +#define USB_DT_CONFIG_LEN 9
47 +#define USB_DT_INTERFACE_LEN 9
48 +#define USB_DT_ENDPOINT_LEN 7
49 +
50 #define USB_ENDPOINT_XFER_CONTROL 0
51 #define USB_ENDPOINT_XFER_ISOC 1
52 #define USB_ENDPOINT_XFER_BULK 2
53 diff --git a/usb-linux.c b/usb-linux.c
54 index 88273ff..2ac6562 100644
55 --- a/usb-linux.c
56 +++ b/usb-linux.c
57 @@ -288,7 +288,7 @@ static void async_cancel(USBPacket *unused, void *opaque)
58
59 static int usb_host_claim_interfaces(USBHostDevice *dev, int configuration)
60 {
61 - int dev_descr_len, config_descr_len;
62 + int dev_descr_len, config_descr_total_len;
63 int interface, nb_interfaces;
64 int ret, i;
65
66 @@ -297,32 +297,39 @@ static int usb_host_claim_interfaces(USBHostDevice *dev, int configuration)
67
68 DPRINTF("husb: claiming interfaces. config %d\n", configuration);
69
70 - i = 0;
71 dev_descr_len = dev->descr[0];
72 - if (dev_descr_len > dev->descr_len) {
73 + if (dev_descr_len == 0x18 && dev->descr[ 8] == 0x47 && dev->descr[ 9] == 0x46
74 + && dev->descr[10] == 0x00 && dev->descr[11] == 0x30)
75 + dev_descr_len = USB_DT_DEVICE_LEN; /* for buggy MX-950 remote reporting len in hex */
76 +
77 + if (dev_descr_len > dev->descr_len || dev_descr_len < USB_DT_DEVICE_LEN || dev->descr[1] != USB_DT_DEVICE) {
78 + fprintf(stderr, "husb: invalid device descriptor\n");
79 goto fail;
80 }
81
82 - i += dev_descr_len;
83 - while (i < dev->descr_len) {
84 + for (i = dev_descr_len; i < dev->descr_len; ) {
85 DPRINTF("husb: i is %d, descr_len is %d, dl %d, dt %d\n",
86 i, dev->descr_len,
87 dev->descr[i], dev->descr[i+1]);
88
89 - if (dev->descr[i+1] != USB_DT_CONFIG) {
90 - i += dev->descr[i];
91 - continue;
92 + if (dev->descr[i] < 2) {
93 + fprintf(stderr, "husb: invalid descriptor\n");
94 + goto fail;
95 }
96 - config_descr_len = dev->descr[i];
97 + if (dev->descr[i+1] == USB_DT_CONFIG) {
98 + config_descr_total_len = dev->descr[i+2] + (dev->descr[i+3] << 8);
99
100 - printf("husb: config #%d need %d\n", dev->descr[i + 5], configuration);
101 + printf("husb: config #%d need %d\n", dev->descr[i + 5], configuration);
102
103 - if (configuration < 0 || configuration == dev->descr[i + 5]) {
104 - configuration = dev->descr[i + 5];
105 - break;
106 - }
107 + if (configuration < 0 || configuration == dev->descr[i + 5]) {
108 + configuration = dev->descr[i + 5];
109 + break;
110 + }
111
112 - i += config_descr_len;
113 + i += config_descr_total_len;
114 + }
115 + else
116 + i += dev->descr[i];
117 }
118
119 if (i >= dev->descr_len) {
120 --
121 1.7.1