qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix media detection on emulated CDROM
@ 2008-11-18 18:19 Gary Grebus
  2008-11-18 19:18 ` Anthony Liguori
  0 siblings, 1 reply; 4+ messages in thread
From: Gary Grebus @ 2008-11-18 18:19 UTC (permalink / raw)
  To: qemu-devel

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 <ggrebus@virtualiron.com>

-- 
Gary Grebus
Virtual Iron Software, Inc.

Index: hw/ide.c
===================================================================
--- hw/ide.c	(revision 5729)
+++ hw/ide.c	(working copy)
@@ -1603,7 +1603,7 @@
                     buf[10] = 0x00;
                     buf[11] = 0x00;
 
-                    buf[12] = 0x70;
+                    buf[12] = 0x71;
                     buf[13] = 3 << 5;
                     buf[14] = (1 << 0) | (1 << 3) | (1 << 5);
                     if (bdrv_is_locked(s->bs))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix media detection on emulated CDROM
  2008-11-18 18:19 [Qemu-devel] [PATCH] Fix media detection on emulated CDROM Gary Grebus
@ 2008-11-18 19:18 ` Anthony Liguori
  2008-11-19 14:46   ` Gary Grebus
  0 siblings, 1 reply; 4+ messages in thread
From: Anthony Liguori @ 2008-11-18 19:18 UTC (permalink / raw)
  To: qemu-devel

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 <ggrebus@virtualiron.com>
>
>   

Could you please include a comment to this effect in the code?

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix media detection on emulated CDROM
  2008-11-18 19:18 ` Anthony Liguori
@ 2008-11-19 14:46   ` Gary Grebus
  2008-11-19 15:03     ` Anthony Liguori
  0 siblings, 1 reply; 4+ messages in thread
From: Gary Grebus @ 2008-11-19 14:46 UTC (permalink / raw)
  To: qemu-devel


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 <ggrebus@virtualiron.com>
> >
> >   
> 
> 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))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix media detection on emulated CDROM
  2008-11-19 14:46   ` Gary Grebus
@ 2008-11-19 15:03     ` Anthony Liguori
  0 siblings, 0 replies; 4+ messages in thread
From: Anthony Liguori @ 2008-11-19 15:03 UTC (permalink / raw)
  To: qemu-devel

Gary Grebus wrote:
> On Tue, 2008-11-18 at 13:18 -0600, Anthony Liguori wrote:
>   
> No problem... revised patch below.
>   

Applied. Thanks.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-11-19 15:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-18 18:19 [Qemu-devel] [PATCH] Fix media detection on emulated CDROM Gary Grebus
2008-11-18 19:18 ` Anthony Liguori
2008-11-19 14:46   ` Gary Grebus
2008-11-19 15:03     ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).