LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-24-2009, 07:11 PM   #16
DBabo
Member
 
Registered: Feb 2003
Distribution: Fedora {latest}
Posts: 568

Original Poster
Rep: Reputation: 40

thank you GrapefruiTgirl and H_TeXMeX_H, i'vegot backed up @ work and haven't had a chance to read on udev yet. I'll update the thread with the new information, just allow me 2-3 days
Andrew
 
Old 09-27-2009, 02:24 PM   #17
DBabo
Member
 
Registered: Feb 2003
Distribution: Fedora {latest}
Posts: 568

Original Poster
Rep: Reputation: 40
ok. here what i have done so far:
Code:
 udevinfo -a -p `udevinfo -q path -n /dev/sdb1`

Udevinfo starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/block/sdb/sdb1':
    KERNEL=="sdb1"
    SUBSYSTEM=="block"
    SYSFS{stat}=="      79      261      340      795        0        0        0        0        0      678      795"
    SYSFS{size}=="29063"
    SYSFS{start}=="57"
    SYSFS{dev}=="8:17"

  looking at parent device '/block/sdb':
    ID=="sdb"
    BUS=="block"
    DRIVER==""
    SYSFS{stat}=="     225      820     1654     4058        0        0        0        0        0     2485     4058"
    SYSFS{size}=="29120"
    SYSFS{removable}=="1"
    SYSFS{range}=="16"
    SYSFS{dev}=="8:16"

  looking at parent device '/devices/pci0000:00/0000:00:0b.0/usb1/1-5/1-5:1.0/host6/target6:0:0/6:0:0:0':
    ID=="6:0:0:0"
    BUS=="scsi"
    DRIVER=="sd"
    SYSFS{ioerr_cnt}=="0x11d"
    SYSFS{iodone_cnt}=="0x15002"
    SYSFS{iorequest_cnt}=="0x15002"
    SYSFS{iocounterbits}=="32"
    SYSFS{timeout}=="60"
    SYSFS{state}=="running"
    SYSFS{rev}=="1.00"
    SYSFS{model}=="USB SD Reader   "
    SYSFS{vendor}=="Generic "
    SYSFS{scsi_level}=="3"
    SYSFS{type}=="0"
    SYSFS{queue_type}=="none"
    SYSFS{queue_depth}=="1"
    SYSFS{device_blocked}=="0"
    SYSFS{max_sectors}=="240"

  looking at parent device '/devices/pci0000:00/0000:00:0b.0/usb1/1-5/1-5:1.0/host6/target6:0:0':
    ID=="target6:0:0"
    BUS==""
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:0b.0/usb1/1-5/1-5:1.0/host6':
    ID=="host6"
    BUS==""
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:0b.0/usb1/1-5/1-5:1.0':
    ID=="1-5:1.0"
    BUS=="usb"
    DRIVER=="usb-storage"
    SYSFS{modalias}=="usb:v058Fp9360d0100dc00dsc00dp00ic08isc06ip50"
    SYSFS{bInterfaceProtocol}=="50"
    SYSFS{bInterfaceSubClass}=="06"
    SYSFS{bInterfaceClass}=="08"
    SYSFS{bNumEndpoints}=="02"
    SYSFS{bAlternateSetting}==" 0"
    SYSFS{bInterfaceNumber}=="00"

  looking at parent device '/devices/pci0000:00/0000:00:0b.0/usb1/1-5':
    ID=="1-5"
    BUS=="usb"
    DRIVER=="usb"
    SYSFS{configuration}==""
    SYSFS{serial}=="2004888"
    SYSFS{product}=="USB Reader"
    SYSFS{manufacturer}==" "
    SYSFS{maxchild}=="0"
    SYSFS{version}==" 1.10"
    SYSFS{devnum}=="2"
    SYSFS{speed}=="12"
    SYSFS{bMaxPacketSize0}=="8"
    SYSFS{bNumConfigurations}=="1"
    SYSFS{bDeviceProtocol}=="00"
    SYSFS{bDeviceSubClass}=="00"
    SYSFS{bDeviceClass}=="00"
    SYSFS{bcdDevice}=="0100"
    SYSFS{idProduct}=="9360"
    SYSFS{idVendor}=="058f"
    SYSFS{bMaxPower}=="100mA"
    SYSFS{bmAttributes}=="80"
    SYSFS{bConfigurationValue}=="1"
    SYSFS{bNumInterfaces}==" 1"

  looking at parent device '/devices/pci0000:00/0000:00:0b.0/usb1':
    ID=="usb1"
    BUS=="usb"
    DRIVER=="usb"
    SYSFS{configuration}==""
    SYSFS{serial}=="0000:00:0b.0"
    SYSFS{product}=="OHCI Host Controller"
    SYSFS{manufacturer}=="Linux 2.6.18-164.el5 ohci_hcd"
    SYSFS{maxchild}=="8"
    SYSFS{version}==" 1.10"
    SYSFS{devnum}=="1"
    SYSFS{speed}=="12"
    SYSFS{bMaxPacketSize0}=="64"
    SYSFS{bNumConfigurations}=="1"
    SYSFS{bDeviceProtocol}=="00"
    SYSFS{bDeviceSubClass}=="00"
    SYSFS{bDeviceClass}=="09"
    SYSFS{bcdDevice}=="0206"
    SYSFS{idProduct}=="0000"
    SYSFS{idVendor}=="0000"
    SYSFS{bMaxPower}=="  0mA"
    SYSFS{bmAttributes}=="e0"
    SYSFS{bConfigurationValue}=="1"
    SYSFS{bNumInterfaces}==" 1"

  looking at parent device '/devices/pci0000:00/0000:00:0b.0':
    ID=="0000:00:0b.0"
    BUS=="pci"
    DRIVER=="ohci_hcd"
    SYSFS{broken_parity_status}=="0"
    SYSFS{enable}=="0"
    SYSFS{modalias}=="pci:v000010DEd0000026Dsv0000105Bsd00000CAFbc0Csc03i10"
    SYSFS{local_cpus}=="ffffffff"
    SYSFS{irq}=="209"
    SYSFS{class}=="0x0c0310"
    SYSFS{subsystem_device}=="0x0caf"
    SYSFS{subsystem_vendor}=="0x105b"
    SYSFS{device}=="0x026d"
    SYSFS{vendor}=="0x10de"

  looking at parent device '/devices/pci0000:00':
    ID=="pci0000:00"
    BUS==""
    DRIVER==""
where values in bold went into rules:
Code:
# SD reader
SUBSYSTEM=="block",BUS=="scsi",KERNEL=="sd[a-z]",SYSFS{model}=="USB SD Reader   ",SYSFS{vendor}=="Generic ",SYSFS{rev}=="1.00",NAME{all_partitions}="cardreader/SD",GROUP="plugdev"
which became a rule 39:
Code:
ls -l /etc/udev/rules.d/
total 148
-rw-r--r-- 1 root root   515 Apr 17 19:52 05-udev-early.rules
-rw-r--r-- 1 root root   193 Sep 27 15:27 39-card.rules
-rw-r--r-- 1 root root   920 Apr 17 19:50 40-multipath.rules
-rw-r--r-- 1 root root 15647 Apr 17 19:52 50-udev.rules
-rw-r--r-- 1 root root   471 Apr 17 19:52 51-hotplug.rules
-rw-r--r-- 1 root root 58016 Apr  3  2007 60-libsane.rules
-rw-r--r-- 1 root root   143 Nov 13  2008 60-net.rules
-rw-r--r-- 1 root root  1088 Jan  6  2007 60-pcmcia.rules
-rw-r--r-- 1 root root   452 Jan 21  2009 60-raw.rules
-rw-r--r-- 1 root root  8209 Jan 21  2009 60-wacom.rules
-rw-r--r-- 1 root root  1823 Jan 21  2009 85-pcscd_ccid.rules
-rw-r--r-- 1 root root   114 Jan 21  2009 90-alsa.rules
-rw-r--r-- 1 root root    61 Apr 17 19:52 90-dm.rules
-rw-r--r-- 1 root root    82 Jan 20  2009 90-hal.rules
-rw-r--r-- 1 root root   107 Apr 17 19:52 95-pam-console.rules
-rw-r--r-- 1 root root  2319 Jul 14  2008 bluetooth.rules
the messages:
Code:
Sep 27 15:29:18 server kernel: SCSI device sdb: 29120 512-byte hdwr sectors (15 MB)
Sep 27 15:29:18 server kernel: sdb: Write Protect is off
Sep 27 15:29:18 server kernel: sdb: assuming drive cache: write through
Sep 27 15:29:18 server kernel: SCSI device sdb: 29120 512-byte hdwr sectors (15 MB)
Sep 27 15:29:18 server kernel: sdb: Write Protect is off
Sep 27 15:29:18 server kernel: sdb: assuming drive cache: write through
Sep 27 15:29:18 server udevd[519]: udev_event_run: seq 2545 forked, pid [20284], 'add' 'block', 0 seconds old
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/bin/bash -c '/sbin/lsmod | /bin/grep ^dm_multipath''
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/bin/bash' (stdout) 'dm_multipath           24909  0 '
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/bin/bash' returned with status 0
Sep 27 15:29:18 server udevd-event[20284]: udev_rules_get_name: add symlink 'disk/by-id/usb-Generic_USB_SD_Reader_2004888-part1'
Sep 27 15:29:18 server udevd-event[20284]: udev_rules_get_name: add symlink 'disk/by-path/pci-0000:00:0b.0-usb-0:5:1.0-scsi-0:0:0:0-part1'
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/lib/udev/vol_id --export /dev/.tmp-8-17'
Sep 27 15:29:18 server kernel:  sdb: sdb1
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/lib/udev/vol_id' (stdout) 'ID_FS_USAGE=filesystem'
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/lib/udev/vol_id' (stdout) 'ID_FS_TYPE=vfat'
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/lib/udev/vol_id' (stdout) 'ID_FS_VERSION=FAT12'
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/lib/udev/vol_id' (stdout) 'ID_FS_UUID=5B89-39B2'
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/lib/udev/vol_id' (stdout) 'ID_FS_LABEL='
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/lib/udev/vol_id' (stdout) 'ID_FS_LABEL_SAFE='
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/lib/udev/vol_id' returned with status 0
Sep 27 15:29:18 server udevd-event[20284]: udev_rules_get_name: add symlink 'disk/by-uuid/5B89-39B2'
Sep 27 15:29:18 server udevd-event[20284]: udev_rules_get_name: no node name set, will use kernel name 'sdb1'
Sep 27 15:29:18 server udevd-event[20284]: udev_db_get_device: no db file to read /dev/.udev/db/block@sdb@sdb1: No such file or directory
Sep 27 15:29:18 server udevd-event[20284]: udev_node_add: creating device node '/dev/sdb1', major = '8', minor = '17', mode = '0640', uid = '0', gid = '6'
Sep 27 15:29:18 server udevd-event[20284]: udev_node_add: creating symlink '/dev/disk/by-id/usb-Generic_USB_SD_Reader_2004888-part1' to '../../sdb1'
Sep 27 15:29:18 server udevd-event[20284]: udev_node_symlink: creating symlink '/dev/disk/by-id/usb-Generic_USB_SD_Reader_2004888-part1' to '../../sdb1'
Sep 27 15:29:18 server udevd-event[20284]: udev_node_add: creating symlink '/dev/disk/by-path/pci-0000:00:0b.0-usb-0:5:1.0-scsi-0:0:0:0-part1' to '../../sdb1'
Sep 27 15:29:18 server udevd-event[20284]: udev_node_symlink: creating symlink '/dev/disk/by-path/pci-0000:00:0b.0-usb-0:5:1.0-scsi-0:0:0:0-part1' to '../../sdb1'
Sep 27 15:29:18 server udevd-event[20284]: udev_node_add: creating symlink '/dev/disk/by-uuid/5B89-39B2' to '../../sdb1'
Sep 27 15:29:18 server udevd-event[20284]: udev_node_symlink: creating symlink '/dev/disk/by-uuid/5B89-39B2' to '../../sdb1'
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/sbin/multipath -v0 8:17'
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/sbin/multipath' returned with status 1
Sep 27 15:29:18 server udevd-event[20284]: pass_env_to_socket: passed -1 bytes to socket '/org/kernel/udev/monitor',
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/lib/udev/udev_run_hotplugd'
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/lib/udev/udev_run_hotplugd' returned with status 0
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/lib/udev/udev_run_devd'
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/lib/udev/udev_run_devd' returned with status 0
Sep 27 15:29:18 server udevd-event[20284]: pass_env_to_socket: passed 706 bytes to socket '/org/freedesktop/hal/udev_event',
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/sbin/pam_console_apply /dev/sdb1 /dev/disk/by-id/usb-Generic_USB_SD_Reader_2004888-part1 /dev/disk/by-path/pci-0000:00:0b.0-usb-0:5:1.0-scsi-0:0:0:0-part1 /dev/disk/by-uuid/5B89-39B2'
Sep 27 15:29:18 server udevd-event[20284]: run_program: '/sbin/pam_console_apply' returned with status 0
Sep 27 15:29:18 server udevd-event[20284]: udev_event_run: seq 2545 finished
Sep 27 15:29:18 server udevd[519]: udev_done: seq 2545, pid [20284] exit with 1, 0 seconds old
all this is fine, but i don't see that the actual matching occurs correctly. And, as a confirmation, i don't see /dev/cardreader/sd to be created at all.

Last edited by DBabo; 09-27-2009 at 02:38 PM.
 
Old 09-27-2009, 09:26 PM   #18
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Ok, cool. Looks like you're on the right track. I am going to make a couple suggestions here, some of which you may already know, and maybe some that will help otherwise anyway.

1) Make sure that after editing any of your udev rules files and saving it, you do a couple things:
First, restart udevd and/or tell it to reload the rules, so it picks up your change(s).
Second, give the command to udevd to freshly, forcefully repopulate the /dev directory. You need to force it to do this, or otherwise it won't refresh everything in there.

The basic routine for your testing should be something like follows:

0-- open a file manager to the /dev directory where you expect your new node to appear, so you can watch.
1-- start the udev monitor;
2-- plug in the card;
3-- if you see your new node appear (might need to refresh the file browser), and the monitor shows your rule being applied, then you're done!
4-- if not, unplug the card and continue to step #5
5-- edit your rule + save the file; reload the rules; give udev the force-reload command, repeat from step #2

So, if you didn't do the above, try it again with your rule as is.

Now about the rule you made (here's yours:)
Code:
SUBSYSTEM=="block",BUS=="scsi",KERNEL=="sd[a-z]",SYSFS{model}=="USB SD Reader   ",SYSFS{vendor}=="Generic ",SYSFS{rev}=="1.00",NAME{all_partitions}="cardreader/SD",GROUP="plugdev"
When you're selecting items from the output of udevinfo -a -p `udevinfo -q path -n /dev/sdb1` to use in your rule, I have found that selecting items from only ONE of the chunks of information, is necessary. Even though udevinfo says you can select stuff from the device, PLUS one parent device, I suggest you remove a couple items to simplify the rule. Basically use only enough items to guarantee to match the correct device. If you look at the rule(s) I showed earlier that I made for my cardreader, you see I only used 4 items:
Code:
SUBSYSTEMS=="scsi",ATTRS{vendor}=="Generic ",ATTRS{model}=="USB SD Reader   ",ATTRS{rev}=="1.00",NAME{all_partitions}="card-reader-SD",GROUP="plugdev"
Also, notice the bold part above. See how "SUBSYSTEMS" is pluralized, even though it is NOT pluralized in the udevinfo output? If I remember right, that means the rule can match the EXACT subsystem, or another subsystem along the chain of parent devices. (It's been a while, so I may be slightly off about this exact meaning, but no matter, hang in there for a moment.) Also, the udev rule items OTHER THAN the sysfs items, for some reason, are not (in my experience) verbatim of what comes out of udevinfo which leads to confusion. What I mean is, in my own rule for example, where I match for "SUBSYSTEMS" was actually either "SUBSYSTEM" or "BUS" in the udevinfo output. I don't know why none of the docs tell us this; maybe they have been updated since I went through all this, but they were misleading at the time, even the tutorial I linked to earlier, was not exactly correct; I had to frig around a lot to get it to work.

Anyhow, let's try making your rule more like mine (a tiny bit simpler, and with an adjustment to the SUBSYSTEM line) and see what happens; after all, your device is nearly identical to mine. Try this (I'm going to break this line in half or so, for readability on this forum page, but don't do that in real life):
Code:
SUBSYSTEMS=="scsi",ATTRS{vendor}=="Generic ",ATTRS{model}=="USB SD Reader   ",
ATTRS{rev}=="1.00",NAME{all_partitions}="cardreader/SD",GROUP="plugdev"
So I've removed the match for "KERNEL==" and changed "BUS" to "SUBSYSTEMS".

If you'd try that out, following the steps 0-6 above, and see what happens :)

NOTE: I'm not sure exactly the udev commands are for "restart" or "reload rules', or for how to "force-reload" on your system, so you'll have to check the man page or some documentation specific to your distro.

Also, if you continue to have difficulty, I will grab the SD card out of my camera (it's the only card I have here) and I will go through the whole procedure on my Slack 11 OS and show you all the outputs and stuff as I do it, so you can see exactly how I get the info for my rules, and what it was called in `udevinfo` vs. what it's called in the rule.

Good luck!
Sasha
 
Old 09-28-2009, 02:00 PM   #19
DBabo
Member
 
Registered: Feb 2003
Distribution: Fedora {latest}
Posts: 568

Original Poster
Rep: Reputation: 40
Sasha,
I think it's about the time to bring more details about my system into this discussion: I'm running centos 5,kernel 2.6.18-164.el5 #1 SMP. Udev (rpm) is udev-095-14.20.el5_3.
the man for udev does NOT list the "SUBSYSTEMS" as a parameter, only "SUBSYSTEM". messages also indicate that SUSBYSTEM IS not valid key:
Code:
server udevd[21900]: add_to_rules: unknown key 'SUBSYSTEMS'
you might want to check the version - we may have different ones installed.

the udevmonitor shows:
Code:
UEVENT[1254162939.319888] remove@/block/sdb/sdb1
UDEV  [1254162939.356875] remove@/block/sdb/sdb1
UEVENT[1254162943.859751] add@/block/sdb/sdb1
UDEV  [1254162944.289609] add@/block/sdb/sdb1
its not clear what rules if any applied to the sdb1.
I also restarted the udev by running start_udev.
and with the following rule :
Code:
# SD reader
KERNEL=="sd[a-z]",SUBSYSTEM=="block",BUS=="scsi",SYSFS{rev}=="1.00",SYSFS{model}=="USB SD Reader   ",SYSFS{vendor}=="Generic ",NAME{all_partitions}="cardreader/SD"
I'm getting :
Code:
ls -l /dev/cardre*
brw-r----- 1 root disk 8, 17 Sep 28 14:50 /dev/cardreader1
brw-r----- 1 root disk 8, 26 Sep 28 14:50 /dev/cardreader10
brw-r----- 1 root disk 8, 27 Sep 28 14:50 /dev/cardreader11
brw-r----- 1 root disk 8, 28 Sep 28 14:50 /dev/cardreader12
brw-r----- 1 root disk 8, 29 Sep 28 14:50 /dev/cardreader13
brw-r----- 1 root disk 8, 30 Sep 28 14:50 /dev/cardreader14
brw-r----- 1 root disk 8, 31 Sep 28 14:50 /dev/cardreader15
brw-r----- 1 root disk 8, 18 Sep 28 14:50 /dev/cardreader2
brw-r----- 1 root disk 8, 19 Sep 28 14:50 /dev/cardreader3
brw-r----- 1 root disk 8, 20 Sep 28 14:50 /dev/cardreader4
brw-r----- 1 root disk 8, 21 Sep 28 14:50 /dev/cardreader5
brw-r----- 1 root disk 8, 22 Sep 28 14:50 /dev/cardreader6
brw-r----- 1 root disk 8, 23 Sep 28 14:50 /dev/cardreader7
brw-r----- 1 root disk 8, 24 Sep 28 14:50 /dev/cardreader8
brw-r----- 1 root disk 8, 25 Sep 28 14:50 /dev/cardreader9

/dev/cardreader:
total 0
brw-r----- 1 root disk 8, 16 Sep 28 14:55 SD
brw-r----- 1 root disk 8, 17 Sep 28 14:55 SD1
brw-r----- 1 root disk 8, 26 Sep 28 14:55 SD10
brw-r----- 1 root disk 8, 27 Sep 28 14:55 SD11
brw-r----- 1 root disk 8, 28 Sep 28 14:55 SD12
brw-r----- 1 root disk 8, 29 Sep 28 14:55 SD13
brw-r----- 1 root disk 8, 30 Sep 28 14:55 SD14
brw-r----- 1 root disk 8, 31 Sep 28 14:55 SD15
brw-r----- 1 root disk 8, 18 Sep 28 14:55 SD2
brw-r----- 1 root disk 8, 19 Sep 28 14:55 SD3
brw-r----- 1 root disk 8, 20 Sep 28 14:55 SD4
brw-r----- 1 root disk 8, 21 Sep 28 14:55 SD5
brw-r----- 1 root disk 8, 22 Sep 28 14:55 SD6
brw-r----- 1 root disk 8, 23 Sep 28 14:55 SD7
brw-r----- 1 root disk 8, 24 Sep 28 14:55 SD8
brw-r----- 1 root disk 8, 25 Sep 28 14:55 SD9
if you recall i have only one partition on the sdb -sdb1. so why exactly am i getting bunch of cardreader entries in the /dev and why an i getting tons of entries under /cardreader/SD - i'm not clear.
UPDATE:
RTFM! all_partitions creates all possible partitions. doh.
all right then, i understand all SD[number], but not sure about the cardreader[number] entries.

now, i changed the rules to :
Code:
# SD reader
KERNEL=="sd[a-z]",SUBSYSTEM=="block",BUS=="scsi",SYSFS{rev}=="1.00",SYSFS{model}=="USB SD Reader   ",SYSFS{vendor}=="Generic ",SYMLINK+="cardreader/SD", OPTIONS="all_partitions"
and well it hang the machine for starters , but after reboot i can see only sdb[numbers] and a single cardreader/SD ->/dev/sdb been created. no partitions - SD[number].. hmmm

I want to have sdb{numbers} and appropriate symlinks (/cardreader/sd{numbers}).
any clues, please?
Andrew

Last edited by DBabo; 09-28-2009 at 03:43 PM.
 
Old 09-28-2009, 04:06 PM   #20
DBabo
Member
 
Registered: Feb 2003
Distribution: Fedora {latest}
Posts: 568

Original Poster
Rep: Reputation: 40
here is the final rule that seemed to satisfy me:
Code:
 SD reader
KERNEL=="sd[a-z][0-9]",SUBSYSTEM=="block",BUS=="scsi",SYSFS{rev}=="1.00",SYSFS{model}=="USB SD Reader   ",SYSFS{vendor}=="Generic ",NAME{all_partitions}="%k",SYMLINK+="cardreader/SD%n"
this produces all sdb[partition] entires and corresponding links :
Code:
ls -l /dev/cardre*
total 0
lrwxrwxrwx 1 root root 6 Sep 28 16:28 CF -> ../sdc
lrwxrwxrwx 1 root root 6 Sep 28 16:28 MS -> ../sde
lrwxrwxrwx 1 root root 7 Sep 28 16:55 SD1 -> ../sdb1
lrwxrwxrwx 1 root root 7 Sep 28 16:55 SD2 -> ../sdb2
lrwxrwxrwx 1 root root 6 Sep 28 16:28 SM -> ../sdd
[oracle@server ~]$ ls -l /dev/sdb*
brw-r----- 1 root disk 8, 16 Sep 28 16:55 /dev/sdb
brw-r----- 1 root disk 8, 17 Sep 28 16:55 /dev/sdb1
brw-r----- 1 root disk 8, 26 Sep 28 15:23 /dev/sdb10
brw-r----- 1 root disk 8, 17 Sep 28 16:47 /dev/sdb11
brw-r----- 1 root disk 8, 28 Sep 28 15:23 /dev/sdb12
brw-r----- 1 root disk 8, 29 Sep 28 15:23 /dev/sdb13
brw-r----- 1 root disk 8, 30 Sep 28 15:23 /dev/sdb14
brw-r----- 1 root disk 8, 31 Sep 28 15:23 /dev/sdb15
brw-r----- 1 root disk 8, 18 Sep 28 16:55 /dev/sdb2

... skip ...
the disadvantage of this rule - [DEL]i can't do a straight mount [/DEL]- i would have to create several lines in fstab for each of the partitions, but i'm not too concern. i prefer to have a clear understanding of how many partitions i have available on a card. I guess it's a matter of personal preference.

SUMUP:
1. i won't be able to get through this without Sasha's and help.
2. post #2 has a good guide. I also used this and Drake's article. Man pages were helpful since they have a correct, up-to-date information.
3. note the kernel and rpm version of the software used : 2.6.18-164.el5, udev-095-14.20.el5_3. It's all "stock" no mods were done.
4. It appears that presence (in memory) of all 3 modules - ehci_hcd, uhci_hcd and ohci_hcd leads to odd behavior - inserted card is not detected by udev. At this point the following sequence of steps seemed to (partially) eliminate the problem - start with unload all 3 modules. Load ehci first and ohci after it. The only functionality that will be lost is in XWindow - no pop-ups asking what to do with a new media.

I think that's all
thank you!
Andrew

Last edited by DBabo; 09-29-2009 at 12:03 PM. Reason: incorrect statement about ehcd module. updated.
 
Old 09-28-2009, 05:16 PM   #21
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Hi Andrew,

First: yes, I was pretty sure the whole time, that our udev versions were different; that's why I suggested that if you still were having troubles, that I would boot up my Slack11 system and run through the rule generation again, because that installation has a udev version that is much closer to the one you are running, and it would hopefully have the same commands & tools at its disposal. On my NEW system here, I'm running a waay newer version of udev, which as we have seen, is fairly different.

Udev has gone through a lot of changes and maturity during its lifetime, so versions definitely tend to differ from one another. Of course, these differences happen everywhere, including the RULES, and the associated tools in /sbin that come with udev.
-------------
Now, I may just be repeating stuff from your last 2 posts, but bear with me (I think you pretty much have a good grip on all this by now ) as I just want to hopefully clarify both for myself, and for you, AND for some other unfortunate soul who finds themselves here and can't make heads nor tails of what's going on:

In my situation, I didn't use the "symlink" option, so I don't get all the /dev/sd** items, I only get my cardreader* items in /dev/.

You did use the symlink option; that's why you're getting both cardreader* items AND sd** items in /dev. Since in your rule, you use %k in your NAME{all partitions}, this makes all the nodes have the same name as what the kernel calls them (sd**). Your symlink statement then causes creation of the /dev/cardreader* items.

Now, regarding your post#20 - a couple questions:

1) I don't understand what you mean: "I can't do a straight mount" -- can you explain that? If you have an fstab entry that corresponds to the partition(s) on the card, you can do either a mount in the console like:

shell# mount /dev/cardreader1
or
shell# mount /dev/sdb1

or you can mount the card using your file manager. Do some of these methods not work?

--

2) The fact that NAME{all partitions} produces 16 device nodes, does not necessarily mean that your card has 16 partitions on it. It just means that if there WERE as many as 16 partitions, you would automatically have a node for each one. I think 16 is a default set by something somewhere, and likely it could be changed if need be. by default though, there's a good chance that your card has only one partition. (Of course I can be wrong here -- I really don't know much about what kind of card you're using, so I'm just speculating, based on the way my own camera card is partitioned.)

Kind regards,
Sasha
 
Old 09-28-2009, 06:32 PM   #22
DBabo
Member
 
Registered: Feb 2003
Distribution: Fedora {latest}
Posts: 568

Original Poster
Rep: Reputation: 40
Sasha,
#1 :
I updated the post #20. - my wording was not clear. Hope updated version is better.
#2 :
i agree with you - 16 is default. Actually, if you take a closer look you will see that symlinks are created only for existing partitions. I think it's pretty cool. as you can see from the example above - i have 2 partitions on that card ( cannon memory card SDC-16, 16M). originally i had only one partition, but for testing i changed that to 2, to see if it will create additional SD link.

Andrew

Last edited by DBabo; 09-28-2009 at 06:49 PM.
 
Old 09-28-2009, 09:29 PM   #23
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Quote:
4. Initially i had a problem with udev not reacting to the inserted card due to presence of ehci_hcd module - do NOT load it.
The above quote is interesting! Does that module still cause a problem with your situation? Good work at discovering it.

Quote:
I updated the post #20. - my wording was not clear. Hope updated version is better.
Yes, I understand now thanks for the clarification. With the fstab entries, you can mount more easily, but you still can do a manual mount in a console, if you should need to mount maybe to a different mount-point or something.

Quote:
Actually, if you take a closer look you will see that symlinks are created only for existing partitions.
I had not noticed that, nor did I know that So there you go, I learned something here too (probably more than just *something* in fact) -- ahhh, the never-ending wonders of Linux!

Hopefully you will have little or no trouble from here on; and this thread will definitely be of help to others .

Nice work & congrats!

PS - If I can help any further, I check my subscribed threads regularly to see what's happening here if/when you update this thread.

Best regards,
Sasha
 
Old 09-28-2009, 10:01 PM   #24
DBabo
Member
 
Registered: Feb 2003
Distribution: Fedora {latest}
Posts: 568

Original Poster
Rep: Reputation: 40
Quote:
Originally Posted by GrapefruiTgirl
The above quote is interesting! Does that module still cause a problem with your situation? Good work at discovering it.
Yes, it does. that's the reason why i mantioned it in the sumup. It was confusing - devices were identified and appropriate dev entries were created, but media is not detected.

Quote:
Nice work & congrats!

PS - If I can help any further, I check my subscribed threads regularly to see what's happening here if/when you update this thread.
Thank you! I think i've got what i wanted. finally got to learn what the udev actually is %)
Thank you!
Andrew
 
Old 09-28-2009, 10:11 PM   #25
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Excellent

All the best,

Sasha
 
Old 10-04-2009, 11:06 AM   #26
Angryguy
LQ Newbie
 
Registered: Jun 2004
Posts: 8

Rep: Reputation: 0
Question ID 058f:6377 Alcor Micro Corp. Multimedia Card Reader

I recently bought a similar reader and stumbled across this informative thread. It's also an Alcor, but a slightly different model - ID 058f:6377 Alcor Micro Corp. Multimedia Card Reader. Unfortunately, I still haven't been able to get it to mount, and am close to considering returning it to MicroCenter.

Like DBabo's original post, my device shows up but cannot be mounted. fdisk -l does not list the card. Unlike him though, even if I leave the card in the reader when I reboot, I still cannot mount it.

This one also includes a USB port on it, which is mostly useless, except as proof that the device is not setup correctly. If I insert an old USB Flash Drive into a normal USB port, it works and automounts immediately. If I insert it into the MMC's extra port, nothing happens.

Your comment about uhci_hcd was interesting. I followed your advice and tried removing all three modules, and only re-adding ehci and ohci, but no change. I still have no results when inserting/removing an SD card, microSD card, or even a flash drive from the MMC reader with udev running. As a sanity check, I did confirm that I get output when plugging a flash drive into a real USB port.

Am I missing something?

Thanks,
- David



Dmesg shows:
Code:
[  114.652021] usb 4-5: reset high speed USB device using ehci_hcd and address 3
[  114.900519] usb 4-5: reset high speed USB device using ehci_hcd and address 3
[  125.152021] usb 4-5: reset high speed USB device using ehci_hcd and address 3
[  125.286829] sd 9:0:0:0: Device offlined - not ready after error recovery
[  125.286870] sd 9:0:0:0: rejecting I/O to offline device
[  125.286879] sd 9:0:0:0: rejecting I/O to offline device
[  125.286884] sd 9:0:0:0: rejecting I/O to offline device
[  125.286887] sd 9:0:0:0: [sdc] READ CAPACITY failed
[  125.286889] sd 9:0:0:0: [sdc] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK,SUGGEST_OK
[  125.286893] sd 9:0:0:0: [sdc] Sense not available.
[  125.286897] sd 9:0:0:0: rejecting I/O to offline device
[  125.286902] sd 9:0:0:0: [sdc] Write Protect is off
[  125.286903] sd 9:0:0:0: [sdc] Mode Sense: 00 00 00 00
[  125.286905] sd 9:0:0:0: [sdc] Assuming drive cache: write through
[  125.287007] sd 9:0:0:0: [sdc] Attached SCSI removable disk
[  125.287121] sd 9:0:0:0: Attached scsi generic sg3 type 0
[  125.291448] sd 9:0:0:1: [sdd] Attached SCSI removable disk
[  125.291566] sd 9:0:0:1: Attached scsi generic sg4 type 0
[  125.293446] sd 9:0:0:2: [sde] Attached SCSI removable disk
[  125.293560] sd 9:0:0:2: Attached scsi generic sg5 type 0
[  125.294927] sd 9:0:0:3: [sdf] Attached SCSI removable disk
[  125.295044] sd 9:0:0:3: Attached scsi generic sg6 type 0
[  125.298948] sd 9:0:0:4: [sdg] Attached SCSI removable disk
[  125.299062] sd 9:0:0:4: Attached scsi generic sg7 type 0
Other output:
Code:
cat /proc/scsi/sg/device_strs
^Croot@myth-tv:/mnt# cat /proc/scsi/sg/device_strs
ATA     	WDC WD5000AAKS-0	12.0
HL-DT-ST	BDDVDRW GGC-H20L	1.03
ATA     	WDC WD10EACS-00D	01.0
Generic 	USB SD Reader   	1.00
Generic 	USB CF Reader   	1.01
Generic 	USB SM Reader   	1.02
Generic 	USB MS Reader   	1.03
Generic 	Mini SD Reader  	1.06
root@myth-tv:/mnt# cat /proc/scsi/usb-storage/4
cat: /proc/scsi/usb-storage/4: No such file or directory
root@myth-tv:/mnt# cat /proc/scsi/usb-storage/11 
   Host scsi11: usb-storage
       Vendor: Generic
      Product: Mass Storage Device
Serial Number: 058F412D8PB1
     Protocol: Transparent SCSI
    Transport: Bulk
       Quirks:
root@myth-tv:/mnt# lsusb
Bus 004 Device 005: ID 058f:6377 Alcor Micro Corp. Multimedia Card Reader
...
Executing udevinfo -a -p `udevinfo -q path -n /dev/sdc` shows a device with the "SD Reader" name, however there is no sdc1.

I've started looking through the udev rules your talking about, which I'm sure I will need, but I don't expect that to lead me anywhere until I can at least get it to mount manually.


System: MythBuntu 9.04 x64
 
Old 12-25-2009, 06:33 PM   #27
DBabo
Member
 
Registered: Feb 2003
Distribution: Fedora {latest}
Posts: 568

Original Poster
Rep: Reputation: 40
David,
maybe the unit is defective? I don't like that
Code:
[  125.286829] sd 9:0:0:0: Device offlined - not ready after error recovery
[  125.286870] sd 9:0:0:0: rejecting I/O to offline device
Merry Christmas!
 
Old 12-25-2009, 09:53 PM   #28
Angryguy
LQ Newbie
 
Registered: Jun 2004
Posts: 8

Rep: Reputation: 0
I was wondering about that line to ...

I'm not certain what, if anything, I did, but I did eventually get it to work. I think the combination of a Kernel update, and cleaning the case and reconnecting the port made the difference. Though even after that, it didn't work immediately, but then suddenly started working a week later if I remember correctly.

Happy Holidays and thanks for the response (better late then never as I always say :-)

Last edited by Angryguy; 12-25-2009 at 09:54 PM.
 
Old 12-06-2013, 08:06 PM   #29
Norseman01
Member
 
Registered: Nov 2012
Posts: 85

Rep: Reputation: Disabled
Quote:
Originally Posted by DBabo View Post
Hello,
i have Acer AST160 with the 2.6.18-164.el5 #1 SMP stock kernel, running CentOs 5.2.
Acer comes with FC51GM motherboard and 5-1 ( or 7-1?) card reader. I never tried to get it to work under linux, but i do recall that it worked under windows back 3 years ago.
For the purpose of this execrsise i'm trying to access the Cannon SD Memory Card SDC-16M.
This is what i see in the messages:

Code:
Sep 19 19:07:45 server kernel: Initializing USB Mass Storage driver...
Sep 19 19:07:45 server kernel: scsi4 : SCSI emulation for USB Mass Storage devices
Sep 19 19:07:45 server kernel: usbcore: registered new driver usb-storage
Sep 19 19:07:45 server kernel: USB Mass Storage support registered.
Sep 19 19:07:45 server kernel:   Vendor: Generic   Model: USB SD Reader     Rev: 1.00
Sep 19 19:07:45 server kernel:   Type:   Direct-Access                      ANSI SCSI revision: 00
Sep 19 19:07:45 server kernel: sd 4:0:0:0: Attached scsi removable disk sdb
Sep 19 19:07:45 server kernel:   Vendor: Generic   Model: USB CF Reader     Rev: 1.01
Sep 19 19:07:45 server kernel:   Type:   Direct-Access                      ANSI SCSI revision: 00
Sep 19 19:07:45 server kernel: sd 4:0:0:1: Attached scsi removable disk sdc
Sep 19 19:07:45 server kernel:   Vendor: Generic   Model: USB SM Reader     Rev: 1.02
Sep 19 19:07:45 server kernel:   Type:   Direct-Access                      ANSI SCSI revision: 00
Sep 19 19:07:45 server kernel: sd 4:0:0:2: Attached scsi removable disk sdd
Sep 19 19:07:45 server kernel:   Vendor: Generic   Model: USB MS Reader     Rev: 1.03
Sep 19 19:07:45 server kernel:   Type:   Direct-Access                      ANSI SCSI revision: 00
Sep 19 19:07:45 server kernel: sd 4:0:0:3: Attached scsi removable disk sde
Sep 19 19:07:45 server kernel: device-mapper: uevent: version 1.0.3
fdisk -l doesn't reveal any devices from the above.

cat /proc/scsi/usb-storage/4
Code:
cat /proc/scsi/usb-storage/4
   Host scsi4: usb-storage
       Vendor:
      Product: USB Reader
Serial Number: 2004888
     Protocol: Transparent SCSI
    Transport: Bulk
       Quirks:
cat /proc/scsi/sg/device_strs
Code:
ATA             ST3160812AS             3.AA
Generic         USB SD Reader           1.00
Generic         USB CF Reader           1.01
Generic         USB SM Reader           1.02
Generic         USB MS Reader           1.03
so it seems that the system recognizes the device - the reader.
if i plug any ( and i have a few ) of cards - no messages are generated in the /var/log and i can't mount any of the sd* devices. I do have one HD that is mapped to sda and it works just fine. I also have the USB KVM that gets recognized and also works fine.
Please advise.
Thank you
-------------------------------
OK, Ten+ years later.
Linux reports present and account for.
16Meg or 16Gig Cannon chip?
FIRST - can your hardware handle a 16G chip? Check your manual! Old ones DO NOT!

"...can't mount any of the sd*..."
Do you have factory drivers for the hardware? gotta ask, may not be needed.
If the USB is present it may be assigned sdb
If so the Card reader should start as sdc and if a SDCard is present it would
. be mounted by mount /dev/sdc1 /mnt/sdc1 (or where_ever you choose)
. test rest of chip types (if you can) and see if they are sdd, sde...
Chip has to be inserted to be tested. IF they are not sdc, sdd... you will need
. the factory driver(s) for Linux. Linux considers each port a separate drive so
. it can use partition numbers within the chip if present.

Of special note: Case: Used SD Card and it worked fine as sdb1 yesterday.
. Fired up today and put a MS Chip in, only one there.
. IT WILL BE SDB and is to be mounted sdb1 and so forth.
. First come - First served!!!
The order of attachment usually controls the assigned designation.
Depending on specific Linux OS (distros do make tweeks) if the USBs attached
change with order then the same happens with the device in question. Some tweeks
assign ..b ..c ..d to the ports in the order of usage and retain it for the
duration of the System Up time. ie... turn it off and next on can be different
designations to same ports. Mine assigns b->whatever on first served basis and
next device the next in sequence UNLESS I unplug the ..b BEFORE plugging in another
device in any port. If ..b is present and ..c added and ..b then removed,
then ..d will be next attached. Even if I plug in the just was ..b (even to the
same port it was just in) it gets to be the ..d Keep that in mind.
And YES - It plays havoc with scripts!
If scripts are used, they need to use Vol.IDs to avoid screw ups.
How do I do that? Another subject. Another time. It does work and work well.

Norseman01
 
  


Reply

Tags
acer, centos, ehcihcd, udev



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Get Card Reader to Work In Ubuntu 7.10 taurusx5 Linux - Software 1 03-13-2008 08:40 AM
How to Get Card Reader to Work In Ubuntu 7.10 taurusx5 Linux - Software 1 03-11-2008 11:12 PM
Getting SD card reader to work ratsm Linux - Hardware 1 10-31-2006 06:46 PM
card reader wont work rahilrai Linux - Newbie 1 03-13-2006 07:56 AM
card reader doesn't work jerryluis Mandriva 0 06-22-2004 02:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration