From 1db1a709a857079049fd222ac56aa9c2dca09327 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 5 Apr 2011 23:49:47 +0200 Subject: [PATCH 6/6] Limit in-kernel polling to CD devices The kernel polling currently doesn't poll mounted media, thus we won't get a remove event for e. g. ejected SD cards from readers when they are mounted. Limit the usage of in-kernel polling to CDs for now, as we treat them specially by locking the tray. --- src/poller.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/src/poller.c b/src/poller.c index 8c7a7d8..e79eed8 100644 --- a/src/poller.c +++ b/src/poller.c @@ -353,6 +353,12 @@ check_in_kernel_polling (Device* d) if (d->priv->supports_media_change_event) return TRUE; + /* for now we have to limit this to CDs as we treat them specially by locking + * their door; the kernel polling currently doesn't poll mounted media, thus + * we won't get a remove event for e. g. ejected SD cards from readers. */ + if (!g_udev_device_has_property (d->priv->d, "ID_CDROM")) + return FALSE; + supported_events = g_udev_device_get_sysfs_attr (d->priv->d, "events"); #ifdef POLL_SHOW_DEBUG -- 1.7.4.1