Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
udev.rules setting for USB card reader
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Mark Clegg
Apprentice
Apprentice


Joined: 05 Jan 2004
Posts: 270
Location: ZZ9 Plural Z Alpha

PostPosted: Sat Mar 27, 2004 5:15 pm    Post subject: udev.rules setting for USB card reader Reply with quote

I'm trying to get the udev.rules settings for my "Dazzle*" 6-in-one USB card reader setup, but not having much joy.

The device acts as two separate LUNS on the same SCSI id, which doesn't help as the only section from udevinfo that distinguishes between the two doesn't appear to be recognisable by the udev hotplug daemon.

udevinfo -a -p /sys/block/sda gives for following.. (entries in (** )'s are for sdb)

Code:
device '/sys/block/sda' has major:minor 8:0
  looking at class device '/sys/block/sda':
    SYSFS_dev="8:0"  (** "8:16" )
    SYSFS_range="16"
    SYSFS_size="0"
    SYSFS_stat="       0        0        0        0        0        0        0        0        0        0
 0"

follow the class device's "device"
  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1f.4/usb2/2-2/2-2:1.0/host5/5:0:0:0': (** 5:0:0:1)
    BUS="scsi"
    ID="5:0:0:0" (** 5:0:0:1)
    SYSFS_detach_state="0"
    SYSFS_type="0"
    SYSFS_vendor="eUSB    "
    SYSFS_max_sectors="240"
    SYSFS_device_blocked="0"
    SYSFS_queue_depth="1"
    SYSFS_scsi_level="3"
    SYSFS_model="Compact Flash   "  (** "SD-MS-SM")
    SYSFS_rev="5.07"
    SYSFS_online="1"

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1f.4/usb2/2-2/2-2:1.0/host5':
    BUS=""
    ID="host5"
    SYSFS_detach_state="0"

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1f.4/usb2/2-2/2-2:1.0':
    BUS="usb"
    ID="2-2:1.0"
    SYSFS_detach_state="0"
    SYSFS_bInterfaceNumber="00"
    SYSFS_bAlternateSetting=" 0"
    SYSFS_bNumEndpoints="02"
    SYSFS_bInterfaceClass="08"
    SYSFS_bInterfaceSubClass="06"
    SYSFS_bInterfaceProtocol="50"
    SYSFS_iInterface="04"

 looking at the device chain at '/sys/devices/pci0000:00/0000:00:1f.4/usb2/2-2':
    BUS="usb"
    ID="2-2"
    SYSFS_detach_state="0"
    SYSFS_bNumConfigurations="1"
    SYSFS_bNumInterfaces=" 1"
    SYSFS_bConfigurationValue="1"
    SYSFS_bmAttributes="80"
    SYSFS_bMaxPower="100mA"
    SYSFS_idVendor="04e6"
    SYSFS_idProduct="0325"
    SYSFS_bcdDevice="0507"
    SYSFS_bDeviceClass="00"
    SYSFS_bDeviceSubClass="00"
    SYSFS_bDeviceProtocol="00"
    SYSFS_speed="12"
    SYSFS_manufacturer="SCM Microsystems Inc."
    SYSFS_product="eUSB ORCA Quad Reader"
    SYSFS_serial="000000000062"


and what I'm trying in udev.rules is

Code:
# Dazzle USB Card Reader
BUS="scsi", KERNEL="sd?[0-9]", SYSFS_vendor="eUSB", SYSFS_model="SD-MS-SM",      NAME="%k", SYMLINK="usb/sd-ms-sm"
BUS="scsi", KERNEL="sd?[0-9]", SYSFS_vendor="eUSB", SYSFS_model="SD-MS-SM",      NAME="%k", SYMLINK="usb/sd-ms-sm-p%n"
BUS="scsi", KERNEL="sd?",      SYSFS_vendor="eUSB", SYSFS_model="Compact Flash", NAME="%k", SYMLINK="usb/compact-flash"
BUS="scsi", KERNEL="sd?[0-9]", SYSFS_vendor="eUSB", SYSFS_model="Compact Flash", NAME="%k", SYMLINK="usb/compact-flash-p%n"


I've turned on "logging" in udev.conf, and the rules above never get executed. If I just put in

Code:
BUS="scsi", NAME="%k"


then that works, but is obviously far to unrestricted.

I have other USB mass-storage devices, and I'm using BUS="usb"... entries for them and that works fine, but in this case, there's no way to distinguish between the two separate LUN's from the USB section.

Any ideas?
Back to top
View user's profile Send private message
Tarball
Tux's lil' helper
Tux's lil' helper


Joined: 19 Jun 2002
Posts: 142
Location: Cheshire, UK

PostPosted: Wed May 05, 2004 1:13 am    Post subject: Reply with quote

I have the same problem. I am using a 6in1 reader (lsusb identifies it as 058f:9360 Alcor Micro Corp.)

If I have the rules:
Code:

BUS="scsi", SYSFS{model}="USB SD Reader   ", KERNEL="sd*", NAME="%k", SYMLINK="card/sd"
BUS="scsi", SYSFS{model}="USB CF Reader   ", KERNEL="sd*", NAME="%k", SYMLINK="card/cf"
BUS="scsi", SYSFS{model}="USB SM Reader   ", KERNEL="sd*", NAME="%k", SYMLINK="card/sm"
BUS="scsi", SYSFS{model}="USB MS Reader   ", KERNEL="sd*", NAME="%k", SYMLINK="card/ms"


It kind of works but all the symlinks are to the block devices sda sdb sdc where as I want the symlinks to point to the mountable devices sda1 sdb1 sdc1 ...

If I set the rules up as:
Code:

BUS="scsi", SYSFS{model}="USB SD Reader   ", KERNEL="sd?[0-9]", NAME="%k", SYMLINK="card/sd"
BUS="scsi", SYSFS{model}="USB CF Reader   ", KERNEL="sd?[0-9]", NAME="%k", SYMLINK="card/cf"
BUS="scsi", SYSFS{model}="USB SM Reader   ", KERNEL="sd?[0-9]", NAME="%k", SYMLINK="card/sm"
BUS="scsi", SYSFS{model}="USB MS Reader   ", KERNEL="sd?[0-9]", NAME="%k", SYMLINK="card/ms"


Then no symlinks are created at all!

Also, I have been working blind which doesn't help matters. I have set legging to "yes" but I don't seem to get any messages, where do they appear (dmesg?) and do I need to reset something to get udev to pick up the change to udev.conf???

Anybody got any further with this?
Back to top
View user's profile Send private message
Tarball
Tux's lil' helper
Tux's lil' helper


Joined: 19 Jun 2002
Posts: 142
Location: Cheshire, UK

PostPosted: Thu May 06, 2004 6:31 am    Post subject: Reply with quote

I've got a bit futher with this.

I can now get it to set up links for media that is inserted in the card reader before it is plugged in to the usb, so if I have a CF card in it, it will correctly symlink /dev/sdb1 to /dev/card/cf.

What you need to do is add an option for the module scsi-mod, the option is:
Code:

option scsi-mod max_luns=4


which tells the scsi-mod module that there is more than one scsi 'drive' associated with this device.

The thing which doesn't work now is getting the thing to add device symlinks when cards are inserted. The device doesn't seem to indicate when a card has been inserted/removed.

Is it possible to define a udev.rule to somehow call mknod, that way at least I could get udev to create the sd?1 device nodes even when the cards aren't inserted!
Back to top
View user's profile Send private message
Mark Clegg
Apprentice
Apprentice


Joined: 05 Jan 2004
Posts: 270
Location: ZZ9 Plural Z Alpha

PostPosted: Thu May 06, 2004 8:45 pm    Post subject: Reply with quote

Thats about the same place I've got to. (Except I didn't know about the scsi_mod option - that could be useful - thanks).

What's needed I think is another hotplug event to be triggered when a card is inserted.

If you put your media in the reader before you connect it to the USB, like you say, the nodes for the partitions get created correctly. It's not perfect but it does work.
Back to top
View user's profile Send private message
IamBorg
Tux's lil' helper
Tux's lil' helper


Joined: 05 Nov 2003
Posts: 86

PostPosted: Sat May 08, 2004 6:59 am    Post subject: Reply with quote

I've recently been getting my multi-card reader working under Linux. I have come a long way in just a few days. I read your article and decided to see if mine exhibits this behaviour. What do you know, when I had my setup to make devices /dev/mcr[0,1,2,3], I have wierd things happen. If I had the CF card not in the multi-reader or have unmounted it, then it did not recognize mcr1 as a block device. I went ahead and changed my udev rule from
Code:
BUS="usb", SYSFS_serial="20030227045554280", Name="mcr%n"
to
Code:
BUS="usb", SYSFS_serial="20030227045554280", Name="%k", SYMLINK="mcr%n"
. Without any cards plugged in, the devices /dev/sd[a,b,c,d] and /dev/sg[0,1,2,3] are created and the symlinks mcr -> sdd, mcr[0,1,2,3] -> sg[0,1,2,3] respectively. After putting in my cf card, nothing changes. Then when I mount /dev/sdb, it takes a little while and says wrong fs type.... However, /dev/sdb1 is created 8) and the symlink /dev/mcr1 now points to /dev/sdb1 instead of /dev/sg1. Then I can mount my cf card, unmount it, remount it,....

Sorry if this is wordy, but I figure this info might be useful. I believe I almost got all my little wrinkles out with this.
Back to top
View user's profile Send private message
Tarball
Tux's lil' helper
Tux's lil' helper


Joined: 19 Jun 2002
Posts: 142
Location: Cheshire, UK

PostPosted: Sat May 08, 2004 11:24 pm    Post subject: Reply with quote

Cheers for that. At the moment I am resorting to putting the cards in the reader before I plug it into the USB port.

So far this has been a bit of trial and error for me. I have a couple of questions maybe you could answer.

Firstly, if I turn on logging for the udev stuff where is this log written to (I am using metalog)?

Secondly, apart from decibel's page I have not found much information on udev (admittedly I haven't looked very hard), where can I find information on the parameters for the rules (such as KERNEL, SYMLINK, etc) and what other parameters there are?

Cheers guys!

PS. Must admit, I'm suprise there isn't more information in these forums regarding this topic!
Back to top
View user's profile Send private message
IamBorg
Tux's lil' helper
Tux's lil' helper


Joined: 05 Nov 2003
Posts: 86

PostPosted: Sun May 09, 2004 4:58 am    Post subject: Reply with quote

I assume that the logs would be generated within /var/log. Which log they'll be in, I'm not sure. I haven't yet gotten what all is logged and where. I end up typing dmesg to see what my computer is doing. A place to learn about udev, http://www.gentoo.org/doc/en/udev-guide.xml . I ended up reading the UDEV PRimer as I was figuring out how to do scanners after kernel 2.6.1. Then when I upgraded to kernel 2.6.5-gentoo-dev-sources, I could not complete boot without turning off devfs.8O So everything has been trial and error. That's the way I learn best.8) For learning rules, I used DSD's Guide on how to Write Udev Rules
Back to top
View user's profile Send private message
Tarball
Tux's lil' helper
Tux's lil' helper


Joined: 19 Jun 2002
Posts: 142
Location: Cheshire, UK

PostPosted: Sun May 09, 2004 2:02 pm    Post subject: Reply with quote

I've had a look at the documents you mentioned but they just tend to be guides to get you up an running. Gonna keep plugging at it, I'll post back here if I get any further.

Just got to look at my printers one of them is having a bit of a funny.

I can see it in the output of lsusb and it appears in /sys/class/usb/lp0 but there is no entry under /sys/class/usb/printers.


Can't remember changing anything but for some reason it won't create a symlink for it!!! I think the usb chain might have got screwed somewhere!!!
Back to top
View user's profile Send private message
andersbk
n00b
n00b


Joined: 16 Aug 2003
Posts: 35

PostPosted: Wed Feb 22, 2006 6:57 pm    Post subject: Reply with quote

EDIT: Resolved to my liking. Follow link below, to other thread, for my solution.

Bumping this and referencing this thread. I still have the problem described in this thread, where udev simlinks are not created unless I "hotplug" the reader with a CF already inserted.

see:
https://forums.gentoo.org/viewtopic-p-3131673.html#3131673
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum