Tim Roberts wrote:
> Simon Dahlbacka wrote:
>> Random thought.. there *has* to be a better way of finding out when a
>> usb device is plugged in...
>>
>> (not that I know how, but I haven't needed to find out either..)
> 
> Oh, there is.  You can watch for the WM_DEVICECHANGE message, which
> fires every time there is a plug-and-play event.  Once you get that
> message, you can go enumerate the devices in your device class using the
> SetupDi APIs to see if you are present.
> 
> Now, how does all that map to Python?  With difficulty, I imagine.

It's actually made a bit easier by using
the Win32_DeviceChange event under WMI
(you will not be surprised to hear me say!)

But once you've got the fact that the device has
changed, I'm not sure where you go from there...

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

Reply via email to