udev example added by mario-goulart on Wed Jul 9 19:20:52 2014

(use udev)

(define (dispatcher dev)
  (let* ((node (udev-device-node dev))
         (type (udev-device-type dev))
         (action (udev-device-action dev))
         (subsystem (udev-device-subsystem dev))
         (mountable? (and (equal? type "partition")
                          (equal? subsystem "block"))))
    (when mountable?
      (cond ((equal? action "add")
             (print "Mounting " node))
            ((equal? action "remove")
             (print "Unmounting " node))))))

(thread-join! (udev-monitor-start dispatcher))