From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MW7wO-0002GA-Qn for qemu-devel@nongnu.org; Wed, 29 Jul 2009 08:07:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MW7wJ-0002DB-GM for qemu-devel@nongnu.org; Wed, 29 Jul 2009 08:07:27 -0400 Received: from [199.232.76.173] (port=47370 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MW7wJ-0002D3-6L for qemu-devel@nongnu.org; Wed, 29 Jul 2009 08:07:23 -0400 Received: from mx2.redhat.com ([66.187.237.31]:51347) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MW7wI-0001Bs-Jf for qemu-devel@nongnu.org; Wed, 29 Jul 2009 08:07:22 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6TC7LGi011689 for ; Wed, 29 Jul 2009 08:07:21 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6TC7KfJ019459 for ; Wed, 29 Jul 2009 08:07:21 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6TC7JUj013142 for ; Wed, 29 Jul 2009 08:07:20 -0400 Date: Wed, 29 Jul 2009 15:07:19 +0300 From: Gleb Natapov Message-ID: <20090729120719.GN30449@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] make windows notice media change List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Windows seems to be very stupid about cdrom media change. It polls cdrom status and if status goes ready->media not present->ready it assumes that media was changed. If "media not present" step doesn't happen even if "medium may have changed" was seen it assumes media haven't changed. Fake "media not present" step. Signed-off-by: Gleb Natapov diff --git a/hw/ide.c b/hw/ide.c index 1e56786..5ae4a2b 100644 --- a/hw/ide.c +++ b/hw/ide.c @@ -1644,9 +1644,10 @@ static void ide_atapi_cmd(IDEState *s) } switch(s->io_buffer[0]) { case GPCMD_TEST_UNIT_READY: - if (bdrv_is_inserted(s->bs)) { + if (bdrv_is_inserted(s->bs) && !s->media_changed) { ide_atapi_cmd_ok(s); } else { + s->media_changed = 0; ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); } @@ -2106,7 +2107,7 @@ static void cdrom_change_cb(void *opaque) s->sense_key = SENSE_UNIT_ATTENTION; s->asc = ASC_MEDIUM_MAY_HAVE_CHANGED; - + s->media_changed = 1; ide_set_irq(s); } -- Gleb.