From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=33335 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PIRcS-0001ro-Jd for qemu-devel@nongnu.org; Tue, 16 Nov 2010 14:55:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PIRcP-0006uy-2U for qemu-devel@nongnu.org; Tue, 16 Nov 2010 14:55:08 -0500 Received: from mail-qw0-f45.google.com ([209.85.216.45]:62033) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PIRcO-0006uo-Sh for qemu-devel@nongnu.org; Tue, 16 Nov 2010 14:55:05 -0500 Received: by qwi2 with SMTP id 2so309369qwi.4 for ; Tue, 16 Nov 2010 11:55:04 -0800 (PST) Message-ID: <4CE2E198.4020708@codemonkey.ws> Date: Tue, 16 Nov 2010 13:55:04 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] Fwd: [PATCH v2] Guest OS hangs on usb_add References: <4CD02560.9030103@gmail.com> <4CE29C77.9080502@codemonkey.ws> <4CE2DD27.3020608@gmail.com> In-Reply-To: <4CE2DD27.3020608@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: TJ Cc: "qemu-devel@nongnu.org" On 11/16/2010 01:36 PM, TJ wrote: > On 11/16/2010 10:00 AM, Anthony Liguori wrote: > >> On 11/02/2010 09:51 AM, TJ wrote: >> >>> Doesn't look like this has ever been committed. qemu-kvm-0.13 has just arrived >>> to the portage tree, but I am still having problems with it. I checked the git >>> log and it's not there! Please commit. >>> >>> >> One off device hacks are concerning because it's basically impossible to review. >> >> Why does this work on bare metal? >> >> Regards, >> >> Anthony Liguori >> >> > Probably because bare metal USB 2.0 controllers don't give a damn about USB 3 > spec. :) > > My guess is that they ignore the device descriptor length and assume that it's > always equal 18. Although the USB 2.0 spec doesn't explicitly say anywhere that > it can't be more than 18. IIRC USB 3 even adds some extensions to the device > descriptor. And since I wanted my code to be portable and USB 3 ready ;) I rely > on the value in dev_descr_len. > > BTW, this patch is more than just a hack for the device in question. Without > this patch qemu simply locks up when I attach the remote and spins in endless > loop, because USB parsing is so very primitive. With this patch, USB parsing is > done more intelligently and devices with whacky USB descriptors are simply rejected. > > The hack part is really just 3 lines: > > >>> + if (dev_descr_len == 0x18&& dev->descr[ 8] == 0x47&& dev->descr[ 9] == 0x46 >>> +&& dev->descr[10] == 0x00&& dev->descr[11] == 0x30) >>> + dev_descr_len = USB_DT_DEVICE_LEN; /* for buggy MX-950 remote reporting len in hex */ >>> > And it is very harmless, as all it does is overwrites the device descriptor > length with correct one. > > If you don't like the hack, you can just remove the 3 lines above and use the > rest of the patch. I will just have to remember to manually patch mine every > time I upgrade. > > Your thoughts? > Yeah, that bit is a bit too gnarly for my tastes, but if you can resend the rest of it with a Signed-off-by, I'd appreciate. Regards, Anthony Liguori > -TJ >