chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Dbus egg crashes in Chicken 4.9


From: Mario Domenech Goulart
Subject: Re: [Chicken-users] Dbus egg crashes in Chicken 4.9
Date: Fri, 11 Jul 2014 13:40:07 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Hi Oleg,

On Fri, 11 Jul 2014 01:12:26 +0400 Oleg Kolosov <address@hidden> wrote:

> We are using dbus for system-wide notifications in an embedded system.
> Events like "drive mounted", etc. The egg looks flexible and powerful
> but it is called only occasionally in our current system for legacy
> compatibility reasons. I guess we will rely on dbus much more in the
> next version of our product, and I hope this egg will help with this.

Interesting.  I'm working on a similar thing.  The system I'm working on
needs to automatically mount/unmount USB sticks as they are
connected/removed.  I started using udisks+dbus, but things started
getting out of hand (had some issues with dbus, then permissions
problems that lead to the policykit mess etc.).  The need for at least
three running daemons (dbus, udisks, policykit) to mount USB sticks
sounds a bit too much to me.

I ended up resorting to handling udev notifications and
hand-[un]mounting devices (it's kinda ugly, but it makes sense in the
context of the project I'm working).  In case you are interested, the
work-in-progress libudev bindings can be found here:
https://github.com/OSSystems/chicken-udev

Here's a simple example of monitoring mountable devices:

-----------------------------8<------------------------------

(use srfi-18 udev)

(define (mountable-device? dev)
  (and (equal? (udev-device-type dev) "partition")
       (equal? (udev-device-subsystem dev) "block")))

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

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

----------------------------->8------------------------------

Best wishes.
Mario
-- 
http://parenteses.org/mario



reply via email to

[Prev in Thread] Current Thread [Next in Thread]