]> git.ipfire.org Git - thirdparty/util-linux.git/commit
eject: use CDROM_DRIVE_STATUS if available for tray toggling
authorMike Frysinger <vapier@gentoo.org>
Thu, 5 Apr 2012 15:50:46 +0000 (11:50 -0400)
committerKarel Zak <kzak@redhat.com>
Tue, 10 Apr 2012 10:21:27 +0000 (12:21 +0200)
commitdf3449d541701b9e41ed5fb33e9dbf2bd601094c
tree6d09fc98d865080a27dbe42fb395e33156a54542
parent0cb8dc47e4666eccda18eb78f91475d5f6531491
eject: use CDROM_DRIVE_STATUS if available for tray toggling

One some platforms, the -T option can be unreliable (see reference bug
report for some examples).  Instead, if the kernel supports the cdrom
status ioctl, use that to ask explicitly for the current tray status
and then open/close accordingly.

The eject_cdrom() func was reworked slightly, but none of the existing
callers care about the explicit normalization to [0,1] values, so have
it return the raw value so we can convert toggle_tray() over to using
that.

Finally, now that toggle_tray() uses a lot of helper functions, drop
the check on CDROMCLOSETRAY.  The sub-functions take care of that.

Reference: https://bugs.gentoo.org/261880
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
sys-utils/eject.c