autodetect
AutoDetect
HiMD Auto Detection
Looking for a way to detect a connected HiMD walkman automatically and connect it in qhimdtransfer. This splits into two different questions, presented with their possible solutions:
- Detecting Hi-MD walkmen that are already connected to the computer on start of QHiMDTransfer
- libusb can be used to iterate over all connected devices. This is mostly platform independent, but it seems difficult to get to a path (i.e. mountpoint) from an USB device ID (bus/address or something like that)
- libusal (or libscg) to scan for the SCSI device that the Hi-MD walkman makes available via the USB mass storage transport. No idea how easy it is to get a mountpoint from libusal bus scans. Did not look at it yet
- Detecting when a new HiMD walkmen gets connected
- On Linux: Listen on system DBus for DeviceAdded/DeviceRemoved events
- On Windows: Listen for "WM_DEVICECHANGE"-Message with subcodes "DBT_DEVICEARRIVAL"/"DBT_DEVICEREMOVECOMPLETE"
- Sample code for Windows: http://www.codeproject.com/KB/winsdk/usbdisks.aspx
- On Mac: Listen for "NSWorkspaceDidMountNotification" / "NSWorkspaceDidUnmountNotification"-Notifications
- On Linux/Windows: Use autorun/autoplay-like mechanism. The program called by autorun need not to present the full GUI, it might be enough to just tell an already running QHiMDTransfer the addition of a new device.
Screenshots on how the autorun-like entry works in the gnome file manager (the first image shows the file browser in the root directory of a Hi-MD medium, the second the file manager autorun properties):
autodetect.txt · Last modified: 2011/01/26 22:10 by glaubitz