summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2010-02-15 17:02:30 +0100
committerMartin Pitt <martin.pitt@ubuntu.com>2010-02-15 17:02:30 +0100
commitfb86ef144bad470b3d8ed761c7bdbe94886e5edd (patch)
tree37e975c23243ef60819e3cfd998d2140f8075f23
parentaae17d97e8ca7acf6bb88d22da6753225fec7463 (diff)
Add support for "disable polling" udev property
Do not poll a device which has UDISKS_DISABLE_POLLING set. Some known-broken CD-ROM drives cause a lot of CPU activity when being polled, so allow admins to suppress polling with a local udev rule like SUBSYSTEM=="block", ENV{ID_VENDOR}=="Optiarc*", ENV{ID_MODEL}=="*AD-7640S*", \ ENV{UDISKS_DISABLE_POLLING}="1" https://bugs.freedesktop.org/show_bug.cgi?id=26508
-rw-r--r--doc/man/udisks7.xml10
-rw-r--r--src/device.c6
2 files changed, 16 insertions, 0 deletions
diff --git a/doc/man/udisks7.xml b/doc/man/udisks7.xml
index c872754..27f0c13 100644
--- a/doc/man/udisks7.xml
+++ b/doc/man/udisks7.xml
@@ -51,6 +51,16 @@
</varlistentry>
<varlistentry>
+ <term><option>UDISKS_DISABLE_POLLING</option></term>
+ <listitem><para>If set to 1 this will disable the polling of drives
+ for media changes, for devices which do not send out media
+ notifications by themselves (this mostly affects CD drives).
+ Some CD drives cause bad effects such as very high CPU usage when
+ being polled.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>DKD_PRESENTATION_NAME</option></term>
<listitem><para>The name to user for the device when
presenting it to the user.
diff --git a/src/device.c b/src/device.c
index 65e14f6..e147290 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3941,6 +3941,12 @@ update_info_media_detection (Device *device)
polling = TRUE;
inhibitable = TRUE;
+ /* custom udev rules might want to disable polling for known-broken
+ * devices (fdo #26508) */
+ if (g_udev_device_has_property (device->priv->d, "UDISKS_DISABLE_POLLING") &&
+ g_udev_device_get_property_as_boolean (device->priv->d, "UDISKS_DISABLE_POLLING"))
+ polling = FALSE;
+
if (device->priv->polling_inhibitors != NULL || daemon_local_has_polling_inhibitors (device->priv->daemon))
{