Digging up and old thread.

I've been working on the configuration software which is written in Qt and I'm back now looking for the "correct" way of detecting USB hotplug events under Linux.

I'm slightly confused as to the best or indeed correct way of going about this. After much scouring and reading of the internet I settled on libhal, using the DeviceAdded and DeviceRemoved events, my application quite happily receives these and they contain the information I need to maintain a list of our connected devices.

But, I still have a nagging doubt in my mind that using libhal is a good thing, searching the web it appears to have been deprecated (or is in the process of) and I find many posts saying that using it is not a good thing, but with no mention of how what I should be using. Furthermore, when my configuration software finds one of our devices, it opens it (It's appears to the computer as a serial port (CDC/ACM)) and keeps it open until you either manually close the device from a menu or unplug it.

Unplugging the device while open seems to send HAL into chaos, if I look in device manager I see multiple entries for the TTY driver, sometimes with different dev locations (/dev/ttyUSB0 - /dev/ttyUSB1) and sometimes with the same ones, it's like something somewhere in the chain is not cleaning up after itself. Obviously my software reports phantom devices too.

Any thoughts on these anybody?

Thanks

Adrian