Contents |
How To Configure the Card Reader in a Dell 2405FPW LCD under Linux
I have a Dell 2405FPW. This monitor includes a built in memory card reader and USB hub. I spent some time trying to configure it over the last few months without success. I basically came to the conclusion that it did not work properly. After inserting the Compact Flash card I needed to run sg_map as root to get the device to show up properly. This was a pain, but it worked well enough. I recently decided to try the Kororaa XGL live cd, just for fun. I'd seen videos, but I wanted to give it a shot for myself. After booting into the OS and playing with the nifty GL eye candy I decided to see what would happen if I plugged a CF card into my card reader. I was a bit surprised (and delighted) to see that it was automatically detected and mounted by the OS. This was proof that it was possible to get the card reader working. So I investigated the Kororaa set up to see what was different. Eventually I discovered that it had nothing to do with my kernel configuration. Apparently running HAL (Hardware Abstraction Layer) was causing the device to be created properly. HAL is a piece of software that watches the udev events and maps them into higher level signals so that software is able to deal with them more easily. Once I discovered this, it was quite easy to get it working. Here are steps to get the card reader working for you.
Proper Kernel Configuration
You need to configure USB and SCSI. You need SCSI because the USB mass storage driver uses the SCSI subsystem. So the following kernel options enabled (either as modules or compiled into the kernel, personally I compile all these directly into my kernel).
USB
- USB support (USB)
- USB device filesystem (USB_DEVICEFS)
- USB driver for USB 2.0 EHCI HCD (USB_EHCI_HCD) if you have USB 2.0, otherwise either OHCI HCD (USB_OHCI_HCD) or UHCI HCD (USB_UHCI_HCD).
- USB Mass Storage Support (USB_STORAGE)
SCSI
- SCSI Support (SCSI)
- SCSI Disk Support (BLK_DEV_SD)
- SCSI generic support (CHR_DEC_SG)
- Probe all LUNs on each SCSI device (SCSI_MULTI_LUN)
The last SCSI option Probe all LUNs, is important to get all the drives in the card reader to appear. I've actually only used the CF reader, so I'm not 100% sure that the others really work. I have to give a shout out to this page which helped me get these options worked out.
Testing
Once your kernel is configured, you can test your configuration.
Tools
You'll need to emerge some packages to get the tools used for testing the setup. For lsusb, emerge usbutils, for sg_scan and sg_map emerge sg3_utils.
Check The Configuration
Run lsusb as root. You should see something like this:
tartarus:/usr/src/linux> lsusb Bus 005 Device 001: ID 0000:0000 Bus 004 Device 001: ID 0000:0000 Bus 003 Device 001: ID 0000:0000 Bus 002 Device 003: ID 046d:c00c Logitech, Inc. Optical Wheel Mouse Bus 002 Device 002: ID 046d:c309 Logitech, Inc. Internet Keyboard Bus 002 Device 001: ID 0000:0000 Bus 001 Device 006: ID 0424:223a Standard Microsystems Corp. 8-in-1 Card Reader Bus 001 Device 005: ID 0424:2504 Standard Microsystems Corp. Bus 001 Device 004: ID 0424:2502 Standard Microsystems Corp. Bus 001 Device 001: ID 0000:0000
You should also see sd? devives in /dev. To determine which correspond to you card reader, run sg_scan -i. You should see something like this:
tartarus:/usr/src/linux> sg_scan -i
/dev/sg0: scsi0 channel=0 id=0 lun=0 [em]
ATA ST3250823AS 3.03 [rmb=0 cmdq=0 pqual=0 pdev=0x0]
/dev/sg1: scsi1 channel=0 id=0 lun=0 [em]
ATA ST3250823AS 3.03 [rmb=0 cmdq=0 pqual=0 pdev=0x0]
/dev/sg2: scsi3 channel=0 id=0 lun=0 [em]
ATA ST3200822AS 3.01 [rmb=0 cmdq=0 pqual=0 pdev=0x0]
/dev/sg3: scsi4 channel=0 id=0 lun=0 [em]
SMSC 223 U HS-CF 3.60 [rmb=1 cmdq=0 pqual=0 pdev=0x0]
/dev/sg4: scsi4 channel=0 id=0 lun=1 [em]
SMSC 223 U HS-MS 3.60 [rmb=1 cmdq=0 pqual=0 pdev=0x0]
/dev/sg5: scsi4 channel=0 id=0 lun=2 [em]
SMSC 223 U HS-SM 3.60 [rmb=1 cmdq=0 pqual=0 pdev=0x0]
/dev/sg6: scsi4 channel=0 id=0 lun=3 [em]
SMSC 223 U HS-SD/MMC 3.60 [rmb=1 cmdq=0 pqual=0 pdev=0x0]
The 223 U HS-* entries correspond to the various slots in the card reader.
Make sure you have no cards in the card reader and turn your monitor off and then on. At this point there should be /dev/sd? devices listed in /dev, but no /dev/sd?1 (it may take a few seconds before the /dev/sd? devices appear). Insert a card into the card reader. If your experience is like mine, the devices will not change. With a card inserted, there should be a /dev/sd?1 device that can be mounted as a disk. With the card inserted turn the monitor off and on again. This time there should be a /dev/sd?1. So the card reader does work, but there is something wrong with the detection process.
As cycling the monitor is a poor way to get the card reader going, you can run sg_map as root to get the card detected. To try this remove the card, then turn the monitor off and on again and re-insert the card. You should not have the /dev/sd?1 device that corresponds to the card anymore. With the card inserted run sg_map. After doing this, the /dev/sd?1 device should appear. You can now mount this device.
The Final Piece
After playing with the Kororaa Live CD, I discovered that it was not a kernel configuration issue. Kororaa was running HAL and with HAL running the /dev/sd?1 device appears automatically when the card is inserted. It seems that HAL is able to detect the card being inserted and runs its version of sg_map (or whatever special mojo is required) so that the device appears correctly.
In addition, if HAL is running on your system, you can also run software to automatically detect when devices are attached to the system and take action. I have configured ivman to automatically copy the images from my compact flash card on to my computer when the card is inserted. In addition, it will automatically mount usb drives when inserted. I have described my setup here.