i lost the dbus message.
GrorgeTung
george-tung at hotmail.com
Wed Sep 9 01:35:10 PDT 2009
Hi,
i use the libdbus and libhal to mount the devices. but without glib.
first i initialized the hal and connect to dbus. and registed add and remove callback function.
there is some code .
____________________________code_________________________
hal_ctx = hal_init();
if (hal_ctx == NULL)
return;
mount_all (hal_ctx);
int fd=-1;
dbus_connection_get_unix_fd(dbus_connection, &fd);
// if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) {
// perror("fcntl");
// }
fd_set rfds;
int retval;
struct timeval tv;
while (m_pTvm->bRun) {
FD_ZERO(&rfds);
FD_SET(fd, &rfds);
tv.tv_sec = 0;
tv.tv_usec = 0;
retval = select(fd+1, &rfds, NULL, NULL, &tv);
if (retval == -1) { // quit
continue;
//break;
}
do
{
printf("----------------------dbus_connection_read_write_dispatch----------------------\n");
dbus_connection_read_write_dispatch(dbus_connection, 0);
} while (dbus_connection_get_dispatch_status(dbus_connection) == DBUS_DISPATCH_DATA_REMAINS);
/*
// non blocking read of the next available message
dbus_connection_read_write(dbus_connection, -1);
while (dbus_connection_dispatch(dbus_connection) == DBUS_DISPATCH_DATA_REMAINS);
*/
dbus_connection_flush(dbus_connection);
}
____________________________code_________________________
when I insert the cd-rom, the system mounted cd-rom some times ,but not each times.
i'm look forward your advices. thanks.
George Tung.
2009-9-9
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/hal/attachments/20090909/a548c752/attachment.html
More information about the hal
mailing list