[0.7.5] media not detected; eject button disabled #66

IgnorantGuru opened this Issue Apr 17, 2012 · 0 comments


None yet

1 participant


Running spacefm 0.7.5 without udisks installed and without the udisks daemon running, I noticed that when my dvd tray closed the media was not detected, and also that the eject button on the drive no longer opened the tray.

Although spacefm 0.7.5 doesn't interact directly with the udisks daemon, that daemon may affect udev's database and other system behavior, which in turn will cause noticeable changes in spacefm. Also, if you have udisks installed, spacefm 0.7.5 will use it to mount and unmount devices, which can cause the udisks daemon to start. Once running, the daemon does userspace polling of drives like /dev/sr0, which can help with media detection system-wide.

Looking into this, I found that since kernel 2.6.38 and udev version 173, the kernel can poll ejectable devices directly without the need for userspace polling, and udev can pass along these events.

However, kernel polling is not yet enabled in most distro's udev setups. You can test this like this:

cat /sys/module/block/parameters/events_dfl_poll_msecs
cat /sys/block/sr0/events_poll_msecs

If you get 0 or -1 from those commands, then it's disabled.

The solution is to simply enable the kernel polling. You can do so for the current session by enabling common polling for the block module:

sudo bash -c 'echo 2000 > /sys/module/block/parameters/events_dfl_poll_msecs'

Any number between 2000 and 5000 (milliseconds) should be reasonable - the higher 5000 means poll every 5 seconds, which is less overhead but a little slower.

OR you can enable polling just for a single device:

sudo bash -c 'echo 2000 > /sys/block/sr0/events_poll_msecs'

The change should be immediate - media will be detected and the eject button on the drive should work normally again. However, the above changes will be lost when you reboot.

To make the change permanent, I suggest adding one of the above commands to your /etc/rc.local file (anywhere before the 'exit' line in that file), like this (without the sudo):

echo 2000 > /sys/module/block/parameters/events_dfl_poll_msecs

OR you can pass this option to the kernel boot command line in grub:



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment