Re: USB Card Reader.
On Thursday 30 March 2006 08:01, Wulfy wrote:
> Justin Guerin wrote:
> >Wulfy wrote:
> >>Justin Guerin wrote:
[snip]
> >>
> >>mount: /dev/card_sm1 is not a valid block device
> >>
> >>when I try to mount it.
> >>
> >>Any ideas where I've gone wrong? If you need any more info, just ask.
> >
> >What does an "ls -l /dev/card_sm1" show?
>
> brw-rw---- 1 root floppy 8, 33 Mar 28 21:43 /dev/card_sm1
> ^^^^
> Seems that udev thinks it's a floppy drive...? Would that mean that the
> fstab entry below should have "msdos" (or whatever the format type is
> for floppy drives) rather than "vfat"?
No. Udev put the device node in the floppy group, but udev correctly sees
this as a SCSI disk device. See the file Documentation/devices.txt of the
kernel source package for how Linux uses the major and minor device numbers
for device nodes. According to that document:
8 block SCSI disk devices (0-15)
0 = /dev/sda First SCSI disk whole disk
16 = /dev/sdb Second SCSI disk whole disk
32 = /dev/sdc Third SCSI disk whole disk
...
240 = /dev/sdp Sixteenth SCSI disk whole disk
Partitions are handled in the same way as for IDE
disks (see major number 3) except that the limit on
partitions is 15.
So basically, you're looking at /dev/sdc1 (major = 8, minor = 33), the first
partition on the third device. That should be correct, unless the
partition table of your USB card is non-standard.
Floppy disks can be formatted as msdos, vfat, or even ext2/3. It just so
happens that USB drives (and floppy disks) are formatted at the factory to
vfat.
In any case, the partition contains information about how the device is
formatted, so if you use the wrong type, you'll get an error that says
something like "wrong fs type", not "invalid block device".
Considering the block device exists, the only reason I would think this
comes up is if udev created the device node incorrectly, or if you can't
read it. I notice the permissions are 0660, group floppy. Are you in the
floppy group? According to
http://www.debian-administration.org/articles/308, the floppy group is used
locally to give a set of users access to all sorts of (hot) removable
devices, which includes USB sticks and card readers, but not CDs.
>
> >What do you have in your udev rules that creates that node?
>
> Yewdales-lodge:~# cat /etc/udev/rules.d/local.rules
> BUS="scsi", SYSFS{model}="USB 2 HS-SM", NAME{all_partitions}="card_sm"
> BUS="scsi", SYSFS{model}="USB 2 HS-CF", NAME{all_partitions}="card_cf"
> BUS="scsi", SYSFS{model}="USB 2 HS-SD/MMC",
> NAME{all_partitions}="card_sd" BUS="scsi", SYSFS{model}="USB 2 HS-MS",
> NAME{all_partitions}="card_ms"
>
> (I set all of them up as I don't want to have to come back to this if I
> ever get other cards to read.)
>
This looks fine.
> >What do you have in your fstab, or what was your mount command if you
> > didn't have anything setup in fstab?
>
> #Card Reader nodes
>
> /dev/card_sd1 /media/sd vfat rw,user,noauto 0 0
> /dev/card_cf1 /media/cf vfat rw,user,noauto 0 0
> /dev/card_sm1 /media/sm vfat rw,user,noauto 0 0
> /dev/card_ms1 /media/ms vfat rw,user,noauto 0 0
>
This also looks fine.
> >Also, what does the partition table on your card look like? That is,
> > are you sure the data resides on the first primary partition?
>
> Here I have no idea, really. I've only ever done this with the serial
> connector and that was some time ago.
>
> >Justin
>
> Thanks for all your help. It's much appreciated...
>
You're welcome.
Justin
Reply to: