Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[udev] Nommage de périphériques
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index French
View previous topic :: View next topic  
Author Message
guilc
Bodhisattva
Bodhisattva


Joined: 15 Nov 2003
Posts: 3326
Location: Paris - France

PostPosted: Tue Mar 16, 2004 11:35 am    Post subject: [udev] Nommage de périphériques Reply with quote

Salut,

Je tourne avec udev depuis maintenant quelques temps, et je trouve que ça remplace parfaitement devfs, meme mieux :) Je voudrais donc apasser a l'étape supérieure : namedev

J'ai lu la : http://www.gentoo.org/doc/fr/udev-guide.xml, qu'on peut nommer les périphériques USB en fonction de leur numéro de série, histoire de pas les voir bouger suivant leur ordre de branchement.
Mais voila, ce n'est pas expliqué comment faire, et je ne trouve pas de bon tuto sur le net (ne connaissant pas exactement le truc, je ne mets ptet pas les bon mots clé de recherche...) :(

Une explication, ou le lien qui dit tout ?

Merci :))
_________________
Merci de respecter les règles du forum.

Mon site perso : https://www.xwing.info
Mon PORTDIR_OVERLAY : https://gentoo.xwing.info ou layman -a xwing
Back to top
View user's profile Send private message
sireyessire
Advocate
Advocate


Joined: 20 Mar 2003
Posts: 2991
Location: back in Paris, France

PostPosted: Tue Mar 16, 2004 12:42 pm    Post subject: Reply with quote

cf lien à la fin de cette doc http://www.gentoo.org/doc/en/udev-guide.xml

Quote:
German Udev Primer translation (Thanks to: Alexander Minges) Udev Primer: German

DSD's Guide on how to Write Udev Rules: Writing udev rules.

Right now there is a pretty good Post going at Gentoo Forums on UDEV: Gentoo Forum Thread.

Snippet of How to Write UDev Rules: Using DSD's Guide on how to Write UDEV Rules. Wanted to see how easy it was. So I picked the device most recently working with udev, my Microtek Scanner. Turned out to be very easy.

First I know that my scanner device in /dev is /dev/sg0. Can also use tail -f /var/log/syslog if have debug on hotplug turned on and see something like this:

Feb 25 09:16:17 decibels default.hotplug[18643]: arguments (scsi_generic) env (OLDPWD=/ DEVPATH=/class/scsi_generic/sg0 ...

So using his information I picked out the best none changing identifiers.
bash-2.05b# find | grep sg0
./class/scsi_generic/sg0
./class/scsi_generic/sg0/device
./class/scsi_generic/sg0/dev
./cdev/major/sg0

Based on that response:
bash-2.05b# udevinfo -a -p /sys/class/scsi_generic/sg0

device '/sys/class/scsi_generic/sg0' has major:minor 21:0
looking at class device '/sys/class/scsi_generic/sg0':
SYSFS{dev}="21:0"

follow the class device's "device"
looking at the device chain at '/sys/devices/platform/host0/0:0:0:0':
BUS="scsi" <------ Picked this.
ID="0:0:0:0"
SYSFS{detach_state}="0"
SYSFS{type}="6"
SYSFS{device_blocked}="0"
SYSFS{queue_depth}="1"
SYSFS{scsi_level}="3"
SYSFS{vendor}=" "
SYSFS{model}="Scanner V6UPL " <----- Picked this. Yes, the spaces where there in the name.
SYSFS{rev}="1.00"
SYSFS{online}="1"

looking at the device chain at '/sys/devices/platform/host0':
BUS=""
ID="host0"
SYSFS{detach_state}="0"

looking at the device chain at '/sys/devices/platform':
BUS=""
ID="platform"
SYSFS{detach_state}="0"

Okay, let's see if can use that to make a rule to also call my scanner /dev/sg0 as /dev/scanner .

Appended to the end of /etc/udev/udev.rules: (Tested, don't need to add the spaces at end of model name).
# Microtek Scanner
BUS="scsi", SYSFS{model}="Scanner V6UPL", NAME="%k", SYMLINK="scanner"

I know that my XSane backend is microtek2.conf in /etc/sane.d folder. It looks for a scsi device, so added /dev/scanner to it. And started two scanner programs. Both of them now give me the choice of using /dev/sg0 or /dev/scanner. So works perfect.

What good is this? Well in this instance not much. Mainly an exercise. I mean one is just a symlink to /dev/sg0. But in other cases you might have multiple devices and want to tell which one is which. You can read DSD's Guide for more details. My next goal is to see if can make it replace /dev/sg0 with /dev/scanner. But that is for another day.

More to come...


Enjoy :wink:
_________________
I never think of the future. It comes soon enough.
Albert Einstein

Try simpler first
Shockley
Back to top
View user's profile Send private message
TGL
Bodhisattva
Bodhisattva


Joined: 02 Jun 2002
Posts: 1978
Location: Rennes, France

PostPosted: Tue Mar 16, 2004 12:50 pm    Post subject: Reply with quote

Et toujours dans la doc de Decibel, suivre le lien vers la doc de Daniel Drake vaut le coup : http://www.reactivated.net/udevrules.php
Back to top
View user's profile Send private message
guilc
Bodhisattva
Bodhisattva


Joined: 15 Nov 2003
Posts: 3326
Location: Paris - France

PostPosted: Tue Mar 16, 2004 6:57 pm    Post subject: Reply with quote

Ok, merci :)

J'avais vu ce passage, mais j'avais pas compris que c'était ce que je cherchais :)

Ca marche très bien, a ceci près qu'il est dit que ça marche en enlevant les espaces des chaines de caractères, mais pas chez moi : il faut que je les laisse :)
En tous cas, c'est bien pratique pour faire les points de montage :)

Merci !
_________________
Merci de respecter les règles du forum.

Mon site perso : https://www.xwing.info
Mon PORTDIR_OVERLAY : https://gentoo.xwing.info ou layman -a xwing
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index French 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