(Java) How to get Hal DeviceAdded signal?

Matthew Johnson dbus at matthew.ath.cx
Wed Apr 23 15:24:37 PDT 2008

On Wed Apr 23 21:16, Berend Dekens wrote:
> Hello,
>  I'm trying to figure out how to get notifications about new devices (I
>  want to auto-mount block devices and scan them for media files to be
>  exact). I am struggling with the DBus API and the HAL API. The docs
>  make it seem so easy and the first part (listing UDI's) went smoothly.
>  However, now I try to get the signals when a device is added but
>  whatever I try, nothing happens when I insert my USB drive (even
>  though KDE shows a popup, so at least dbus itself is working fine).

Hi, sorry for not replying earlier, I've now diagnosed the problem:

>     /**
>      * DBus Signal DeviceAdded(Objref obj) is send by
>  org.freedesktop.Hal.Manager
>      * A device was added to the global device list (GDL).
>      * Based on the HAL 0.5.10 specs.
>      * @author cyberwizzard
>      */
>     public class DeviceAdded extends DBusSignal {
>         public final String obj;
>         public DeviceAdded(String obj) throws DBusException {
>             super(obj);
>             this.obj = obj;
>         }
>     }

The first parameter to the DeviceAdded constructor _must_ be the path
from which the signal was sent.

It should be:

public DeviceAdded(String path, String obj) throws DBusException {
   super(path, obj);
   this.obj = obj;


D-Bus Java
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/dbus/attachments/20080423/5099dbaa/attachment.pgp 

More information about the dbus mailing list