source: chapter07/symlinks.xml@ f3317d4

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

Move Chapter 7 in place for Systemd.

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/systemd/BOOK@10159 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
15 <title>Dealing with duplicate devices</title>
16
17 <para>As explained in <xref linkend="ch-scripts-udev"/>, the order in
18 which devices with the same function appear in
19 <filename class="directory">/dev</filename> is essentially random.
20 E.g., if you have a USB web camera and a TV tuner, sometimes
21 <filename>/dev/video0</filename> refers to the camera and
22 <filename>/dev/video1</filename> refers to the tuner, and sometimes
23 after a reboot the order changes to the opposite one.
24 For all classes of hardware except sound cards and network cards, this is
25 fixable by creating udev rules for custom persistent symlinks.
26 The case of network cards is covered separately in
27 <xref linkend="ch-scripts-network"/>, and sound card configuration can
28 be found in <ulink url="&blfs-root;view/svn/postlfs/devices.html">BLFS</ulink>.</para>
29
30 <para>For each of your devices that is likely to have this problem
31 (even if the problem doesn't exist in your current Linux distribution),
32 find the corresponding directory under
33 <filename class="directory">/sys/class</filename> or
34 <filename class="directory">/sys/block</filename>.
35 For video devices, this may be
36 <filename
37 class="directory">/sys/class/video4linux/video<replaceable>X</replaceable></filename>.
38 Figure out the attributes that identify the device uniquely (usually,
39 vendor and product IDs and/or serial numbers work):</para>
40
41<screen role="nodump"><userinput>udevadm info -a -p /sys/class/video4linux/video0</userinput></screen>
42
43 <para>Then write rules that create the symlinks, e.g.:</para>
44
45<screen role="nodump"><userinput>cat &gt; /etc/udev/rules.d/83-duplicate_devs.rules &lt;&lt; "EOF"
46<literal>
47# Persistent symlinks for webcam and tuner
48KERNEL=="video*", ATTRS{idProduct}=="1910", ATTRS{idVendor}=="0d81", \
49 SYMLINK+="webcam"
50KERNEL=="video*", ATTRS{device}=="0x036f", ATTRS{vendor}=="0x109e", \
51 SYMLINK+="tvtuner"
52</literal>
53EOF</userinput></screen>
54
55 <para>The result is that <filename>/dev/video0</filename> and
56 <filename>/dev/video1</filename> devices still refer randomly to the tuner
57 and the web camera (and thus should never be used directly), but there are
58 symlinks <filename>/dev/tvtuner</filename> and
59 <filename>/dev/webcam</filename> that always point to the correct
60 device.</para>
61
62 </sect2>
63
64</sect1>
Note: See TracBrowser for help on using the repository browser.