From 4ac4a95b41c57976cf6055c738d02f9b2fe0c2b8 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 4 Apr 2011 12:06:05 +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 3aaeaf7..46dc390 100644 --- a/src/device.c +++ b/src/device.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include @@ -6175,29 +6174,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, @@ -6221,7 +6197,7 @@ filesystem_mount_completed_cb (DBusGMethodInvocation *context, * Otherwise unlock it, to keep the hardware button working without * userspace support */ if (!device->priv->supports_eject_request_event) - unlock_cd_tray (device); + poller_lock_cdtray (device, FALSE); dbus_g_method_return (context, data->mount_point); } -- 1.7.4.1