I have a USB SD card reader on an i.MX6, running Android. I am trying to get the kernel to detect when a card is inserted. Right now, it properly detects the card only if it is plugged in before the USB reader is plugged into the system.
I have tested the behavior on multiple PCs, and the USB SD card reader behaves as expected.
In Android, mounting is controlled by vold. vold appears to be working correctly, so I enabled extra logs so I see all netlink/uevents that are produced.
When I plug in the reader, /sys/class/block/sda shows up regardless of if a device is in it—that is expected. Then, when I insert a card, I get no uevent. I echoed 2000 into /sys/module/block/parameters/events_dfl_poll_msecs, and now when I insert a card (and wait about 2 seconds), I get an event:
There are no further events after that.
All of that looks fine, except… NPARTS=0!?!?! The card has one partition, and if I unplug the reader, insert the card into the reader, and plug the reader in, I get
I expect additional events, like a block->disk event and a block->partition event after block->DISK_MEDIA_CHANGE.
Is this something I need to configure? If not, if this is something that is simply not supported, I believe I need to set it up so that on DISK_MEDIA_CHANGE, the kernel also rescans for partitions. Any thoughts on where to do it? I see code like that in block/sd.c, fs/block_dev.c, and fs/genhd.c. (A USB SD card reader touches lots of parts of the kernel!)