From d3f56b3f93b0182c3414d0e1b26bdec6096a4557 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 15 Jun 2011 10:17:01 +0200 Subject: [PATCH 4/4] Move CD tray unlocking to poller Now that we have the CD tray locking in the poller process, remove unlock_cd_tray() from device.c and use it for unlocking after mounting (on older kernels) as well. --- src/device.c | 26 +------------------------- 1 files changed, 1 insertions(+), 25 deletions(-) diff --git a/src/device.c b/src/device.c index 4b41d67..45b14fd 100644 --- a/src/device.c +++ b/src/device.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include @@ -6184,29 +6183,6 @@ prepend_default_mount_options (Device *device, } static void -unlock_cd_tray (Device *device) -{ - /* Unlock CD tray to keep the hardware eject button working */ - if (g_udev_device_has_property (device->priv->d, "ID_CDROM")) - { - gint fd; - - g_print ("**** Unlocking CD-ROM door for %s\n", device->priv->device_file); - fd = open (device->priv->device_file, O_RDONLY); - if (fd > 0) - { - if (ioctl (fd, CDROM_LOCKDOOR, 0) != 0) - g_warning ("Could not unlock CD-ROM door: %s", strerror (errno)); - close (fd); - } - else - { - g_warning ("Could not open CD-ROM device: %s", strerror (errno)); - } - } -} - -static void filesystem_mount_completed_cb (DBusGMethodInvocation *context, Device *device, gboolean job_was_cancelled, @@ -6230,7 +6206,7 @@ filesystem_mount_completed_cb (DBusGMethodInvocation *context, * eject on pressing the button. Otherwise unlock it, to keep the * hardware button working without userspace support */ if (!(device->priv->supports_eject_request_event && device->priv->using_in_kernel_polling)) - unlock_cd_tray (device); + poller_lock_cdtray (device, FALSE); dbus_g_method_return (context, data->mount_point); } -- 1.7.5.4