[python-win32] USB Insertion Extrinsic Event exists?

Chris Jesse chris.jesse at flightdataservices.com
Thu Feb 11 19:18:00 CET 2010


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 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20100211/7c2e282e/attachment.htm>


More information about the python-win32 mailing list