((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/udev" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.")) (section 2 "udev" (toc) (section 3 "Description" (p (link "http://www.freedesktop.org/software/systemd/libudev/" "libudev") " bindings")) (section 3 "Author" (p (link "http://www.ossystems.com.br" "O.S. Systems") ", maintained by " (int-link "/users/mario-domenech-goulart" "Mario Domenech Goulart"))) (section 3 "Requirements" (p "None")) (section 3 "API" (section 4 "udev-device record accessors" (def (sig (procedure "udev-device?" (id udev-device?)) (procedure "udev-device-node" (id udev-device-node)) (procedure "udev-device-type" (id udev-device-type)) (procedure "udev-device-subsystem" (id udev-device-subsystem)) (procedure "udev-device-action" (id udev-device-action)) (procedure "udev-device-syspath" (id udev-device-syspath)) (procedure "udev-device-sysname" (id udev-device-sysname)) (procedure "udev-device-sysnum" (id udev-device-sysnum)) (procedure "udev-device-driver" (id udev-device-driver)) (procedure "udev-device-properties" (id udev-device-properties))) (p "Accessors for udev-device records."))) (section 4 "Listing devices" (def (sig (procedure "(udev-list-devices)" (id udev-list-devices))) (p "Return a list of devices identified by udev, represented by udev-device records."))) (section 4 "Monitoring" (def (sig (procedure "(udev-monitor-start dispatcher #!key (polling-interval 0.2))" (id udev-monitor-start))) (p "Start the udev monitor thread.  " (tt "dispatcher") " is a one-argument procedure that is is given an udev-device record for each udev event.") (p "This procedure creates an srfi-18 thread which polls udev in " (tt "polling-interval") " seconds.")) (def (sig (procedure "(udev-monitor-stop! monitor)" (id udev-monitor-stop!))) (p "Stop the udev monitor thread.")) (section 5 "Example:" (highlight scheme "(use udev)\n\n(define (mountable-device? dev)\n  (and (equal? (udev-device-type dev) \"partition\")\n       (equal? (udev-device-subsystem dev) \"block\")))\n\n(define (dispatcher dev)\n  (let ((node (udev-device-node dev))\n        (action (udev-device-action dev)))\n    (when (mountable-device? dev)\n      (cond ((equal? action \"add\")\n             (print \"Mounting \" node))\n            ((equal? action \"remove\")\n             (print \"Unmounting \" node))))))\n\n(thread-join! (udev-monitor-start dispatcher))"))) (section 4 "Miscellaneous" (def (sig (procedure "(udev-device-parent-with-subsystem-devtype dev subsystem devtype)" (id udev-device-parent-with-subsystem-devtype))) (p "Find the next parent device, with a matching subsystem and devtype value, and fill in information from the sys device and the udev database entry (from the " (link "http://www.freedesktop.org/software/systemd/libudev/libudev-udev-device.html#udev-device-get-parent-with-subsystem-devtype" "original documentation") ").") (p (tt "dev") " is an udev-device record.  " (tt "subsystem") " and " (tt "devtype") " are strings.  Returns a udev-device record.")) (def (sig (procedure "(make-udev-device node subsystem type action syspath sysname sysnum driver properties)" (id make-udev-device))) (p "Create a udev-device record.  This procedure is usually only useful for mocking udev devices.")))) (section 3 "License" (pre " Copyright (c) 2014, O.S. Systems Software LTDA\n All rights reserved.\n \n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions\n are met:\n 1. Redistributions of source code must retain the above copyright\n    notice, this list of conditions and the following disclaimer.\n 2. Redistributions in binary form must reproduce the above copyright\n    notice, this list of conditions and the following disclaimer in the\n    documentation and/or other materials provided with the distribution.\n 3. The name of the authors may not be used to endorse or promote products\n    derived from this software without specific prior written permission.\n \n THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS\n OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY\n DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\n GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER\n IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\n IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.")) (section 3 "Version history" (section 4 "Version 0.0.1" (ul (li "Initial release"))))))