Contents of /trunk/eject/patches/eject-2.1.5-toggle.patch
Parent Directory | Revision Log
Revision 903 -
(show annotations)
(download)
Fri Oct 16 16:19:38 2009 UTC (14 years, 11 months ago) by niro
File size: 660 byte(s)
Fri Oct 16 16:19:38 2009 UTC (14 years, 11 months ago) by niro
File size: 660 byte(s)
-added several fixed
1 | idea take from opensuse |
2 | http://bugs.gentoo.org/261880 |
3 | |
4 | --- a/eject.c |
5 | +++ b/eject.c |
6 | @@ -576,6 +576,21 @@ static void ToggleTray(int fd) |
7 | |
8 | #ifdef CDROMCLOSETRAY |
9 | |
10 | + /* Ask the CDROM for info, otherwise fall back to manual */ |
11 | + switch (ioctl(fd, CDROM_DRIVE_STATUS)) { |
12 | + case CDS_TRAY_OPEN: |
13 | + CloseTray(fd); |
14 | + return; |
15 | + |
16 | + case CDS_NO_DISC: |
17 | + case CDS_DISC_OK: |
18 | + if (ioctl(fd, CDROMEJECT, 0) < 0) { |
19 | + perror("ioctl"); |
20 | + exit(1); |
21 | + } |
22 | + return; |
23 | + } |
24 | + |
25 | /* Try to open the CDROM tray and measure the time therefor |
26 | * needed. In my experience the function needs less than 0.05 |
27 | * seconds if the tray was already open, and at least 1.5 seconds |