99base/init: fall back to manual cdrom polling

master
Harald Hoyer 2011-03-28 17:46:03 +02:00
parent 1489c9b1af
commit 5b2cc025f4
1 changed files with 10 additions and 7 deletions

View File

@ -230,15 +230,18 @@ while :; do
# some time. # some time.
for cdrom in /sys/block/sr*; do for cdrom in /sys/block/sr*; do
[ -e "$cdrom" ] || continue [ -e "$cdrom" ] || continue
if [ -e "$cdrom"/events_poll_msecs ]; then # skip, if cdrom medium was already found
strstr "$(udevadm info --query=env --path=${cdrom##/sys})" \
ID_CDROM_MEDIA && continue

if [ -e "$cdrom"/events_poll_msecs -a -n -e "/tmp/.poll_${cdrom##*/}" ]; then
msecs=$(while read a; do echo $a;done < "$cdrom"/events_poll_msecs) msecs=$(while read a; do echo $a;done < "$cdrom"/events_poll_msecs)
[ "$msecs" = "-1" ] && \ if [ "$msecs" = "-1" ]; then
echo 1000 > "$cdrom"/events_poll_msecs echo 250 > "$cdrom"/events_poll_msecs
> "/tmp/.poll_${cdrom##*/}"
fi
else else
# skip, if cdrom medium was already found echo change > "$cdrom/uevent"
strstr "$(udevadm info --query=env --path=${cdrom##/sys})" \
ID_CDROM_MEDIA && continue
echo change > "$cdrom/uevent"
fi fi
done done