LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-27-2006, 01:40 PM   #1
marnold
Member
 
Registered: Dec 2005
Distribution: Slackware64 15.0 Multilib
Posts: 313

Rep: Reputation: 52
Slackware 11, udev, and card readers


I spent the better part of last night trying to convert my udev rules that I wrote for Slackware 10.2 to work with the new udev in Slackware 11/-current. The udev developers were "kind" enough to make some significant changes to the way that rules are written. Hopefully that has stabilized now. At any rate, here are the rules that I have for my 8-in-1 card reader and my USB drive, using the huge26.s kernel:

# Card reader
BUS=="scsi", ID=="*:0", SYSFS{model}=="STORAGE DEVICE ", NAME="compactflash", OPTIONS+="all_partitions"
BUS=="scsi", ID=="*:2", SYSFS{model}=="STORAGE DEVICE ", NAME="securedigital", OPTIONS+="all_partitions"

# USB drive
BUS=="scsi", KERNEL=="sd*", SYSFS{vendor}=="OTi", SYSFS{model}=="Flash Disk", NAME="%k", SYMLINK+="usbdrive"

Now some brief explanation. I only use the compact flash and secure digital slots on my reader, so those are the only rules I set up. The kernel treats each slot as if it were a SCSI drive. I obtained the information on the SCSI ID and model name by using "udevinfo -a -p /sys/block/sda" (sdc for the secure digital slot). The NAME creates a /dev/ node. The OPTIONS makes sure it creates /dev/compactflash[1-15] since the data is actually on the first "partition" for some reason.

Re: the USB drive, in the old udev I just looked for the vendor and model and then used NAME to create the node. That didn't work with the new udev. Instead of basically creating what would normally be /dev/sde, it created /dev/sg4 which wouldn't allow me to mount the drive. So now /dev/sde is still created but with a symbolic link pointing to it at /dev/usbdrive.

True, I could just add /dev/sde to my fstab, but if I would add or remove SCSI devices (or some future udev change would set things up in a different order), it would break. With that rule, /dev/usbdrive will always point to the right place.

I hope somebody might find this useful. Hours of Googling turned up only older rules for older versions of udev. Check out Writing udev Rules for more information. That page is up-to-date for the latest udev.

Last edited by marnold; 09-27-2006 at 01:41 PM.
 
Old 09-27-2006, 01:43 PM   #2
marnold
Member
 
Registered: Dec 2005
Distribution: Slackware64 15.0 Multilib
Posts: 313

Original Poster
Rep: Reputation: 52
I should add that even though the huge26.s kernel does not automatically search for multiple LUNs, adding this line to lilo.conf allows things to work anyway:

append="max_scsi_luns=5"
 
Old 09-27-2006, 03:17 PM   #3
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
I didn't need to make a rule for my usb pen drive - it works fine with whatever the default rule is. That's with udev 097 in slack-current.
 
Old 09-27-2006, 06:01 PM   #4
marnold
Member
 
Registered: Dec 2005
Distribution: Slackware64 15.0 Multilib
Posts: 313

Original Poster
Rep: Reputation: 52
Quote:
Originally Posted by dive
I didn't need to make a rule for my usb pen drive - it works fine with whatever the default rule is. That's with udev 097 in slack-current.
It worked fine with mine too. udev created /dev/sde when I inserted it and I would have been good to go. The only reason I have the rule now is if I add or remove SCSI devices, it would no longer be /dev/sde. For example if I unplugged my card reader, udev would put it as /dev/sda which would then break my fstab entry.
 
Old 09-27-2006, 07:22 PM   #5
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
Ah mine was made sda1 and I have no other usb/scsi devices. I guess that my situation is simpler.
 
  


Reply



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
slackware-current, udev 0.96, and custom udev rules not working rignes Slackware 6 08-10-2006 03:43 AM
flash card / memory card readers and linux? Frelov Linux - Hardware 11 08-02-2006 04:37 PM
Do internal SD card readers (on laptops) work in linux? MasterOfTheWind Linux - Hardware 6 07-14-2006 02:54 AM
Drivers for magnetic card stripe readers Shad034 Programming 3 12-13-2004 07:44 PM
Media card readers Stephanie General 4 02-20-2003 01:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:53 AM.

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