This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

am3715 usb card reader issue

Other Parts Discussed in Thread: AM3715

Hi All,

I got a sd to usb card reader with AM3715 ( BSP 05.05.01.00) problem.

when i insert usb card reader to am3715 target board, then insert SD card to card reader.

It will mount SD card to  /media/sda1 (only at first time), but when i remove SD card (not usb card reaer), I will not get any card removed information from kernel message.

And, you will find the driver node /dev/sda1 still exist, sda1 still in mount status.

But, the same action on linux PC , you will got correct mount / umount status on PC when only remove SD card from usb card reader.

Is it possible to make the am3715 act as Linux PC behavior ?

PS: by netlink message, i will got ACTION=add at first time when i insert SD card. After that, i will got only ACTION=change message(even if insert SD card or remove SD card). 

Please kindly to help . (Maybe this is a driver issue ???)

  • A quick workaround I can think of is that creating a udev rule to handle this 'ACTION=change' event by calling a shell script, and in the shell script monitoring /dev/sdX node to mount or unmount it.

  • Because insert / remove sd card from card reader will only have ACTION=change infomation, there is no more usefull message to know the SD card status.

    So , I modify the linux kernel :  
    fs/partitions/check.c  

    int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
    {
    ...(skip)

    if (bdev->bd_part_count){

        loff_t disk_size;
        // get disk capacity. if sd card is removed from card reader, the size should be 0.
        disk_size = (loff_t)get_capacity(disk)<< 9;
        if(disk_size > 0){
            return -EBUSY;
        }
    }
    res = invalidate_partition(disk, 0);


    I don't think this is a good method to resolve the issue. But , at least the sd card insert / remove can have correct uevent.