|
Showing revision 1
Multi card reader on Linux
What do we want to do
This describes briefly how to access all slots of a multi card reader on Linux. Since the kernels of most distributions have the kernel setting "Probe all LUNs on each SCSI device" disabled those kernels will only see the first slot of the card reader.
You have two choices:
- If you compile the kernel yourself anyway just turn on the mentioned option (it's in the SCSI device settings category) - solved.
- If you want to use your distro kernel and you do not have the mood or the choice to recompile it you will need some handwork as described below.
For solution 1 you are done. For 2 read further.
The Linux SCSI subsystem has a really nice feature that enables you to hot-add devices (and remove if you want to). Since the USB mass storage driver uses the SCSI subsystem to show you a "hard drive" to mount (and multi-device handling) we can use this feature to make the other slots visible.
The mass storage driver assigns one host for itself. One USB reader gets an ID. To distinguish between the different slots it uses the LUNs (which stands for "Logical Unit Number" btw). Now we add all the LUNs of the other slots and we are done.
Requirements
I assume that you do not have any SCSI hard drive in your machine and your PC has detected the card reader and loaded the USB mass storage driver (see the output of the dmesg command). If this is not the case you first have to fix this. Do not send me emails about this, I cannot and will not help you to fix this. If you have no clue try mailinglists, newsgroups or local Linux user groups. This description works on Linux 2.4 and 2.6 systems.
Hot-add of LUN
This must be done as root!
To tell the SCSI subsystem of a new LUN the following command is used:
echo "scsi add-single-device Host Channel Id Lun"
The host can be determined by looking at the output of cat /proc/scsi/scsi. Look for the line matching your card readers name (Model). The line above this one starts with "scsi[n]", where [n] is a number. Use this number. The channel and Id are exactly the values written in this line.
LUN 0 should already be there. Now count the number of slots of your card reader and add as many LUNs as you have slots, starting to count with 1. (If you have four slots add the additional LUNS 1, 2 and 3. As 0 has already been found you will have 4 LUNs afterwards).
Here is an example that I use:
wintermute:[~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: ICSI Model: CardReader CF Rev: 2.7C
Type: Direct-Access ANSI SCSI revision: 02
wintermute:[~]# echo "scsi add-single-device 0 0 0 1" > /proc/scsi/scsi
wintermute:[~]# echo "scsi add-single-device 0 0 0 2" > /proc/scsi/scsi
wintermute:[~]# echo "scsi add-single-device 0 0 0 3" > /proc/scsi/scsi
wintermute:[~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: ICSI Model: CardReader CF Rev: 2.7C
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 00 Lun: 01
Vendor: ICSI Model: CardReader MS Rev: 2.7C
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 00 Lun: 02
Vendor: ICSI Model: CardReaderMMC/SD Rev: 2.7C
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 00 Lun: 03
Vendor: ICSI Model: CardReader SM Rev: 2.7C
Type: Direct-Access ANSI SCSI revision: 02
Hope this helps you a little bit further to fetch the pictures of your cam :-)
|
|