当连接特定的 USB 设备时,linux 可以向我的 Qt 程序发送信号吗? [英] Can linux signal my Qt program when a particular USB device is connected?
问题描述
我希望 linux 在连接特定 USB 设备时通过信号通知我的 Qt 程序.闪存盘或硬盘等存储设备.我怎样才能做到这一点?您有什么建议?
I want linux to inform my Qt program by a signal when a particular USB device is connected. Storage devices like flash disk or hard drive. How can I do this? What are your suggestions?
更新:
我发现 QtDbus 可以提供我需要的功能,但我还没有弄清楚具体如何.有没有人可以提供有关使用 QtDbus 获取 USB 设备通知的信息?
I have found that QtDbus can provide the functionality that I need but I have not figure out how exactly. Is there anyone can give information about getting USB device notification with QtDbus?
我一直在阅读本教程:
http://dbus.freedesktop.org/doc/dbus-tutorial.html
本教程说:
D-Bus 专为两种特定情况而设计:
This tutorial says:
D-Bus is designed for two specific cases:
- 同一桌面上的桌面应用程序之间的通信会议;允许将桌面会话整合为一个整体,以及解决进程生命周期的问题(桌面组件何时启动并停止运行)
- 桌面会话与操作系统之间的通信,操作系统通常包括内核和任何系统守护进程或进程.
我打算在非图形 Linux 系统中使用这个工具,我正在寻求帮助.在 Beagleboard-XM 上更准确地使用带有 QWS 的 Angstrom Linux 控制台映像.
I am planning to use this facility which I am asking for help in a non-graphical Linux system. More precisely on Beagleboard-XM with Angstrom Linux console image with QWS.
在这种情况下,QtDbus 是一个正确的选择吗?
In this circumstances does QtDbus is a correct choice?
推荐答案
Qt 的 DBUS 实现没试过,但是关于如何获取 USB 通知的一般细节在 本教程
Haven't tried Qt's DBUS implementation, but the general details of how to get a USB notification are in this tutorial
QtDBus 函数名称可能很容易映射到这些上
The QtDBus function names probably map onto these fairly easily
这篇关于当连接特定的 USB 设备时,linux 可以向我的 Qt 程序发送信号吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!