Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L2oKW-0000Uj-PW for qemu-devel@nongnu.org; Wed, 19 Nov 2008 09:46:56 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L2oKV-0000Tx-75 for qemu-devel@nongnu.org; Wed, 19 Nov 2008 09:46:56 -0500 Received: from [199.232.76.173] (port=50383 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L2oKV-0000Ts-2W for qemu-devel@nongnu.org; Wed, 19 Nov 2008 09:46:55 -0500 Received: from host-216-57-134-3.customer.veroxity.net ([216.57.134.3]:26515 helo=mail.virtualiron.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L2oKU-0006ud-NS for qemu-devel@nongnu.org; Wed, 19 Nov 2008 09:46:54 -0500 Subject: Re: [Qemu-devel] [PATCH] Fix media detection on emulated CDROM From: Gary Grebus In-Reply-To: <492314F1.20900@codemonkey.ws> References: <1227032396.17638.60.camel@ggrebus.katana-technology.com> <492314F1.20900@codemonkey.ws> Content-Type: text/plain Date: Wed, 19 Nov 2008 09:46:53 -0500 Message-Id: <1227106014.17638.101.camel@ggrebus.katana-technology.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit 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 On Tue, 2008-11-18 at 13:18 -0600, Anthony Liguori wrote: > Gary Grebus wrote: > > This patch tweaks the ATAPI CDROM emulation to fix an annoyance seen > > when running a variety of Linux guests: the desktop GUI shows a CDROM > > device as present, but is unable to automount the media and display its > > contents. > > > > The patch adds the PLAY_AUDIO capability bit to the data returned by > > MODE_SENSE commands. That convinces the guest kernel to determine what > > kind of media is present. > > > > Arguably Linux could be smarter about this, but it's my guess there are > > few (if any) hardware CDROM drives that don't set the bit, and there are > > a large number of Linux distros that exhibit this problem. > > > > Signed-off-by: Gary Grebus > > > > > > Could you please include a comment to this effect in the code? > > Regards, > > Anthony Liguori No problem... revised patch below. -- Gary Grebus Virtual Iron Software, Inc. Index: hw/ide.c =================================================================== --- hw/ide.c (revision 5729) +++ hw/ide.c (working copy) @@ -1603,7 +1603,9 @@ buf[10] = 0x00; buf[11] = 0x00; - buf[12] = 0x70; + /* Claim PLAY_AUDIO capability (0x01) since some Linux + code checks for this to automount media. */ + buf[12] = 0x71; buf[13] = 3 << 5; buf[14] = (1 << 0) | (1 << 3) | (1 << 5); if (bdrv_is_locked(s->bs))