#

這個程式在Linux下使用D-Bus來監視USB裝置放入及取出的狀態。如果你想要寫檔案總管之類的程式,就非常有機會使用到類似的功能,因為它可以讓你知道USB碟連接的狀態,程式碼如下:



執行上面的程式時,不管是放入或是移除USB裝置handler程序都會被呼叫,以下是我拔除再重新接上USB滑鼠所輸出的訊息:



參考資料

D-Bus的觀念請參考 : D-Bus Tutorial
dbus-tcl套件的下載位置 : http://sourceforge.net/projects/dbus-tcl/
dbus-tcl的手冊 : http://dbus-tcl.sourceforge.net/dbus-tcl.html

0 個意見

留下您的意見

Theme Design by devolux.org. Converted by Wordpress To Blogger for WP Blogger Themes. Sponsored by iBlogtoBlog
This template is brought to you by : allblogtools.com | Blogger Templates