public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in sys-apps/eject/files: eject-2.1.5-toggle.patch
@ 2009-03-14 12:24 Mike Frysinger (vapier)
  0 siblings, 0 replies; only message in thread
From: Mike Frysinger (vapier) @ 2009-03-14 12:24 UTC (permalink / raw
  To: gentoo-commits

vapier      09/03/14 12:24:34

  Added:                eject-2.1.5-toggle.patch
  Log:
  Cleanup and apply fix from opensuse #261880 by Peter Tworek.
  (Portage version: 2.2_rc25/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  sys-apps/eject/files/eject-2.1.5-toggle.patch

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/eject/files/eject-2.1.5-toggle.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/eject/files/eject-2.1.5-toggle.patch?rev=1.1&content-type=text/plain

Index: eject-2.1.5-toggle.patch
===================================================================
idea take from opensuse
http://bugs.gentoo.org/261880

--- a/eject.c
+++ b/eject.c
@@ -576,6 +576,21 @@ static void ToggleTray(int fd)
 
 #ifdef CDROMCLOSETRAY
 
+	/* Ask the CDROM for info, otherwise fall back to manual */
+	switch (ioctl(fd, CDROM_DRIVE_STATUS)) {
+		case CDS_TRAY_OPEN:
+			CloseTray(fd);
+			return;
+
+		case CDS_NO_DISC:
+		case CDS_DISC_OK:
+			if (ioctl(fd, CDROMEJECT, 0) < 0) {
+				perror("ioctl");
+				exit(1);
+			}
+			return;
+	}
+
 	/* Try to open the CDROM tray and measure the time therefor
 	 * needed.  In my experience the function needs less than 0.05
 	 * seconds if the tray was already open, and at least 1.5 seconds






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-14 12:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-14 12:24 [gentoo-commits] gentoo-x86 commit in sys-apps/eject/files: eject-2.1.5-toggle.patch Mike Frysinger (vapier)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox