Search code examples
linuxmobilesd-card

SD card images on phone not showing on PC


Newly added images on SD card from phone are not showing on PC when the SD card is accessed in USB Mass Storage Mode. However if the card is removed from phone and reinserted, the images are seen on PC (SD card connected as USB Mass Storage).

Secondly when images are not seen on PC, if the same Card is accessed from a Card Reader the missing images are present on the SD card.

Does this mean it is a USB Mass Storage problem on the phone?


Solution

  • Well finally, the root cause of this issue was figured out. The problem was that linux maintains a cache when the phone is in mass storage mode (MSM). Every time the phone is connected in MSM it insmods the drivers on insertion and rmmods on removal. But linux does not drop the caches after the driver is rmmod'd. Hence the following fix solved the issue:

    sync;
    echo 3 > /proc/sys/vm/drop_caches;
    insmod driver.ko;
    

    The second command drops the caches before the driver is inserted.