1 diff -pur eject-orig/eject.c eject/eject.c
2 --- eject-orig/eject.c 2006-02-11 04:54:38.000000000 +0300
3 +++ eject/eject.c 2011-08-11 13:12:16.568112725 +0400
4 @@ -527,6 +527,25 @@ static void CloseTray(int fd)
8 + * Unlock tray using CDROM_LOCKDOOR ioctl.
9 + * New kernels doesn't automatically unlock tray before ejecting,
10 + * and the new udev automatically locks it.
12 +static int UnlockCdrom(int fd)
17 + printf(_("%s: unlocking tray using CDROM_LOCKDOOR ioctl\n"), programName);
19 + status = ioctl(fd, CDROM_LOCKDOOR, 0);
20 + if (v_option && status != 0)
21 + printf(_("%s: CDROM_LOCKDOOR ioctl failed\n"), programName);
23 + return (status == 0);
29 * Written by Benjamin Schwenk <benjaminschwenk@yahoo.de> and
30 @@ -543,6 +562,8 @@ static void ToggleTray(int fd)
36 /* Try to open the CDROM tray and measure the time therefor
37 * needed. In my experience the function needs less than 0.05
38 * seconds if the tray was already open, and at least 1.5 seconds
39 @@ -566,7 +587,11 @@ static void ToggleTray(int fd)
40 * was already open. In this case, close it now. Else the tray was
41 * closed before. This would mean that we are done. */
42 if (time_elapsed < TRAY_WAS_ALREADY_OPEN_USECS)
45 + printf(_("%s: CD-ROM tray was already open, closing it\n"), programName);
50 fprintf(stderr, _("%s: CD-ROM tray toggle command not supported by this kernel\n"), programName);
51 @@ -681,7 +706,7 @@ static void ListSpeedCdrom(const char *f
52 static int EjectCdrom(int fd)
57 #if defined(CDROMEJECT)
58 status = ioctl(fd, CDROMEJECT);
59 #elif defined(CDIOCEJECT)