Received: from [140.186.70.92] (port=56135 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q88AB-0003sS-RR for qemu-devel@nongnu.org; Fri, 08 Apr 2011 05:39:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q88A8-0008Fe-Vf for qemu-devel@nongnu.org; Fri, 08 Apr 2011 05:39:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8640) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q88A8-0008FS-M2 for qemu-devel@nongnu.org; Fri, 08 Apr 2011 05:39:32 -0400 From: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH 0/5] atapi: Implement 'media' subcommand for GESN References: Date: Fri, 08 Apr 2011 11:39:26 +0200 In-Reply-To: (Amit Shah's message of "Fri, 8 Apr 2011 12:45:14 +0530") Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amit Shah Cc: Kevin Wolf , Stefan Hajnoczi , Paolo Bonzini , qemu list , Juan Quintela --=-=-= Results of quick test run now, patch review to follow. Test uses a simple program to try ioctl CDROM_DRIVE_STATUS (attached). Test run in the host: [start with tray closed & empty] $ ./drive-status CDS_NO_DISC $ eject /dev/sr0 [tray opens] $ ./drive-status CDS_TRAY_OPEN $ eject -t /dev/sr0 [tray closes] $ ./drive-status CDS_NO_DISC [open tray, insert media, close tray] $ ./drive-status CDS_DISC_OK $ eject /dev/sr0 [tray opens] $ ./drive-status CDS_TRAY_OPEN $ eject -t /dev/sr0 [tray closes] $ ./drive-status CDS_DRIVE_NOT_READY [ok, too impatient] $ ./drive-status CDS_DISC_OK Test in guest without your patches: [start with empty drive] # ./drive-status CDS_NO_DISC # eject /dev/sr0 # ./drive-status CDS_NO_DISC [incorrect, should be CDS_TRAY_OPEN] # eject -t /dev/sr0 # ./drive-status CDS_NO_DISC [insert media with monitor command change] # ./drive-status CDS_DISC_OK # eject /dev/sr0 # ./drive-status CDS_NO_DISC [incorrect, should be CDS_TRAY_OPEN] # eject -t /dev/sr0 # ./drive-status CDS_DISC_OK With the patches, it behaves as expected. Except something (guest kernel?) closes the tray right after eject if there's a medium in the open tray. Anaconda is *much* happier with the patches. Before, it could get into a confused state where it can't find install medium because the tray is stuck open. Now, it recovers from "can't find" on first retry, by closing the tray. --=-=-= Content-Disposition: inline #include #include #include #include #include #include #include char * cdsstr(int cds) { static char *ststr[5] = { "CDS_NO_INFO", "CDS_NO_DISC", "CDS_TRAY_OPEN", "CDS_DRIVE_NOT_READY", "CDS_DISC_OK", }; if ((unsigned)cds >= 5) return NULL; return ststr[cds]; } int main(void) { int fd, cds; char *s; fd = open("/dev/sr0", O_RDONLY | O_NONBLOCK); if (fd < 0) error(1, errno, "open"); cds = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT); if (cds < 0) error(1, errno, "ioctl"); s = cdsstr(cds); if (s) printf("%s\n", s); else printf("%d\n", cds); return 0; } --=-=-=--