The pywin32 demo in win32/Demos/win32gui_devicenotify.py should get you on the right track.

HTH,

Mark

On 12/02/2010 5:18 AM, Chris Jesse wrote:
Hi All,

I currently have a little program which looks for new USB removable
media to be inserted into a PC. It does so by polling (every 5 seconds)
all the drives within Win32_DiskDrive() and queries to find the ones
which PNPDeviceID has 'USBSTOR' within them and establishes that they
are removable media (I'm not interested in USB HDDs) and whether they
have a partition or not.

This approach was used too on Linux for querying HAL - however DeviceKit
has replaced HAL, and along with it brought the concept of listening to
signals. Looking back at the python WMI docs, I've read about "Extrinsic
Events" and the "watch_for" method. However, I'm having trouble working
out whether there are any events for USB media insertion that I can wait
for?

I would like to move away from polling as it introduces delays when the
user is expecting an immediate response. Can anyone guide me with how to
write a little listener; if this is possible?

Thanks in advance, Chris



_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to