QDeviceWatcher-Make hotplug detection easy
It's my project: https://github.com/wang-bin/qdevicewatcher
Just need QtCore module.
It works fine on linux and windows. I have tested on my ubuntu and win7. Usually you just need the signals @deviceAdded(const QString& device)@ and @deviceRemoved(const QString& device)@ in QDeviceWatcher.
To detect the device changes, i use netlink in linux(kernel 2.6) and internel window in windows.
In windows, I tried two method,
@virtual bool QCoreApplication::winEventFilter(MSG* msg, long* result)
virtual bool QWidget::winEvent(MSG* msg, long* result)@
I hope my class is just a subclass of QObject, and do not use GUI module, so I started to find other ways. At last I refer to qdrive project: https://gitorious.org/qdrive/qdrive
In qdrive project, it watch /etc/mtab in linux, but some systems will not mount new disk, so I use netlink.
This class is only for watching hotplug events now. You can deal with the device yourself, e.g. mount and umount the device.
EDIT: moved to showcase, Gerolf
Your second link is broken. It should not include the dot at the end.
[quote author="koahnig" date="1315736864"]Your second link is broken. It should not include the dot at the end. [/quote]
I see. What a stupid mistake.