#!/bin/dash

# helper to trigger uevent when optical disk is inserted/removed

. "$VDEV_HELPERS/subr.sh"

# main method
# return 0 on success
main() {
	
   local _EVENTS_POLL_MSECS
   
   _EVENTS_POLL_MSECS="$VDEV_OS_SYSFS_MOUNTPOINT/$VDEV_OS_DEVPATH/events_poll_msecs"
      
   if [ "$(/bin/cat $_EVENTS_POLL_MSECS)" -lt 0 ]; then
         
       /bin/echo 2000 | /usr/bin/tee "$_EVENTS_POLL_MSECS"
   fi

   return 0
}

if [ $VDEV_DAEMONLET -eq 0 ]; then 
   main 
   exit $?
fi
