Using Multi-Card Flash Readers
How to configure and access flash card readers with support for
multiple different flash cards.
Written by Susan
Macchia May 19, 2003
Updated, May 20, 2003
Some background:
I had a San Disk Imagemate Dual card
reader and later purchased a Viking Intelliflash 6 in 1 card
reader. Both are usb and I could mount the Compact Flash part of
each reader with no problem. But, I was unable to access any of
the other ports in either reader. I did the steps outlined on a
RedHat 8.0 distro with an updated kernel (2.4.18-27).
The following resources helped a bit, as did the SxS mailing list:
http://www.linuxjournal.com/article.php?sid=6687
http://www.cs.sfu.ca/~ggbaker/personal/cf-linux
Steps to utilize all the ports in multi-card flash readers:
- After booting your machine, execute lsmod and make sure you see:
usb-storage
62064 0
scsi_mod
107240 6 [usb-storage st sd_mod sg sr_mod ide-scsi]
usb-uhci
26188 0 (unused)
usbcore
77056 1 [usb-storage hid usb-uhci]
In particular, usb-storage, must be loaded. If it isn't, execute:
insmod usb-storage
If you don't have that module, you'll
have to build it (and that is outside the scope of this SxS).
- Execute the following command to see what bus the reader is on:
$ cdrecord -scanbus
My output looked like:
Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C)
1995-2001 Jrg Schilling
Linux sg driver version: 3.1.24
Using libscg version 'schily-0.5'
scsibus0:
0,0,0 0) 'DMI '
'MultiFlash ' '3.00' Removable Disk
0,1,0 1) *
0,2,0 2) *
0,3,0 3) *
0,4,0 4) *
0,5,0 5) *
0,6,0 6) *
0,7,0 7) *
scsibus1:
1,0,0 100) 'YAMAHA '
'CRW2100E ' '1.0N' Removable
CD-ROM
1,1,0 101) *
1,2,0 102) *
1,3,0 103) *
1,4,0 104) *
1,5,0 105) *
1,6,0 106) *
1,7,0 107) *
- As root, create and run the following script:
#!/bin/sh
echo "scsi add-single-device 0 0 0 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 0 1" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 0 2" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 0 3" > /proc/scsi/scsi
cat /proc/scsi/scsi
If you have less than 4 ports, you can
remove the lines for each port that you don't need. You can also
put the running of this script in /etc/rc.local (but I haven't tried
that :-) ).
You should see something like:
$ cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: DMI Model:
MultiFlash Rev: 3.00
Type:
Direct-Access
ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 00 Lun: 01
Vendor: DMI Model:
MultiFlash Rev: 3.00
Type:
Direct-Access
ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 00 Lun: 02
Vendor: DMI Model:
MultiFlash Rev: 3.00
Type:
Direct-Access
ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 00 Lun: 03
Vendor: DMI Model:
MultiFlash Rev: 3.00
Type:
Direct-Access
ANSI SCSI revision: 02
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: YAMAHA Model:
CRW2100E Rev: 1.0N
Type:
CD-ROM
ANSI SCSI revision: 02
- Download sg_utils
and install it. This set of tools allows you to see how your scsi
devices are set up:
$ sg_scan -i
Will tell what devices are on scsi, they should match whats in
/proc/scsi/scsi.
$ sg_map
Shows the mappings of devices. This will help you figure out
which device name to use when mounting. For example, with my
Viking 6-in-1, I see:
/dev/sg0 /dev/sda
/dev/sg1 /dev/scd0
/dev/sg2 /dev/sdb
/dev/sg3 /dev/sdc
/dev/sg4 /dev/sdd
Each card has 1 partition, so you would mount the compact flash, as
/dev/sda1, etc. You'll have to play with the reader to determine
which maps to what flash port. I did this by sticking 1 card in
the device and trying to mount each one in turn to see which was the one
I wanted.
To mount the MMC/SD port, for example I execute (as root):
$ mkdir /mnt/mmc # only need to do this 1 time.
$ mount /dev/sdc1 /mnt/mmc
If it returns the following error:
mount: you must specify the filesystem
type
you'll have to format the card, for example:
mkfs -t vfat /dev/sdc1
Often, though, your device (i.e., a palm pilot), will format the empty
card for you.
Once mounted, you can move
anything to/from the flash card.
BEWARE
- Do not remove the flash card
before unmounting the port! I have seen my system hang completely
when doing so.