Skip navigation.
Home
Now Shipping Version 7.0

USB multi-card reader woes

craftbrewer's picture

Posts: 46

I'm running the 2.6.10 Kernel. I've seen various posts on problems with these units, but little info for solutions.

Way back when I first got this thing, I recall having to recompile my 2.4.? gentoo kernel with something like CONFIG_SCSI_MULTI_LUN enabled. I've also seen docs on manually mapping these in /proc/scsi/scsi to enable the 'probe all luns' as well, but don't reference which line of kernel(s) this is for.

Do these rules still apply to the 2.6.* kernels or is there another reason why my multi-card reader only reports lun0?

Thanks...
...Jarrod

craftbrewer's picture

Ugly fix finally!

I see now why CONFIG_SCSI_MULTI_LUN is not enabled. I recompiled my kernel with this option, and while it does indeed find all LUNs on my Reader, it does appear to be extremely unstable. The active ports would frequently hang,and replugging the unit into the USB port would fix, but leave the old devices behind (sdb1/sdd1) then map the "new" ones to sde1, sdf1. Until the next freeze, which would give me g & h, etc.

Until that's fixed, I've written this shell script for my wife's machine. Its probably not the best solution, its not elegant - total BFI methodology, but it works and doesn't seem to exibit the same device instability as enabling the above kernel flag does. If you've been looking for a solution to these multi card readers, try it out:

$ cat usbmcr-auto.sh

br />
#!/bin/sh
# Adjust max_luns for the number of ports, or slots, on your Multi-Card Reader
max_luns=4
buses=$(dmesg|grep "Attached scsi removable disk" |cut -d',' -f1 |cut -d' ' -f7|cut -c5)

for bus in buses; do
lun=0; while [ "$max_luns" -gt "$lun" ]; do
echo "scsi add-single-device ${bus} 0 0 ${lun}" > /proc/scsi/scsi
(( lun = lun + 1 ))
done
done

# Update /etc/fstab Dynamic entries
buildfstab
[\code]

This needs to be run as root. I've tried unsuccessfully to put it in /etc/init.d/ with symlinks to the /etc/rc* directories. The solution I created for my wife was to cp it to /usr/local/bin/cardreader with an entry in /etc/sudoers to allow her to 'sudo cardreader' when required. Make sure you have cards in the slots beforehand to create the dynamic entries in /etc/fstab.

I hope this helps somebody out there.

Works great!

Your fix works great for MEPIS 3.3 / kernel 2.6.10 on my machine. I went one step farther and created an alias entry for the cardreader script to make life even easier (I only use SD cards in my reader):

alias SD='sudo /usr/local/bin/cardreader && mount /dev/sdc1'

Oh, and I noticed one bug in your code (at least when run on my machine) - the for loop statement was:

for bus in buses; do

but should be:

for bus in $buses; do

in order for $buses to resolve (or maybe that's just under bash?)

Anyway, thanks for this solution to a problem that's been bugging me since I upgraded to MEPIS 3.3!

-Nick(at)divbyzero(dot)com

craftbrewer's picture

Good catch!

I had made a couple last minute script changes to hide the fact I initially did something in a really dumb way Eye-wink ... only to get caught by not verifying the changes before posting! Shocked

Glad my small effort has helped someone else out.

Thank you

Just wanted to thank you both for the fix Smiling

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.