source: chapter07/symlinks.xml@ a7f92a3

7.7-systemd 7.8-systemd 7.9-systemd
Last change on this file since a7f92a3 was a7f92a3, checked in by Krejzi <krejzi@…>, 9 years ago

Use an entity for BLFS URL's.

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/systemd@10818 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 2.7 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-scripts-symlinks">
9 <?dbhtml filename="symlinks.html"?>
10
11 <title>Creating Custom Symlinks to Devices</title>
12
13 <sect2>
14 <title>Dealing with duplicate devices</title>
15
16 <para>As explained in <xref linkend="ch-scripts-udev"/>, the order in
17 which devices with the same function appear in
18 <filename class="directory">/dev</filename> is essentially random.
19 E.g., if you have a USB web camera and a TV tuner, sometimes
20 <filename>/dev/video0</filename> refers to the camera and
21 <filename>/dev/video1</filename> refers to the tuner, and sometimes
22 after a reboot the order changes to the opposite one.
23 For all classes of hardware except sound cards and network cards, this is
24 fixable by creating udev rules for custom persistent symlinks.
25 The case of network cards is covered separately in
26 <xref linkend="ch-scripts-network"/>, and sound card configuration can
27 be found in <ulink url="&blfs-book;postlfs/devices.html">BLFS</ulink>.</para>
28
29 <para>For each of your devices that is likely to have this problem
30 (even if the problem doesn't exist in your current Linux distribution),
31 find the corresponding directory under
32 <filename class="directory">/sys/class</filename> or
33 <filename class="directory">/sys/block</filename>.
34 For video devices, this may be
35 <filename
36 class="directory">/sys/class/video4linux/video<replaceable>X</replaceable></filename>.
37 Figure out the attributes that identify the device uniquely (usually,
38 vendor and product IDs and/or serial numbers work):</para>
39
40<screen role="nodump"><userinput>udevadm info -a -p /sys/class/video4linux/video0</userinput></screen>
41
42 <para>Then write rules that create the symlinks, e.g.:</para>
43
44<screen role="nodump"><userinput>cat &gt; /etc/udev/rules.d/83-duplicate_devs.rules &lt;&lt; "EOF"
45<literal>
46# Persistent symlinks for webcam and tuner
47KERNEL=="video*", ATTRS{idProduct}=="1910", ATTRS{idVendor}=="0d81", \
48 SYMLINK+="webcam"
49KERNEL=="video*", ATTRS{device}=="0x036f", ATTRS{vendor}=="0x109e", \
50 SYMLINK+="tvtuner"
51</literal>
52EOF</userinput></screen>
53
54 <para>The result is that <filename>/dev/video0</filename> and
55 <filename>/dev/video1</filename> devices still refer randomly to the tuner
56 and the web camera (and thus should never be used directly), but there are
57 symlinks <filename>/dev/tvtuner</filename> and
58 <filename>/dev/webcam</filename> that always point to the correct
59 device.</para>
60
61 </sect2>
62
63</sect1>
Note: See TracBrowser for help on using the repository browser.