How to know the existence of pendrive or memory card in embedded Linux?
by Nishanth1829 from LinuxQuestions.org on (#5BNFW)
Hi all,
I am using an Embedded SOM and application is running on GTK+. In my app, I need to show pendrive and memory card icons based on their existence. That is if sd card is inserted, the logo should be shown in my app and vice versa if removed in between.I have did this by using statfs() for every 5 seconds in C as I found that the pendrive is always mounted as /media/sda1 and memory card is always mounted as /media/mmcblk1p1. But this logic does not work perfectly some times and shows the icons wrongly. Is my way correct ? If not kindly guide me how to detect pendrive and memory card existence programmatically in polling method.
Thanks and regards,
Nishanth Kumar


I am using an Embedded SOM and application is running on GTK+. In my app, I need to show pendrive and memory card icons based on their existence. That is if sd card is inserted, the logo should be shown in my app and vice versa if removed in between.I have did this by using statfs() for every 5 seconds in C as I found that the pendrive is always mounted as /media/sda1 and memory card is always mounted as /media/mmcblk1p1. But this logic does not work perfectly some times and shows the icons wrongly. Is my way correct ? If not kindly guide me how to detect pendrive and memory card existence programmatically in polling method.
Thanks and regards,
Nishanth Kumar