Getting device added events through dbus
shankar grep
shankar.grep at gmail.com
Thu Dec 6 05:52:46 PST 2007
Hi,
I compiled hal.0.5.10 on my system...
I can call methods registered on the Dbus at org.freedesktop.Hal.Manager
--- like GetAllDevices. And get the list of all device connected to the
system at that time.
But I am not able to get the signal DeviceAdded through DBus....
Below is the code i use to listen to the signal
con=dbus_g_bus_get(DBUS_BUS_SYSTEM,NULL);
proxy=dbus_g_proxy_new_for_name(con,"org.freedesktop.Hal
","/org/freedesktop/Hal/Manager","org.freedesktop.Hal.Manager");
printf("Probably got a connectrion to the correct interface...\n");
loop=g_main_loop_new(NULL,FALSE);
m1=g_cclosure_user_marshal_VOID__STRING;
m2=g_cclosure_user_marshal_VOID__STRING;
dbus_g_object_register_marshaller(m1,G_TYPE_BOOLEAN,G_TYPE_STRING,G_TYPE_INVALID);
dbus_g_object_register_marshaller(m2,G_TYPE_BOOLEAN,G_TYPE_STRING,G_TYPE_INVALID);
dbus_g_proxy_add_signal(proxy,"DeviceAdded",G_TYPE_INVALID);
dbus_g_proxy_add_signal(proxy,"DeviceRemoved",G_TYPE_INVALID);
dbus_g_proxy_connect_signal(proxy,"DeviceAdded",(GCallback)device_added,NULL,NULL);
dbus_g_proxy_connect_signal(proxy,"DeviceRemoved",(GCallback)device_removed,NULL,NULL);
printf("Calling a remote method...\n");
err=NULL;
dbus_g_proxy_call(proxy,"GetAllDevices",&err,G_TYPE_INVALID,G_TYPE_STRV,&list,G_TYPE_INVALID);
I am not able to determine what the problem... Do i have to edit any policy
files for this?? Or my code is wrong??
{I am trying to get DeviceAdded signal whner i connect my flash stick}
Any suggestion on this is appreciated....
Thanks in advance .
shankar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/hal/attachments/20071206/4aa6e5d1/attachment.html
More information about the hal
mailing list