<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=gb2312>
<META content="MSHTML 6.00.2900.5848" name=GENERATOR></HEAD>
<BODY id=MailContainerBody
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px" leftMargin=0
topMargin=0 CanvasTabStop="true" name="Compose message area">
<DIV><FONT face=宋体 size=2>Hi,</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2>i use the libdbus and libhal to mount the devices. but
without glib.</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2>first i initialized the hal and connect to dbus. and
registed add and remove callback function. </FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2>there is some code .</FONT></DIV>
<DIV><FONT face=宋体
size=2>____________________________code_________________________</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2> hal_ctx = hal_init();<BR> if (hal_ctx ==
NULL)<BR> return;</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2> mount_all (hal_ctx);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体 size=2> int
fd=-1;<BR> dbus_connection_get_unix_fd(dbus_connection,
&fd);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体 size=2>// if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) {
<BR>// perror("fcntl");<BR>// }</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体 size=2> fd_set rfds;<BR> int
retval;<BR> struct timeval tv;<BR> while (m_pTvm->bRun)
{</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=宋体
size=2> FD_ZERO(&rfds);<BR> FD_SET(fd,
&rfds);<BR> tv.tv_sec = 0;<BR> tv.tv_usec =
0;<BR> retval = select(fd+1, &rfds, NULL, NULL,
&tv);<BR> if (retval == -1) { //
quit<BR> continue;<BR> //break;<BR> }<BR> do
<BR> {<BR> printf("----------------------dbus_connection_read_write_dispatch----------------------\n");<BR> dbus_connection_read_write_dispatch(dbus_connection,
0);<BR> } while (dbus_connection_get_dispatch_status(dbus_connection)
== DBUS_DISPATCH_DATA_REMAINS);<BR> /*<BR> // non blocking
read of the next available
message<BR> dbus_connection_read_write(dbus_connection,
-1);<BR> while (dbus_connection_dispatch(dbus_connection) ==
DBUS_DISPATCH_DATA_REMAINS);<BR> */<BR> dbus_connection_flush(dbus_connection);<BR> }</FONT></DIV>
<DIV>
<DIV><FONT face=宋体
size=2>____________________________code_________________________</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2>when I insert the cd-rom, the system mounted cd-rom
some times ,but not each times. </FONT></DIV>
<DIV><FONT face=宋体 size=2>i'm look forward your advices. thanks.</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2>George Tung.</FONT></DIV>
<DIV><FONT face=宋体 size=2>2009-9-9</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV></DIV></BODY></HTML>