# USB card reader: media insertion doesn't generate dev file

## osgood

Hello,

I have the following problem with my usb card reader. I tried to find information about this but I didn't find anything relevant...

What is going on is: when I insert my usb card reader into the usb slot, everything works fine. The card reader itself is detected and there are device files /dev/sd[abc] generated for each of its slots. However, if there's no medium (a card) in any of the card reader's slots at the time of the connecting to the computer, there won't be any device files for the partitions (i.e. for the card) generated. And therefore, I cannot access the card. I have to resort to "fdisk -l /dev/sda" in order to have the device file /dev/sda1 generated. If there's a card in the slot during the connecting, the device file will be generated without problems..

This isn't really a big problem but it's still annoying. I tried to figure this out but I didn't succeed. Also my google searches were fruitless...

I had this problem with devfs as well as with the udev that I'm using now. It seems to me as if the insertion of the media didn't generate any event for the hotplug deamon.. or something like that. I suspected the reader, but Windows can detect the inserted media and pops up an Explorer window with its contents...

Does anybody have experience with this behavior?

Thank you very much!

----------

## Rider

hi,

could you please poste your udev rule for your card as well as some informations provided by /sys/...

----------

## osgood

Hello, thank you for trying to help me out. Here are some listings..

tail /etc/udev/rules.d/50-udev

BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}"

# READER start

BUS="usb", SYSFS{product}="USBHS MultiSlot Reader", NAME="reader-%k"

# READER end

BUS="scsi", KERNEL="sd*", PROGRAM="/etc/udev/scsi-devfs.sh sd %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}"

Now, "udevinfo -q all -n /dev/reader-sdb" gave me "P: /block/sdb" and then "udevinfo -a -p /block/sdb" led to

  looking at class device '/sys/block/sdb':

    SYSFS{dev}="8:16"

    SYSFS{range}="16"

    SYSFS{removable}="1"

    SYSFS{size}="503808"

    SYSFS{stat}="     212     2974     3200      862       97     9602     9699   105306        0     3061   106168"

follow the class device's "device"

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-8/1-8:1.0/host3/3:0:0:0':

    BUS="scsi"

    ID="3:0:0:0"

    SYSFS{detach_state}="0"

    SYSFS{device_blocked}="0"

    SYSFS{max_sectors}="240"

    SYSFS{model}="STORAGE DEVICE  "

    SYSFS{queue_depth}="1"

    SYSFS{rev}="0116"

    SYSFS{scsi_level}="3"

    SYSFS{state}="running"

    SYSFS{timeout}="30"

    SYSFS{type}="0"

    SYSFS{vendor}="Generic "

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-8/1-8:1.0/host3':

    BUS=""

    ID="host3"

    SYSFS{detach_state}="0"

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-8/1-8:1.0':

    BUS="usb"

    ID="1-8:1.0"

    SYSFS{bAlternateSetting}=" 0"

    SYSFS{bInterfaceClass}="08"

    SYSFS{bInterfaceNumber}="00"

    SYSFS{bInterfaceProtocol}="50"

    SYSFS{bInterfaceSubClass}="06"

    SYSFS{bNumEndpoints}="02"

    SYSFS{detach_state}="0"

    SYSFS{iInterface}="00"

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-8':

    BUS="usb"

    ID="1-8"

    SYSFS{bConfigurationValue}="1"

    SYSFS{bDeviceClass}="00"

    SYSFS{bDeviceProtocol}="00"

    SYSFS{bDeviceSubClass}="00"

    SYSFS{bMaxPower}="500mA"

    SYSFS{bNumConfigurations}="1"

    SYSFS{bNumInterfaces}=" 1"

    SYSFS{bcdDevice}="0116"

    SYSFS{bmAttributes}="80"

    SYSFS{detach_state}="0"

    SYSFS{devnum}="4"

    SYSFS{idProduct}="1202"

    SYSFS{idVendor}="07d0"

    SYSFS{maxchild}="0"

    SYSFS{product}="USBHS MultiSlot Reader"

    SYSFS{serial}="16593"

    SYSFS{speed}="480"

    SYSFS{version}=" 2.00"

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.7/usb1':

    BUS="usb"

    ID="usb1"

    SYSFS{bConfigurationValue}="1"

    SYSFS{bDeviceClass}="09"

    SYSFS{bDeviceProtocol}="01"

    SYSFS{bDeviceSubClass}="00"

    SYSFS{bMaxPower}="  0mA"

    SYSFS{bNumConfigurations}="1"

    SYSFS{bNumInterfaces}=" 1"

    SYSFS{bcdDevice}="0206"

    SYSFS{bmAttributes}="e0"

    SYSFS{detach_state}="0"

    SYSFS{devnum}="1"

    SYSFS{idProduct}="0000"

    SYSFS{idVendor}="0000"

    SYSFS{manufacturer}="Linux 2.6.8.1 ehci_hcd"

    SYSFS{maxchild}="8"

    SYSFS{product}="Intel Corp. 82801EB/ER (ICH5/ICH5R) USB2 EHCI Controller"

    SYSFS{serial}="0000:00:1d.7"

    SYSFS{speed}="480"

    SYSFS{version}=" 2.00"

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.7':

    BUS="pci"

    ID="0000:00:1d.7"

    SYSFS{class}="0x0c0320"

    SYSFS{detach_state}="0"

    SYSFS{device}="0x24dd"

    SYSFS{irq}="23"

    SYSFS{subsystem_device}="0x0157"

    SYSFS{subsystem_vendor}="0x1028"

    SYSFS{vendor}="0x8086"

  looking at the device chain at '/sys/devices/pci0000:00':

    BUS=""

    ID="pci0000:00"

    SYSFS{detach_state}="0"

This is the listing for the node /block/sdb, /dev/sdb1 is the medium inserted in the reader (a Compact Flash card).

Is this helpful?

Thank you!

----------

## HermanR

It seems I'm having the same: only /dev/sda is created when I plugin the cardreader first and then put the card in the slot; /dev/sda AND /dev/sda1 are created when I put the card in the slot and then plugin the cardreader.

My udev rule works like I want it to:

```
BUS="usb", SYSFS{serial}="2001-77", KERNEL="sd?1", NAME="%k", SYMLINK="cardreader"
```

(But I don't think my problem has anything to do with the udev rule.)

Apart from this: even when everything seems to go as it should (/dev/sda, /dev/sda1 and the symlink /dev/cardreader are created), I cannot access the card (a CF-card).  I get this error:

```
Could not mount device.

The reported error was:

mount: No medium found
```

Has my camera model (Canon Powershot A70) anything to do with that?

----------

## HermanR

I just found this comment in one of the other topics:

 *oumpah-pah wrote:*   

> I'm not sure this answers your problem, but I found this on the writing udev rules site :
> 
>  *Quote:*   Another difficult situation is having a multiple-slot USB-storage card reader. These types of device generally do not inform the host when new cards are plugged in or out, so plugging a card into an unused slot while the reader is plugged in will not create the extra device node needed for mounting!
> 
> This problem also applies to other USB disks - e.g. if you create a new partition, the new partition node will not appear until you re-plug the device.
> ...

 

I guess it's best to just remember to put the card in the slot before plugging in the cardreader... But that still doesn't solve my second problem.

----------

