bardo <[EMAIL PROTECTED]>:
>2006/9/28, Mister Dobalina <[EMAIL PROTECTED]>:
>> http://www.reactivated.net/writing_udev_rules.html
>
>Thanks, very interesting. I solved the fstab problem with the LABEL
>trick. but this reading was illuminating.
>
>> for tips on writing your own udev rules. You can use
>> the info returned by
>>
>> udevinfo -a -p /sys/block/XXX
>>
>> to write rules to force udev to call your root disk
>> /dev/hdc (or whatever you want...)
>
>Tried, I can't make it work. These two are the ones I use:
>SUBSYSTEM=="block", ATTR{size}=="160086528", NAME="hda"
>SUBSYSTEM=="block", ATTR{size}=="361882080", NAME="hdb"
>
>They are of no use, and the cdrom gets recognized as hda...

I think using "size" isn't a good idea. It would be more readable at least 
if you use parent device attributes.
For example for my cdrom udevinfo gives this:

  looking at device '/block/sr0':
    KERNEL=="sr0"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{stat}=="       0        0        0        0        0        0        0 
       0        0        0        0"
    ATTR{size}=="2097151"
    ATTR{removable}=="1"
    ATTR{range}=="1"
    ATTR{dev}=="11:0"

  looking at parent device 
'/devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0':
    KERNELS=="1:0:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS=="sr"
    ATTRS{ioerr_cnt}=="0x0"
    ATTRS{iodone_cnt}=="0x7"
    ATTRS{iorequest_cnt}=="0x26"
    ATTRS{iocounterbits}=="32"
    ATTRS{timeout}=="0"
    ATTRS{state}=="running"
    ATTRS{rev}=="TO38"
    ATTRS{model}=="CDW/DVD TS-L462A"
    ATTRS{vendor}=="TSSTcorp"
    ATTRS{scsi_level}=="6"
    ATTRS{type}=="5"
    ATTRS{queue_type}=="none"
    ATTRS{queue_depth}=="1"
    ATTRS{device_blocked}=="0"

and for my laptop disk:

  looking at device '/block/sda':
    KERNEL=="sda"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{stat}=="    8892      464   246167   334260     6295     9111   123192 
 1504228        0   232452  1838488"
    ATTR{size}=="78140160"
    ATTR{removable}=="0"
    ATTR{range}=="16"
    ATTR{dev}=="8:0"

  looking at parent device 
'/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0':
    KERNELS=="0:0:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS=="sd"
    ATTRS{ioerr_cnt}=="0x0"
    ATTRS{iodone_cnt}=="0x3b60"
    ATTRS{iorequest_cnt}=="0x3b60"
    ATTRS{iocounterbits}=="32"
    ATTRS{timeout}=="30"
    ATTRS{state}=="running"
    ATTRS{rev}=="MA2O"
    ATTRS{model}=="HTS424040M9AT00 "
    ATTRS{vendor}=="ATA     "
    ATTRS{scsi_level}=="6"
    ATTRS{type}=="0"
    ATTRS{queue_type}=="none"
    ATTRS{queue_depth}=="1"
    ATTRS{device_blocked}=="0"



So for example I think I could use something like this:

SUBSYSTEMS=="scsi", ATTRS{model}=="CDW/DVD TS-L462A", 
ATTRS{vendor}=="TSSTcorp", NAME:="hdb", SYMLINK+="toshiba_cdrw"

SUBSYSTEMS=="scsi", ATTRS{rev}=="MA2O", ATTRS{model}=="HTS424040M9AT00 ", 
NAME:="hda", SYMLINK+="toshiba_hd"


Also it's important where you put your rules. If yu use "=" to change dev name 
you should create a file for your custom rules which will be processed as the 
last 
one - for example x10.special.udev.rules. 

If you use ":=" it should work from any file (because standard udev rules
use only "=" but it's safer to create a file named like 00.special.udev rules 
which
will be processed by udev as the first one. 

":=" means that no other rule processed after your custom rule can overwrite 
your 
values (becasue udev first aggregates all rules for a given device and some 
values 
- in your case NAME - can be changed). Using ":=" prevents changing the value 
only 
for this field and udev will still process other rules for this device 
generating for 
example some standard symlinks. 

If you want to stop processing rules after your custom rule (which forces the 
use 
of 00....udev.rules naming) you can add OPTIONS="last_rule" to your custom rule.
This means only your custom rules will be processed (no standard symlinks etc.)

For the begining I would recommend creating 00.special.udev.rules file and 
use ":=" syntax.

I hope it'll work for you. 

-- 
Rafal Szczepaniak (lanrat)

_______________________________________________
arch mailing list
[email protected]
http://www.archlinux.org/mailman/listinfo/arch

Reply via email to