Tech Support > Microsoft Windows > Drivers > Memory card reader insertion/removal notification
Memory card reader insertion/removal notification
Posted by Eduardo Francos on July 6th, 2005


Hi,
For a program I'm writing I need to detect the insertion/removal of
media from removable media devices, and for that I'm using the
WM_DEVICE_CHANGE Windows message. The problem is that while it works
fine with CD/DVD devices and USB flash drives, it doesn't notify me when
memory cards are inserted/removed from a card reader. The card reader
behaves like a CD-ROM drive in that the letter is allocated when the
reader is connected, then as cards are inserted their contents become
available.
I've tried different ways using the RegisterDeviceNotification API
without success. I could use polling of course but it doesn't seem to me
very efficient.
I'm sure this should be possible because the Windows Explorer does
somehow detect the changes.
Does anybody know of a sure way (user/kernel mode) to receive those
notifications?

Thanks for any hint.

Eduardo

Posted by Maxim S. Shatskih on July 6th, 2005


Polling once per second or 0.5 seconds is fine.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Eduardo Francos" <efrancos@wanadoo.fr> wrote in message
news:42cba92f$0$883$8fcfb975@news.wanadoo.fr...


Posted by Eduardo Francos on July 7th, 2005


Maxim S. Shatskih wrote:
Right, it works. I could even go up to three to five seconds without
loosing functionality but I'd really prefer a notification system

Posted by Maxim S. Shatskih on July 7th, 2005


Let's look. Card insert is a media insert, not device insert (unlike USB
flash drive).
CdRom.sys driver has some ways of signalling the OS about the media insert.
Maybe the card reader's driver does this too - some WM_DEVICECHANGE code is
IIRC about the media insert.
But, if the card reader's driver has no such thing (it should call the
routine named something like IoNotifyVolumeEvent) - then polling is the only
way.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Eduardo Francos" <efrancos@wanadoo.fr> wrote in message
news:42cceeea$0$3140$8fcfb975@news.wanadoo.fr...


Posted by Eduardo Francos on July 8th, 2005


Maxim S. Shatskih wrote:
I understand. I guess that either Windows Explorer or Windows has a
hidden service that does some kind of polling then.
Looks like it will have to be a polling solution :-(

Thanks

Eduardo


Similar Posts