Everybody is good:
I use DM8168, version is DVRRDK_03 00.00.00.
I encountered problem is the SD card to hot plug. The first time can be automatically mounted on/media/card.
When I plug in SD card, the message is:
Root @ dm816x: / etc/udev/rules d# mmc0: the new high speed SDHC card at address 9314
Mmcblk0: mmc0:9314 SE04G 3.66 GiB
Mmcblk0: p1
FAT: a bogus number of reserved sectors
The VFS: Can 't find a valid FAT filesystem on dev mmcblk0.
EXT3 - fs (mmcblk0) : error: can 't find the EXT3 filesystem on dev mmcblk0.
The EXT2 - fs (mmcblk0) : error: can 't find the an EXT2 filesystem on dev mmcblk0.
FAT: a bogus number of reserved sectors
The VFS: Can 't find a valid FAT filesystem on dev mmcblk0.
ISOFS: Unable to identify a cd-rom format.
root@dm816x:/etc/udev/rules.d# root@dm816x:/etc/udev/rules.d# df -h
Filesystem Size Used Available Use% Mounted on
ubi0:rootfs 173.9M 46.1M 127.8M 27% /
devtmpfs 1.0M 52.0K 972.0K 5% /dev
df: /mnt/.splash: No such file or directory
none 1.0M 52.0K 972.0K 5% /dev
tmpfs 16.0M 24.0K 16.0M 0% /var/volatile
tmpfs 50.7M 0 50.7M 0% /dev/shm
tmpfs 16.0M 0 16.0M 0% /media/ram
/dev/mmcblk0p1 3.7G 780.8M 2.9G 21% /media/card
When I unplug the SD card is mounted state, and/dev/mmcblk0p1 still exists, even if I manually umount - l/media/card.
I think the problem here, device name has not been deleted.Kernel or hotplug can detect the SD card into the state, but the state is not detected pulled out.
To this end, I used a small program listens to kernel hotplug events.
hotplug.c:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/un.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <linux/types.h>
#include <linux/netlink.h>
#include <errno.h>
static int init_hotplug_sock(void)
{
struct sockaddr_nl snl;
const int buffersize = 16 * 1024 * 1024;
int retval;
memset(&snl, 0x00, sizeof(struct sockaddr_nl));
snl.nl_family = AF_NETLINK;
snl.nl_pid = getpid();
snl.nl_groups = 1;
int hotplug_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
if (hotplug_sock == -1) {
printf("error getting socket: %s", strerror(errno));
return -1;
}
/* set receive buffersize */
setsockopt(hotplug_sock, SOL_SOCKET, SO_RCVBUFFORCE, &buffersize, sizeof(buffersize));
retval = bind(hotplug_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl));
if (retval < 0) {
printf("bind failed: %s", strerror(errno));
close(hotplug_sock);
hotplug_sock = -1;
return -1;
}
return hotplug_sock;
}
#define UEVENT_BUFFER_SIZE 2048
int main(int argc, char* argv[])
{
int hotplug_sock = init_hotplug_sock();
while(1)
{
char buf[UEVENT_BUFFER_SIZE*2] = {0};
recv(hotplug_sock, &buf, sizeof(buf), 0);
printf("%s\n", buf);
}
return 0;
}
arm-none-linux-gnueabi-gcc -o hotplug hotplug.c
and use it.Information is:
root@dm816x:/mnt/yunshen/sd# ./hotplug
mmc0: new high speed SDHC card at address 9314
add@/devices/platform/mmci-omap-mmcblk0: mmc0:9314 SE04G 3.66 GiB
hs.0/mmc_host/mmc0/mmc0:9314
add@/devices/virtual/bdi/179:0
mmcblk0: p1
add@/devices/platform/mmci-omap-hs.0/mmc_host/mmc0/mmc0:9314/block/mmcblk0
add@/devices/platform/mmci-omap-hs.0/mmc_host/mmc0/mmc0:9314/block/mmcblk0/mmcbl
k0p1
FAT: bogus number of reserved sectors
VFS: Can't find a valid FAT filesystem on dev mmcblk0.
EXT3-fs (mmcblk0): error: can't find ext3 filesystem on dev mmcblk0.
EXT2-fs (mmcblk0): error: can't find an ext2 filesystem on dev mmcblk0.
FAT: bogus number of reserved sectors
VFS: Can't find a valid FAT filesystem on dev mmcblk0.
ISOFS: Unable to identify CD-ROM format.
Can detect the "add" state, can not detect the "remove" state.How can I do to make it hot-swappable?
thanks