[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: a pair of questions



On Sun, 2004-06-13 at 04:00, Antonio Rodriguez wrote:
> 
> Hi Steven, I also have a 4-slot card reader, is a HP pavilion a250y
> modified (customized). I tried the name{all_partitions} trick as
> suggested by john fj... (sorry, hard spelling) and didn't
> work.

The thing is, I didn't do anything other than install the 2.6 kernel and
udev.  The only I did do was write udev rules.

I'm assuming that the kernel detects your 4-slot reader at boot time,
and you can see something like following in dmesg:

usb 1-1.3: new full speed USB device using address 5
SCSI subsystem initialized
Initializing USB Mass Storage driver...
scsi0 : SCSI emulation for USB Mass Storage devices
  Vendor: Zynet     Model: USB Storage-SMC   Rev: I03A
  Type:   Direct-Access                      ANSI SCSI revision: 02
  Vendor: Zynet     Model: USB Storage-CFC   Rev: I03A
  Type:   Direct-Access                      ANSI SCSI revision: 02
  Vendor: Zynet     Model: USB Storage-MMC   Rev: I03A
  Type:   Direct-Access                      ANSI SCSI revision: 02
Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
Attached scsi removable disk sdb at scsi0, channel 0, id 0, lun 1
Attached scsi removable disk sdc at scsi0, channel 0, id 0, lun 2
  Vendor: Zynet     Model: USB Storage-MSC   Rev: I03A
  Type:   Direct-Access                      ANSI SCSI revision: 02
Attached scsi removable disk sdd at scsi0, channel 0, id 0, lun 3
USB Mass Storage device found at 5
usbcore: registered new driver usb-storage
USB Mass Storage support registered.

If you see only 1 of the slot, make sure your kernel is compiled to
probe all LUNs. I'm using Debian's stock 2.6 kernel.

If so, the only stanza required would be udev rules.  I place mine
in /etc/udev/rules.d/local.rules:

#
# CompactFlash/MemoryStick/SmartMedia/SecureDigital/MultiMediaCard
# Storage Reader
#
#   Create ALL 16 partitions of a block device because most card 
#   readers are too dumb to implement an actual media change
#   notification.
#

BUS="scsi", SYSFS{model}="USB Storage-MMC*",
NAME{all_partitions}="securedigital"

BUS="scsi", SYSFS{model}="USB Storage-CFC*",
NAME{all_partitions}="compactflash"

BUS="scsi", SYSFS{model}="USB Storage-SMC*",
NAME{all_partitions}="smartmedia"

BUS="scsi", SYSFS{model}="USB Storage-MSC*",
NAME{all_partitions}="memorystick"
 

The above should actually be 4 lines. The key to writing udev rules is
find the proper SYSFS{} attribute to use to identify your devices. In my
case, a "udevinfo -a -p /sys/block/sda" gives me the following for the
SCSI bus:

follow the class device's "device"
  looking at the device chain at
'/sys/devices/pci0000:00/0000:00:07.2/usb1/1-1/1-1.3/1-1.3:1.0/host0/0:0:0:0':
    BUS="scsi"
    ID="0:0:0:0"
    SYSFS{detach_state}="0"
    SYSFS{device_blocked}="0"
    SYSFS{max_sectors}="240"
    SYSFS{model}="USB Storage-SMC "
    SYSFS{queue_depth}="1"
    SYSFS{rev}="I03A"
    SYSFS{scsi_level}="3"
    SYSFS{state}="running"
    SYSFS{type}="0"
    SYSFS{vendor}="Zynet   "

The value of the SYSFS{model} attribute allows me to use it to identify
the various slots.

One other thing. You need to force new hotplug events to be created
after writing your udev rules.  Since mine is an external card-reader, I
simply unplugged it and plug it back into the USB port.  I think the
same effect can be had by "rmmod usb-storage && modprobe usb-storage".

Hope that helps.

-- 
Steven Yap <syap@shaw.ca>



Reply to: