summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-core/udev/files/fix-alignment.patch26
-rwxr-xr-xmeta/recipes-core/udev/files/init212
-rw-r--r--meta/recipes-core/udev/files/local.rules22
-rw-r--r--meta/recipes-core/udev/files/noasmlinkage.patch39
-rw-r--r--meta/recipes-core/udev/files/permissions.rules81
-rw-r--r--meta/recipes-core/udev/files/tmpfs.patch17
-rw-r--r--meta/recipes-core/udev/files/udev.rules98
-rw-r--r--meta/recipes-core/udev/files/udev_network_queue.sh35
-rw-r--r--meta/recipes-core/udev/files/udevsynthesize.patch778
-rw-r--r--meta/recipes-core/udev/files/udevsynthesize.sh51
-rw-r--r--meta/recipes-core/udev/udev-145/enable-gudev.patch50
-rw-r--r--meta/recipes-core/udev/udev-145/init59
-rw-r--r--meta/recipes-core/udev/udev-145/local.rules33
-rw-r--r--meta/recipes-core/udev/udev-145/noasmlinkage.patch50
-rw-r--r--meta/recipes-core/udev/udev-145/permissions.rules131
-rw-r--r--meta/recipes-core/udev/udev-145/run.rules14
-rw-r--r--meta/recipes-core/udev/udev-145/udev.rules116
-rw-r--r--meta/recipes-core/udev/udev-145/unbreak.patch26
-rw-r--r--meta/recipes-core/udev/udev.inc72
-rw-r--r--meta/recipes-core/udev/udev_145.bb55
20 files changed, 0 insertions, 1965 deletions
diff --git a/meta/recipes-core/udev/files/fix-alignment.patch b/meta/recipes-core/udev/files/fix-alignment.patch
deleted file mode 100644
index dfe21b6e96..0000000000
--- a/meta/recipes-core/udev/files/fix-alignment.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1Upstream-Status: Pending
2
3diff --git a/udev_rules_parse.c b/udev_rules_parse.c
4--- a/udev_rules_parse.c
5+++ b/udev_rules_parse.c
6@@ -241,6 +241,7 @@ static int add_to_rules(struct udev_rule
7 int valid;
8 char *linepos;
9 char *attr;
10+ size_t padding;
11 int retval;
12
13 /* get all the keys */
14@@ -506,6 +507,11 @@ static int add_to_rules(struct udev_rule
15
16 /* grow buffer and add rule */
17 rule_size = sizeof(struct udev_rule) + rule->bufsize;
18+ padding = (sizeof(size_t) - rule_size % sizeof(size_t)) % sizeof(size_t);
19+ dbg("add %zi padding bytes", padding);
20+ rule_size += padding;
21+ rule->bufsize += padding;
22+
23 rules->buf = realloc(rules->buf, rules->bufsize + rule_size);
24 if (!rules->buf) {
25 err("realloc failed");
26
diff --git a/meta/recipes-core/udev/files/init b/meta/recipes-core/udev/files/init
deleted file mode 100755
index 8cbab188f0..0000000000
--- a/meta/recipes-core/udev/files/init
+++ /dev/null
@@ -1,212 +0,0 @@
1#!/bin/sh -e
2
3UDEVSTART=/sbin/udevstart
4
5# defaults
6tmpfs_size="10M"
7udev_root="/dev"
8
9[ -x $UDEVSTART ] || exit 0
10
11. /etc/udev/udev.conf
12
13##############################################################################
14
15# we need to unmount /dev/pts/ and remount it later over the tmpfs
16unmount_devpts() {
17 if mountpoint -q /dev/pts/; then
18 umount -l /dev/pts/
19 fi
20
21 if mountpoint -q /dev/shm/; then
22 umount -l /dev/shm/
23 fi
24}
25
26# mount a tmpfs over /dev, if somebody did not already do it
27mount_tmpfs() {
28 if grep -E -q "^[^[:space:]]+ /dev tmpfs" /proc/mounts; then
29 return 0
30 fi
31
32 # /dev/.static/dev/ is used by MAKEDEV to access the real /dev/ directory.
33 # /etc/udev/ is recycled as a temporary mount point because it's the only
34 # directory which is guaranteed to be available.
35 mount -n -o bind /dev /etc/udev
36
37 if ! mount -n -o size=$tmpfs_size,mode=0755 -t tmpfs tmpfs /dev; then
38 umount /etc/udev
39 echo "udev requires tmpfs support, not started."
40 exit 1
41 fi
42
43 # using ln to test if /dev works, because touch is in /usr/bin/
44 if ln -s test /dev/test-file; then
45 rm /dev/test-file
46 else
47 echo "udev requires tmpfs support, not started."
48 umount /etc/udev
49 umount /dev
50 exit 1
51 fi
52
53 mkdir -p /dev/.static/dev
54 chmod 700 /dev/.static/
55 # The mount options in busybox are non-standard...
56 if test -x /bin/mount.util-linux
57 then
58 /bin/mount.util-linux --move /etc/udev /dev/.static/dev
59 elif test -x /bin/busybox
60 then
61 busybox mount -n -o move /etc/udev /dev/.static/dev
62 else
63 echo "udev requires an identifiable mount command, not started."
64 umount /etc/udev
65 umount /dev
66 exit 1
67 fi
68}
69
70# I hate this hack. -- Md
71make_extra_nodes() {
72 [ -e /etc/udev/links.conf ] || return 0
73 grep '^[^#]' /etc/udev/links.conf | \
74 while read type name arg1; do
75 [ "$type" -a "$name" -a ! -e "/dev/$name" -a ! -L "/dev/$name" ] ||continue
76 case "$type" in
77 L) ln -s $arg1 /dev/$name ;;
78 D) mkdir -p /dev/$name ;;
79 M) mknod -m 600 /dev/$name $arg1 ;;
80 *) echo "links.conf: unparseable line ($type $name $arg1)" ;;
81 esac
82 done
83}
84
85# this function is duplicated in preinst, postinst and d-i
86supported_kernel() {
87 case "$(uname -r)" in
88 2.[012345].*|2.6.[0-9]|2.6.[0-9][!0-9]*) return 1 ;;
89 2.6.1[01]|2.6.1[01][!0-9]*) return 1 ;;
90 esac
91 return 0
92}
93
94# shell version of /usr/bin/tty
95my_tty() {
96 [ -x /bin/readlink ] || return 0
97 [ -e /proc/self/fd/0 ] || return 0
98 readlink --silent /proc/self/fd/0 || true
99}
100
101warn_if_interactive() {
102 if [ "$RUNLEVEL" = "S" -a "$PREVLEVEL" = "N" ]; then
103 return 0
104 fi
105
106 TTY=$(my_tty)
107 if [ -z "$TTY" -o "$TTY" = "/dev/console" ]; then
108 return 0
109 fi
110
111 printf "\n\n\nIt has been detected that the command\n\n\t$0 $*\n\n"
112 printf "has been run from an interactive shell.\n"
113 printf "It will probably not do what you expect, so this script will wait\n"
114 printf "60 seconds before continuing. Press ^C to stop it.\n"
115 printf "RUNNING THIS COMMAND IS HIGHLY DISCOURAGED!\n\n\n\n"
116 sleep 60
117}
118
119##############################################################################
120
121if ! supported_kernel; then
122 echo "udev requires a kernel >= 2.6.12, not started."
123 exit 1
124fi
125
126if [ ! -e /proc/filesystems ]; then
127 echo "udev requires a mounted procfs, not started."
128 exit 1
129fi
130
131if ! grep -q '[[:space:]]tmpfs$' /proc/filesystems; then
132 echo "udev requires tmpfs support, not started."
133 exit 1
134fi
135
136if [ ! -d /sys/class/ ]; then
137 echo "udev requires a mounted sysfs, not started."
138 exit 1
139fi
140
141if [ ! -e /proc/sys/kernel/hotplug ] && [ ! -e /sys/kernel/uevent_helper ]; then
142 echo "udev requires hotplug support, not started."
143 exit 1
144fi
145
146##############################################################################
147
148# When modifying this script, do not forget that between the time that
149# the new /dev has been mounted and udevstart has been run there will be
150# no /dev/null. This also means that you cannot use the "&" shell command.
151
152case "$1" in
153 start)
154 if [ -e "$udev_root/.udevdb" ]; then
155 if mountpoint -q /dev/; then
156 TMPFS_MOUNTED=1
157 else
158 echo ".udevdb already exists on the old $udev_root!"
159 fi
160 fi
161 warn_if_interactive
162
163 #echo /sbin/udevsend > /proc/sys/kernel/hotplug
164 if [ -e /sys/kernel/uevent_helper ] ; then
165 echo "" > /sys/kernel/uevent_helper
166 else
167 echo "" > /proc/sys/kernel/hotplug
168 fi
169 udevsend
170 if [ "$UDEV_DISABLED" = "yes" ]; then
171 echo "udev disabled on the kernel command line, not started."
172 exit 0
173 fi
174
175 if [ ! "$TMPFS_MOUNTED" ]; then
176 unmount_devpts
177 mount_tmpfs
178 [ -d /proc/1 ] || mount -n /proc
179 # if this directory is not present /dev will not be updated by udev
180 mkdir /dev/.udevdb/
181 echo "Creating initial device nodes..."
182 udevstart
183 fi
184 make_extra_nodes
185 ;;
186 stop)
187 warn_if_interactive
188 start-stop-daemon --stop --exec /sbin/udevd --quiet
189 unmount_devpts
190 if [ -d /dev/.static/dev/ ]; then
191 umount -l /dev/.static/dev/ || true
192 fi
193 echo "Unmounting /dev..."
194 # unmounting with -l should never fail
195 if ! umount -l /dev; then
196 exit 1
197 fi
198 ;;
199 restart|force-reload)
200 start-stop-daemon --stop --exec /sbin/udevd --quiet
201 log_begin_msg "Recreating device nodes..."
202 udevstart
203 make_extra_nodes
204 log_end_msg 0
205 ;;
206 *)
207 echo "Usage: /etc/init.d/udev {start|stop|restart|force-reload}"
208 exit 1
209 ;;
210esac
211
212exit 0
diff --git a/meta/recipes-core/udev/files/local.rules b/meta/recipes-core/udev/files/local.rules
deleted file mode 100644
index 5f2efbeb0c..0000000000
--- a/meta/recipes-core/udev/files/local.rules
+++ /dev/null
@@ -1,22 +0,0 @@
1# There are a number of modifiers that are allowed to be used in some
2# of the different fields. They provide the following subsitutions:
3#
4# %n the "kernel number" of the device.
5# For example, 'sda3' has a "kernel number" of '3'
6# %e the smallest number for that name which does not matches an existing node
7# %k the kernel name for the device
8# %M the kernel major number for the device
9# %m the kernel minor number for the device
10# %b the bus id for the device
11# %c the string returned by the PROGRAM
12# %s{filename} the content of a sysfs attribute
13# %% the '%' char itself
14#
15
16# Media automounting
17SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/mount.sh"
18SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh"
19
20# Handle network interface setup
21SUBSYSTEM=="net", ACTION=="add" RUN+="/etc/udev/scripts/network.sh"
22SUBSYSTEM=="net", ACTION=="remove" RUN+="/etc/udev/scripts/network.sh"
diff --git a/meta/recipes-core/udev/files/noasmlinkage.patch b/meta/recipes-core/udev/files/noasmlinkage.patch
deleted file mode 100644
index 4173fc5c2b..0000000000
--- a/meta/recipes-core/udev/files/noasmlinkage.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1Upstream-Status: Inappropriate [embedded]
2
3#
4# Patch managed by http://www.holgerschurig.de/patcher.html
5#
6
7--- udev-062/udev.c~noasmlinkage.patch
8+++ udev-062/udev.c
9@@ -54,7 +54,7 @@
10 }
11 #endif
12
13-static void asmlinkage sig_handler(int signum)
14+static void sig_handler(int signum)
15 {
16 switch (signum) {
17 case SIGALRM:
18--- udev-062/udevd.c~noasmlinkage.patch
19+++ udev-062/udevd.c
20@@ -639,7 +639,7 @@
21 return msg;
22 }
23
24-static void asmlinkage sig_handler(int signum)
25+static void sig_handler(int signum)
26 {
27 int rc;
28
29--- udev-062/udevstart.c~noasmlinkage.patch
30+++ udev-062/udevstart.c
31@@ -323,7 +323,7 @@
32 exec_list(&device_list);
33 }
34
35-static void asmlinkage sig_handler(int signum)
36+static void sig_handler(int signum)
37 {
38 switch (signum) {
39 case SIGALRM:
diff --git a/meta/recipes-core/udev/files/permissions.rules b/meta/recipes-core/udev/files/permissions.rules
deleted file mode 100644
index 86d771276b..0000000000
--- a/meta/recipes-core/udev/files/permissions.rules
+++ /dev/null
@@ -1,81 +0,0 @@
1# default permissions for block devices
2SUBSYSTEM=="block", GROUP="disk"
3SUBSYSTEM=="block", SYSFS{removable}=="1", GROUP="floppy"
4
5# IDE devices
6BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}="1", \
7 PROGRAM="/bin/cat /proc/ide/%k/media", RESULT=="cdrom*", GROUP="cdrom"
8BUS=="ide", KERNEL=="ht[0-9]*", GROUP="tape"
9BUS=="ide", KERNEL=="nht[0-9]*", GROUP="tape"
10
11# SCSI devices
12BUS=="scsi", SYSFS{type}=="1", GROUP="tape"
13BUS=="scsi", SYSFS{type}=="5", GROUP="cdrom"
14BUS=="scsi", SYSFS{type}=="6", GROUP="scanner"
15
16# USB devices
17BUS=="usb", KERNEL=="legousbtower*", MODE="0666"
18BUS=="usb", KERNEL=="lp[0-9]*", GROUP="lp"
19
20# serial devices
21SUBSYSTEM=="tty", GROUP="dialout"
22SUBSYSTEM=="capi", GROUP="dialout"
23SUBSYSTEM=="slamr", GROUP="dialout"
24
25# vc devices (all members of the tty subsystem)
26KERNEL=="ptmx", MODE="0666", GROUP="root"
27KERNEL=="console", MODE="0600", GROUP="root"
28KERNEL=="tty", MODE="0666", GROUP="root"
29KERNEL=="tty[0-9]*", GROUP="root"
30KERNEL=="pty*", MODE="0666", GROUP="tty"
31
32# video devices
33SUBSYSTEM=="video4linux", GROUP="video"
34SUBSYSTEM=="drm", GROUP="video"
35SUBSYSTEM=="dvb", GROUP="video"
36SUBSYSTEM=="em8300", GROUP="video"
37SUBSYSTEM=="graphics", GROUP="video"
38SUBSYSTEM=="nvidia", GROUP="video"
39
40# misc devices
41KERNEL=="random", MODE="0666"
42KERNEL=="urandom", MODE="0444"
43KERNEL=="mem", MODE="0640", GROUP="kmem"
44KERNEL=="kmem", MODE="0640", GROUP="kmem"
45KERNEL=="port", MODE="0640", GROUP="kmem"
46KERNEL=="full", MODE="0666"
47KERNEL=="null", MODE="0666"
48KERNEL=="zero", MODE="0666"
49KERNEL=="inotify", MODE="0666"
50KERNEL=="sgi_fetchop", MODE="0666"
51KERNEL=="sonypi", MODE="0666"
52KERNEL=="agpgart", GROUP="video"
53KERNEL=="nvram", GROUP="nvram"
54KERNEL=="rtc", MODE="0660", GROUP="audio"
55
56KERNEL=="cdemu[0-9]*", GROUP="cdrom"
57KERNEL=="pktcdvd[0-9]*", GROUP="cdrom"
58KERNEL=="pktcdvd", MODE="0644"
59
60# printers and parallel devices
61SUBSYSTEM=="printer", GROUP="lp"
62SUBSYSTEM=="ppdev", GROUP="lp"
63KERNEL=="pt[0-9]*", GROUP="tape"
64KERNEL=="pht[0-9]*", GROUP="tape"
65
66# sound devices
67SUBSYSTEM=="sound", GROUP="audio"
68
69# ieee1394 devices
70KERNEL=="raw1394", GROUP="disk"
71KERNEL=="dv1394*", GROUP="video"
72KERNEL=="video1394*", GROUP="video"
73
74# input devices
75KERNEL=="event[0-9]*", MODE="0664"
76KERNEL=="js[0-9]*", MODE="0664"
77
78# AOE character devices
79SUBSYSTEM=="aoe", MODE="0220", GROUP="disk"
80SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440"
81
diff --git a/meta/recipes-core/udev/files/tmpfs.patch b/meta/recipes-core/udev/files/tmpfs.patch
deleted file mode 100644
index aa4a4f6c9b..0000000000
--- a/meta/recipes-core/udev/files/tmpfs.patch
+++ /dev/null
@@ -1,17 +0,0 @@
1Upstream-Status: Inappropriate [embedded]
2
3#
4# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
5#
6
7--- udev-031/extras/start_udev~tmpfs 2004-09-10 17:10:03.000000000 -0400
8+++ udev-031/extras/start_udev 2004-09-11 15:18:15.560789160 -0400
9@@ -85,7 +85,7 @@
10 fi
11
12 echo "mounting... ramfs at $udev_root"
13-mount -n -t ramfs none $udev_root
14+mount -n -t ramfs none $udev_root || mount -n -t tmpfs none $udev_root
15
16 # propogate /udev from /sys
17 echo "Creating initial udev device nodes:"
diff --git a/meta/recipes-core/udev/files/udev.rules b/meta/recipes-core/udev/files/udev.rules
deleted file mode 100644
index 5c566f6cef..0000000000
--- a/meta/recipes-core/udev/files/udev.rules
+++ /dev/null
@@ -1,98 +0,0 @@
1# There are a number of modifiers that are allowed to be used in some
2# of the different fields. They provide the following subsitutions:
3#
4# %n the "kernel number" of the device.
5# For example, 'sda3' has a "kernel number" of '3'
6# %e the smallest number for that name which does not matches an existing node
7# %k the kernel name for the device
8# %M the kernel major number for the device
9# %m the kernel minor number for the device
10# %b the bus id for the device
11# %c the string returned by the PROGRAM
12# %s{filename} the content of a sysfs attribute
13# %% the '%' char itself
14#
15
16# SCSI devices
17BUS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n"
18
19# USB devices
20BUS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k"
21BUS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k"
22BUS=="usb", KERNEL=="dabusb*", NAME="usb/%k"
23BUS=="usb", KERNEL=="hiddev*", NAME="usb/%k"
24BUS=="usb", KERNEL=="legousbtower*", NAME="usb/%k"
25BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k"
26BUS=="usb", KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", \
27 SYMLINK+="pilot"
28
29# usbfs-like devices
30SUBSYSTEM=="usb_device", \
31 PROGRAM="/bin/sh -c 'export X=%k; export X=$${X#usbdev}; export B=$${X%%%%.*}; export D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c"
32
33# serial devices
34KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20"
35KERNEL=="capi[0-9]*", NAME="capi/%n"
36
37# video devices
38KERNEL=="card[0-9]*", NAME="dri/%k"
39
40# misc devices
41KERNEL=="hw_random", NAME="hwrng"
42KERNEL=="tun", NAME="net/%k"
43
44KERNEL=="cdemu[0-9]*", NAME="cdemu/%n"
45KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n"
46KERNEL=="pktcdvd", NAME="pktcdvd/control"
47
48KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid"
49KERNEL=="msr[0-9]*", NAME="cpu/%n/msr"
50KERNEL=="microcode", NAME="cpu/microcode"
51
52KERNEL=="umad*", NAME="infiniband/%k"
53KERNEL=="issm*", NAME="infiniband/%k"
54KERNEL=="uverbs*", NAME="infiniband/%k"
55KERNEL=="ucm", NAME="infiniband/%k"
56
57KERNEL=="buzzer", NAME="misc/buzzer"
58
59# ALSA devices
60KERNEL=="controlC[0-9]*", NAME="snd/%k"
61KERNEL=="hwC[D0-9]*", NAME="snd/%k"
62KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k"
63KERNEL=="midiC[D0-9]*", NAME="snd/%k"
64KERNEL=="timer", NAME="snd/%k"
65KERNEL=="seq", NAME="snd/%k"
66
67# ieee1394 devices
68KERNEL=="dv1394*", NAME="dv1394/%n"
69KERNEL=="video1394*", NAME="video1394/%n"
70
71# input devices
72KERNEL=="mice", NAME="input/%k"
73KERNEL=="mouse[0-9]*", NAME="input/%k"
74KERNEL=="event[0-9]*", NAME="input/%k"
75KERNEL=="js[0-9]*", NAME="input/%k"
76KERNEL=="ts[0-9]*", NAME="input/%k"
77KERNEL=="uinput", NAME="input/%k"
78
79# Zaptel
80KERNEL=="zapctl", NAME="zap/ctl"
81KERNEL=="zaptimer", NAME="zap/timer"
82KERNEL=="zapchannel", NAME="zap/channel"
83KERNEL=="zappseudo", NAME="zap/pseudo"
84KERNEL=="zap[0-9]*", NAME="zap/%n"
85
86# AOE character devices
87SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k"
88SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k"
89SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k"
90
91# device mapper creates its own device nodes, so ignore these
92KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device"
93KERNEL=="device-mapper", NAME="mapper/control"
94
95KERNEL="rfcomm[0-9]*", NAME="%k", GROUP="users", MODE="0660"
96
97# Firmware Helper
98ACTION=="add", SUBSYSTEM=="firmware", RUN+="/sbin/firmware_helper"
diff --git a/meta/recipes-core/udev/files/udev_network_queue.sh b/meta/recipes-core/udev/files/udev_network_queue.sh
deleted file mode 100644
index 05e08e9d1b..0000000000
--- a/meta/recipes-core/udev/files/udev_network_queue.sh
+++ /dev/null
@@ -1,35 +0,0 @@
1#! /bin/sh
2#
3# Copyright Matthias Hentges <devel@hentges.net> (c) 2006
4# License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the license)
5#
6# Filename: udev_network_queue.sh
7# Date: 03-May-06
8
9do_start() {
10 if test -e /dev/udev_network_queue
11 then
12 echo "Activating queued NICs..."
13 for NIC in `cat /dev/udev_network_queue`
14 do
15 export INTERFACE="$NIC" ; export ACTION=add
16 /etc/udev/scripts/network.sh
17 done
18 echo ""
19 else
20 echo "No NICs queued"
21 fi
22}
23
24do_stop() {
25 /bin/true
26}
27
28case "$1" in
29start) do_start;;
30stop) do_stop;;
31restart) do_stop
32 do_start;;
33*) echo "Usage: `basename $0` [ start | stop | restart ]"
34 exit 0;;
35esac
diff --git a/meta/recipes-core/udev/files/udevsynthesize.patch b/meta/recipes-core/udev/files/udevsynthesize.patch
deleted file mode 100644
index 5122ea2b22..0000000000
--- a/meta/recipes-core/udev/files/udevsynthesize.patch
+++ /dev/null
@@ -1,778 +0,0 @@
1Upstream-Status: Inappropriate [distribution]
2
3--- udev-081/udevsynthesize.c.orig 2006-01-29 12:22:45.000000000 +0100
4+++ udev-081/udevsynthesize.c 2006-01-29 12:22:40.000000000 +0100
5@@ -0,0 +1,763 @@
6+/*
7+ * udevcoldplug.c
8+ *
9+ * Copyright (C) 2005 SUSE Linux Products GmbH
10+ *
11+ * Author:
12+ * Kay Sievers <kay.sievers@vrfy.org>
13+ *
14+ * Synthesize kernel events from sysfs information and pass them
15+ * to the udevd daemon.
16+ *
17+ * This program is free software; you can redistribute it and/or modify it
18+ * under the terms of the GNU General Public License as published by the
19+ * Free Software Foundation version 2 of the License.
20+ *
21+ * This program is distributed in the hope that it will be useful, but
22+ * WITHOUT ANY WARRANTY; without even the implied warranty of
23+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24+ * General Public License for more details.
25+ *
26+ * You should have received a copy of the GNU General Public License along
27+ * with this program; if not, write to the Free Software Foundation, Inc.,
28+ * 675 Mass Ave, Cambridge, MA 02139, USA.
29+ *
30+ */
31+
32+#include <stdlib.h>
33+#include <stddef.h>
34+#include <string.h>
35+#include <stdio.h>
36+#include <unistd.h>
37+#include <errno.h>
38+#include <ctype.h>
39+#include <fcntl.h>
40+#include <dirent.h>
41+#include <signal.h>
42+#include <syslog.h>
43+#include <sys/socket.h>
44+#include <sys/un.h>
45+#include <sys/wait.h>
46+#include <sys/stat.h>
47+#include <sys/types.h>
48+
49+#include "udev_libc_wrapper.h"
50+#include "udev.h"
51+#include "udevd.h"
52+#include "udev_version.h"
53+#include "logging.h"
54+
55+#include "list.h"
56+
57+#ifndef DT_DIR
58+#define DT_DIR 4
59+#endif
60+
61+static const char *udev_log_str;
62+static int udevd_sock = -1;
63+
64+#ifdef USE_LOG
65+void log_message(int priority, const char *format, ...)
66+{
67+ va_list args;
68+
69+ if (priority > udev_log_priority)
70+ return;
71+
72+ va_start(args, format);
73+ vsyslog(priority, format, args);
74+ va_end(args);
75+}
76+#endif
77+
78+struct device {
79+ struct list_head node;
80+ struct udevd_msg msg;
81+ size_t bufpos;
82+ char *path;
83+};
84+
85+static dev_t read_devt(const char *path)
86+{
87+ char filename[PATH_SIZE];
88+ char majorminor[64];
89+ unsigned int major, minor;
90+ ssize_t count;
91+ int fd;
92+
93+ snprintf(filename, sizeof(filename), "%s/%s", path, "dev");
94+ filename[sizeof(filename)-1] = '\0';
95+
96+ fd = open(filename, O_RDONLY);
97+ if (fd < 0)
98+ return 0;
99+
100+ count = read(fd, majorminor, sizeof(majorminor));
101+ close(fd);
102+ majorminor[count] = '\0';
103+ if (sscanf(majorminor, "%u:%u", &major, &minor) != 2)
104+ return 0;
105+ dbg("found major=%d, minor=%d", major, minor);
106+
107+ return makedev(major, minor);
108+}
109+
110+static ssize_t read_file(const char *directory, const char *file, char *str, size_t len)
111+{
112+ char filename[PATH_SIZE];
113+ ssize_t count;
114+ int fd;
115+
116+ memset(filename, 0, sizeof(filename));
117+ snprintf(filename, sizeof(filename), "%s/%s", directory, file);
118+ filename[sizeof(filename)-1] = '\0';
119+
120+ fd = open(filename, O_RDONLY);
121+ if (fd < 0)
122+ return -1;
123+
124+ count = read(fd, str, len-1);
125+ close(fd);
126+
127+ if (count > (ssize_t)len)
128+ count = len;
129+ str[count-1] = '\0';
130+
131+ return count;
132+}
133+
134+static ssize_t read_link(const char *directory, const char *file, char *str, size_t size)
135+{
136+ char filename[PATH_SIZE];
137+ char target[PATH_SIZE];
138+ int len;
139+ char *back;
140+ char *strip;
141+ int level = 1;
142+
143+ snprintf(filename, sizeof(filename), "%s/%s", directory, file);
144+ filename[sizeof(filename)-1] = '\0';
145+
146+ len = readlink(filename, target, sizeof(target)-1);
147+ if (len < 0)
148+ return -1;
149+ target[len] = '\0';
150+
151+ back = target;
152+ while (strncmp(back, "../", 3) == 0) {
153+ back += 3;
154+ level++;
155+ }
156+ while(level--) {
157+ strip = strrchr(filename, '/');
158+ if (!strip)
159+ return -1;
160+ strip[0] = '\0';
161+ }
162+
163+ snprintf(str, size, "%s/%s", filename, back);
164+ str[size-1] = '\0';
165+
166+ return len;
167+}
168+
169+static char *add_env_key(struct device *device, const char *key, const char *value)
170+{
171+ size_t pos = device->bufpos;
172+ device->bufpos += sprintf(&device->msg.envbuf[device->bufpos], "%s=%s", key, value)+1;
173+ return &device->msg.envbuf[pos];
174+}
175+
176+static struct device *device_create(const char *path, const char *subsystem, dev_t devt)
177+{
178+ struct device *device;
179+ const char *devpath = &path[strlen(sysfs_path)];
180+ char target[PATH_SIZE];
181+
182+ device = malloc(sizeof(struct device));
183+ if (device == NULL) {
184+ dbg("error malloc");
185+ return NULL;
186+ }
187+ memset(device, 0x00, sizeof(struct device));
188+
189+ device->path = add_env_key(device, "DEVPATH", devpath);
190+ device->path += strlen("DEVPATH=");
191+ add_env_key(device, "SUBSYSTEM", subsystem);
192+ add_env_key(device, "ACTION", "add");
193+ add_env_key(device, "UDEV_COLDPLUG", "1");
194+
195+ if (major(devt)) {
196+ char number[32];
197+ sprintf(number, "%u", major(devt));
198+ add_env_key(device, "MAJOR", number);
199+ sprintf(number, "%u", minor(devt));
200+ add_env_key(device, "MINOR", number);
201+ }
202+
203+ if (strncmp(devpath, "/block/", strlen("/block/")) == 0 ||
204+ strncmp(devpath, "/class/", strlen("/class/")) == 0) {
205+ char physpath[PATH_SIZE];
206+
207+ if (read_link(path, "device", physpath, sizeof(physpath)) > (ssize_t)strlen(sysfs_path)) {
208+ add_env_key(device, "PHYSDEVPATH", &physpath[strlen(sysfs_path)]);
209+ if (read_link(physpath, "driver", target, sizeof(target)) > (ssize_t)strlen(sysfs_path)) {
210+ char *pos = strrchr(target, '/');
211+ if (pos)
212+ add_env_key(device, "PHYSDEVDRIVER", &pos[1]);
213+ }
214+ if (read_link(physpath, "bus", target, sizeof(target)) > (ssize_t)strlen(sysfs_path)) {
215+ char *pos = strrchr(target, '/');
216+ if (pos)
217+ add_env_key(device, "PHYSDEVBUS", &pos[1]);
218+ }
219+ }
220+ } else if (strncmp(devpath, "/devices/", strlen("/devices/")) == 0) {
221+ if (read_link(path, "driver", target, sizeof(target)) > (ssize_t)strlen(sysfs_path)) {
222+ char *pos = strrchr(target, '/');
223+ if (pos)
224+ add_env_key(device, "PHYSDEVDRIVER", &pos[1]);
225+ }
226+ if (read_link(path, "bus", target, sizeof(target)) > (ssize_t)strlen(sysfs_path)) {
227+ char *pos = strrchr(target, '/');
228+ if (pos)
229+ add_env_key(device, "PHYSDEVBUS", &pos[1]);
230+ }
231+ }
232+
233+ return device;
234+}
235+
236+static int device_list_insert(struct list_head *device_list, struct device *device)
237+{
238+ struct device *loop_device;
239+
240+ dbg("insert: '%s'", device->path);
241+
242+ /* sort files in lexical order */
243+ list_for_each_entry(loop_device, device_list, node)
244+ if (strcmp(loop_device->path, device->path) > 0)
245+ break;
246+
247+ list_add_tail(&device->node, &loop_device->node);
248+
249+ return 0;
250+}
251+
252+static int add_device_udevd(struct device *device)
253+{
254+ size_t msg_len;
255+ struct sockaddr_un saddr;
256+ socklen_t addrlen;
257+ int retval;
258+
259+ memset(&saddr, 0x00, sizeof(struct sockaddr_un));
260+ saddr.sun_family = AF_LOCAL;
261+ /* use abstract namespace for socket path */
262+ strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH);
263+ addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1;
264+
265+ strcpy(device->msg.magic, UDEV_MAGIC);
266+ device->msg.type = UDEVD_UEVENT_UDEVSEND;
267+
268+ msg_len = offsetof(struct udevd_msg, envbuf) + device->bufpos;
269+ dbg("msg_len=%i", msg_len);
270+
271+ retval = sendto(udevd_sock, &device->msg, msg_len, 0, (struct sockaddr *)&saddr, addrlen);
272+ if (retval < 0)
273+ return -1;
274+
275+ return 0;
276+}
277+
278+static void exec_list(struct list_head *device_list, const char *first[], const char *last[])
279+{
280+ struct device *loop_device;
281+ struct device *tmp_device;
282+ int i;
283+
284+ /* handle the "first" type devices first */
285+ if (first)
286+ list_for_each_entry_safe(loop_device, tmp_device, device_list, node) {
287+ for (i = 0; first[i] != NULL; i++) {
288+ if (strncmp(loop_device->path, first[i], strlen(first[i])) == 0) {
289+ add_device_udevd(loop_device);
290+ list_del(&loop_device->node);
291+ free(loop_device);
292+ break;
293+ }
294+ }
295+ }
296+
297+ /* handle the devices we are allowed to, excluding the "last" type devices */
298+ if (last)
299+ list_for_each_entry_safe(loop_device, tmp_device, device_list, node) {
300+ int found = 0;
301+ for (i = 0; last[i] != NULL; i++) {
302+ if (strncmp(loop_device->path, last[i], strlen(last[i])) == 0) {
303+ found = 1;
304+ break;
305+ }
306+ }
307+ if (found)
308+ continue;
309+
310+ add_device_udevd(loop_device);
311+ list_del(&loop_device->node);
312+ free(loop_device);
313+ }
314+
315+ /* handle the rest of the devices */
316+ list_for_each_entry_safe(loop_device, tmp_device, device_list, node) {
317+ add_device_udevd(loop_device);
318+ list_del(&loop_device->node);
319+ free(loop_device);
320+ }
321+}
322+
323+static int udev_scan_class(void)
324+{
325+ char base[PATH_SIZE];
326+ DIR *dir;
327+ struct dirent *dent;
328+ LIST_HEAD(device_list);
329+
330+ /* we want /dev/null and /dev/console first */
331+ const char *first[] = {
332+ "/class/mem",
333+ "/class/tty",
334+ NULL,
335+ };
336+
337+ snprintf(base, sizeof(base), "%s/class", sysfs_path);
338+ base[sizeof(base)-1] = '\0';
339+
340+ dir = opendir(base);
341+ if (!dir)
342+ return -1;
343+
344+ for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
345+ char dirname[PATH_SIZE];
346+ DIR *dir2;
347+ struct dirent *dent2;
348+
349+ if (dent->d_name[0] == '.')
350+ continue;
351+
352+ snprintf(dirname, sizeof(dirname), "%s/%s", base, dent->d_name);
353+ dirname[sizeof(dirname)-1] = '\0';
354+
355+ dir2 = opendir(dirname);
356+ if (!dir2)
357+ continue;
358+ for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) {
359+ char dirname2[PATH_SIZE];
360+ struct device *device;
361+ dev_t devt;
362+
363+ if (dent2->d_name[0] == '.')
364+ continue;
365+ if (dent2->d_type != DT_DIR)
366+ continue;
367+
368+ snprintf(dirname2, sizeof(dirname2), "%s/%s", dirname, dent2->d_name);
369+ dirname2[sizeof(dirname2)-1] = '\0';
370+ devt = read_devt(dirname2);
371+ device = device_create(dirname2, dent->d_name, devt);
372+
373+ if (strcmp(dent->d_name, "net") == 0 ||
374+ strcmp(dent->d_name, "bluetooth") == 0) {
375+ add_env_key(device, "INTERFACE", dent2->d_name);
376+ } else if (strcmp(dent->d_name, "pcmcia_socket") == 0 &&
377+ strlen(dent->d_name) > 14) {
378+ add_env_key(device, "SOCKET_NO",
379+ dent2->d_name + 14);
380+ }
381+
382+ device_list_insert(&device_list, device);
383+ }
384+ closedir(dir2);
385+ }
386+ closedir(dir);
387+ exec_list(&device_list, first, NULL);
388+
389+ return 0;
390+}
391+
392+static int udev_scan_block(void)
393+{
394+ char base[PATH_SIZE];
395+ DIR *dir;
396+ struct dirent *dent;
397+ LIST_HEAD(device_list);
398+
399+ /* dm wants to have the block devices around before it */
400+ const char *last[] = {
401+ "/block/dm",
402+ NULL,
403+ };
404+
405+ snprintf(base, sizeof(base), "%s/block", sysfs_path);
406+ base[sizeof(base)-1] = '\0';
407+
408+ dir = opendir(base);
409+ if (!dir)
410+ return -1;
411+
412+ for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
413+ char dirname[PATH_SIZE];
414+ struct device *device;
415+ struct dirent *dent2;
416+ DIR *dir2;
417+ dev_t devt;
418+
419+ if (dent->d_name[0] == '.')
420+ continue;
421+ if (dent->d_type != DT_DIR)
422+ continue;
423+
424+ snprintf(dirname, sizeof(dirname), "%s/%s", base, dent->d_name);
425+ dirname[sizeof(dirname)-1] = '\0';
426+ devt = read_devt(dirname);
427+ if (major(devt)) {
428+ device = device_create(dirname, "block", devt);
429+ device_list_insert(&device_list, device);
430+ }
431+
432+ /* look for partitions */
433+ dir2 = opendir(dirname);
434+ if (!dir2)
435+ continue;
436+ for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) {
437+ char dirname2[PATH_SIZE];
438+
439+ if (dent2->d_name[0] == '.')
440+ continue;
441+ if (dent2->d_type != DT_DIR)
442+ continue;
443+
444+ snprintf(dirname2, sizeof(dirname2), "%s/%s", dirname, dent2->d_name);
445+ dirname2[sizeof(dirname2)-1] = '\0';
446+ devt = read_devt(dirname2);
447+ if (major(devt)) {
448+ device = device_create(dirname2, "block", devt);
449+ device_list_insert(&device_list, device);
450+ continue;
451+ }
452+ }
453+ closedir(dir2);
454+ }
455+ closedir(dir);
456+ exec_list(&device_list, NULL, last);
457+
458+ return 0;
459+}
460+
461+static int pci_handler(struct device *device)
462+{
463+ char path[PATH_SIZE];
464+ char value[PATH_SIZE];
465+ char vendor[PATH_SIZE];
466+ char product[PATH_SIZE];
467+ const char *name;
468+
469+ snprintf(path, sizeof(path), "%s%s", sysfs_path, device->path);
470+ path[sizeof(path)-1] = '\0';
471+
472+ if (read_file(path, "modalias", value, sizeof(value)) > 0)
473+ add_env_key(device, "MODALIAS", value);
474+
475+ name = strrchr(device->path, '/');
476+ if (name)
477+ add_env_key(device, "PCI_SLOT_NAME", &name[1]);
478+
479+ if (read_file(path, "class", value, sizeof(value)) > 0)
480+ add_env_key(device, "PCI_CLASS", &value[2]);
481+
482+ if (read_file(path, "vendor", vendor, sizeof(vendor)) > 0 &&
483+ read_file(path, "device", product, sizeof(product)) > 0) {
484+ snprintf(value, sizeof(value), "%s:%s", &vendor[2], &product[2]);
485+ path[sizeof(value)-1] = '\0';
486+ add_env_key(device, "PCI_ID", value);
487+ }
488+
489+ if (read_file(path, "subsystem_vendor", vendor, sizeof(vendor)) > 0 &&
490+ read_file(path, "subsystem_device", product, sizeof(product)) > 0) {
491+ snprintf(value, sizeof(value), "%s:%s", &vendor[2], &product[2]);
492+ path[sizeof(value)-1] = '\0';
493+ add_env_key(device, "PCI_SUBSYS_ID", value);
494+ }
495+
496+ return 0;
497+}
498+
499+static int usb_handler(struct device *device)
500+{
501+ char path[PATH_SIZE];
502+ char value[PATH_SIZE];
503+ char str1[PATH_SIZE];
504+ char str2[PATH_SIZE];
505+ char str3[PATH_SIZE];
506+ unsigned int int1;
507+ unsigned int int2;
508+ unsigned int int3;
509+ char *pos;
510+
511+ snprintf(path, sizeof(path), "%s%s", sysfs_path, device->path);
512+ path[sizeof(path)-1] = '\0';
513+
514+ /* device events have : in their directory name */
515+ pos = strrchr(path, '/');
516+ if (!strchr(pos, ':'))
517+ return 0; /* and do not have other variables */
518+
519+ if (read_file(path, "modalias", value, sizeof(value)) > 0)
520+ add_env_key(device, "MODALIAS", value);
521+
522+ if (read_file(path, "bInterfaceClass", str1, sizeof(str1)) > 0 &&
523+ read_file(path, "bInterfaceSubClass", str2, sizeof(str2)) > 0 &&
524+ read_file(path, "bInterfaceProtocol", str3, sizeof(str3)) > 0) {
525+ int1 = (int) strtol(str1, NULL, 16);
526+ int2 = (int) strtol(str2, NULL, 16);
527+ int3 = (int) strtol(str3, NULL, 16);
528+ snprintf(value, sizeof(value), "%u/%u/%u", int1, int2, int3);
529+ path[sizeof(value)-1] = '\0';
530+ add_env_key(device, "INTERFACE", value);
531+ }
532+
533+ /* move to the parent directory */
534+ pos[0] = '\0';
535+
536+ if (read_file(path, "idVendor", str1, sizeof(str1)) > 0 &&
537+ read_file(path, "idProduct", str2, sizeof(str2)) > 0 &&
538+ read_file(path, "bcdDevice", str3, sizeof(str3)) > 0) {
539+ int1 = (int) strtol(str1, NULL, 16);
540+ int2 = (int) strtol(str2, NULL, 16);
541+ int3 = (int) strtol(str3, NULL, 16);
542+ snprintf(value, sizeof(value), "%x/%x/%x", int1, int2, int3);
543+ path[sizeof(value)-1] = '\0';
544+ add_env_key(device, "PRODUCT", value);
545+ }
546+
547+ if (read_file(path, "bDeviceClass", str1, sizeof(str1)) > 0 &&
548+ read_file(path, "bDeviceSubClass", str2, sizeof(str2)) > 0 &&
549+ read_file(path, "bDeviceProtocol", str3, sizeof(str3)) > 0) {
550+ int1 = (int) strtol(str1, NULL, 16);
551+ int2 = (int) strtol(str2, NULL, 16);
552+ int3 = (int) strtol(str3, NULL, 16);
553+ snprintf(value, sizeof(value), "%u/%u/%u", int1, int2, int3);
554+ path[sizeof(value)-1] = '\0';
555+ add_env_key(device, "TYPE", value);
556+ }
557+
558+ if (read_file(path, "devnum", str2, sizeof(str2)) > 0) {
559+ pos = strrchr(path, 'b');
560+ int1 = (int) strtol(pos + 1, NULL, 16);
561+ int2 = (int) strtol(str2, NULL, 16);
562+ snprintf(value, sizeof(value),
563+ "/proc/bus/usb/%03d/%03d", int1, int2);
564+ path[sizeof(value)-1] = '\0';
565+ add_env_key(device, "DEVICE", value);
566+ }
567+
568+ return 0;
569+}
570+
571+static int serio_handler(struct device *device)
572+{
573+ char path[PATH_SIZE];
574+ char value[PATH_SIZE];
575+
576+ snprintf(path, sizeof(path), "%s%s", sysfs_path, device->path);
577+ path[sizeof(path)-1] = '\0';
578+
579+ if (read_file(path, "modalias", value, sizeof(value)) > 0)
580+ add_env_key(device, "MODALIAS", value);
581+
582+ if (read_file(path, "id/type", value, sizeof(value)) > 0)
583+ add_env_key(device, "SERIO_TYPE", value);
584+
585+ if (read_file(path, "id/proto", value, sizeof(value)) > 0)
586+ add_env_key(device, "SERIO_PROTO", value);
587+
588+ if (read_file(path, "id/id", value, sizeof(value)) > 0)
589+ add_env_key(device, "SERIO_ID", value);
590+
591+ if (read_file(path, "id/extra", value, sizeof(value)) > 0)
592+ add_env_key(device, "SERIO_EXTRA", value);
593+
594+ return 0;
595+}
596+
597+static int ccw_handler(struct device *device)
598+{
599+ char path[PATH_SIZE];
600+ char value[PATH_SIZE], *tmp;
601+
602+ snprintf(path, sizeof(path), "%s%s", sysfs_path, device->path);
603+ path[sizeof(path)-1] = '\0';
604+
605+ if (read_file(path, "modalias", value, sizeof(value)) > 0)
606+ add_env_key(device, "MODALIAS", value);
607+
608+ if (read_file(path, "cutype", value, sizeof(value)) > 0) {
609+ value[4] = 0;
610+ tmp = &value[5];
611+ add_env_key(device, "CU_TYPE", value);
612+ add_env_key(device, "CU_MODEL", tmp);
613+ }
614+
615+ if (read_file(path, "devtype", value, sizeof(value)) > 0) {
616+ if (value[0] == 'n') {
617+ add_env_key(device, "DEV_TYPE", "0000");
618+ add_env_key(device, "DEV_MODEL", "00");
619+ }
620+ else {
621+ value[4] = 0;
622+ tmp = &value[5];
623+ add_env_key(device, "DEV_TYPE", value);
624+ add_env_key(device, "DEV_MODEL", tmp);
625+ }
626+ }
627+
628+ return 0;
629+}
630+
631+static int modalias_handler(struct device *device)
632+{
633+ char path[PATH_SIZE];
634+ char value[PATH_SIZE];
635+
636+ snprintf(path, sizeof(path), "%s%s", sysfs_path, device->path);
637+ path[sizeof(path)-1] = '\0';
638+
639+ if (read_file(path, "modalias", value, sizeof(value)) > 0)
640+ add_env_key(device, "MODALIAS", value);
641+
642+ return 0;
643+}
644+
645+static int udev_scan_bus(const char *bus, int bus_handler(struct device *device))
646+{
647+ char base[PATH_SIZE];
648+ DIR *dir;
649+ struct dirent *dent;
650+ LIST_HEAD(device_list);
651+
652+ snprintf(base, sizeof(base), "%s/bus/%s/devices", sysfs_path, bus);
653+ base[sizeof(base)-1] = '\0';
654+
655+ dir = opendir(base);
656+ if (!dir)
657+ return -1;
658+ for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
659+ char devpath[PATH_SIZE];
660+ struct device *device;
661+
662+ if (dent->d_name[0] == '.')
663+ continue;
664+
665+ if (read_link(base, dent->d_name, devpath, sizeof(devpath)) < 0)
666+ continue;
667+
668+ device = device_create(devpath, bus, makedev(0, 0));
669+ if (bus_handler) {
670+ if (bus_handler(device) < 0) {
671+ dbg("'%s' bus handler skipped event", devpath);
672+ free(device);
673+ continue;
674+ }
675+ }
676+
677+ device_list_insert(&device_list, device);
678+ }
679+ closedir(dir);
680+ exec_list(&device_list, NULL, NULL);
681+
682+ return 0;
683+}
684+
685+static int udev_scan_devices(void)
686+{
687+ char base[PATH_SIZE];
688+ DIR *dir;
689+ struct dirent *dent;
690+
691+ snprintf(base, sizeof(base), "%s/bus", sysfs_path);
692+ base[sizeof(base)-1] = '\0';
693+
694+ dir = opendir(base);
695+ if (!dir)
696+ return -1;
697+
698+ for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
699+ if (dent->d_name[0] == '.')
700+ continue;
701+ if (dent->d_type != DT_DIR)
702+ continue;
703+
704+ /* add bus specific env values */
705+ if (strcmp(dent->d_name, "pci") == 0)
706+ udev_scan_bus("pci", pci_handler);
707+ else if (strcmp(dent->d_name, "usb") == 0)
708+ udev_scan_bus("usb", usb_handler);
709+ else if (strcmp(dent->d_name, "serio") == 0)
710+ udev_scan_bus("serio", serio_handler);
711+ else if (strcmp(dent->d_name, "ccw") == 0)
712+ udev_scan_bus("ccw", ccw_handler);
713+ else
714+ udev_scan_bus(dent->d_name, modalias_handler);
715+ }
716+ closedir(dir);
717+
718+ return 0;
719+}
720+
721+int main(int argc, char *argv[], char *envp[])
722+{
723+ LIST_HEAD(device_list);
724+ int i;
725+
726+ logging_init("udevcoldplug");
727+ udev_config_init(); sysfs_init();
728+ dbg("version %s", UDEV_VERSION);
729+
730+ udev_log_str = getenv("UDEV_LOG");
731+
732+ /* disable all logging if not explicitely requested */
733+ if (udev_log_str == NULL)
734+ udev_log_priority = 0;
735+
736+ for (i = 1 ; i < argc; i++) {
737+ char *arg = argv[i];
738+
739+ if (strcmp(arg, "help") == 0 || strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) {
740+ printf("Usage: udevcoldplug \n"
741+ " --help print this help text\n\n");
742+ exit(0);
743+ } else {
744+ fprintf(stderr, "unknown option\n\n");
745+ exit(1);
746+ }
747+ }
748+
749+ udevd_sock = socket(AF_LOCAL, SOCK_DGRAM, 0);
750+ if (udevd_sock < 0) {
751+ err("error getting socket");
752+ return 1;
753+ }
754+
755+ /* create nodes for already available devices */
756+ udev_scan_class();
757+ udev_scan_block();
758+
759+ /* synthesize events for bus devices
760+ * may load modules or configure the device */
761+ udev_scan_devices();
762+
763+ if (udevd_sock >= 0)
764+ close(udevd_sock);
765+ logging_close();
766+
767+ return 0;
768+}
769--- udev-081/Makefile
770+++ udev-081/Makefile
771@@ -58,6 +58,7 @@ PROGRAMS = \
772 udevmonitor \
773 udevinfo \
774 udevtest \
775+ udevsynthesize \
776 udevstart
777
778 HEADERS = \
diff --git a/meta/recipes-core/udev/files/udevsynthesize.sh b/meta/recipes-core/udev/files/udevsynthesize.sh
deleted file mode 100644
index d58217c144..0000000000
--- a/meta/recipes-core/udev/files/udevsynthesize.sh
+++ /dev/null
@@ -1,51 +0,0 @@
1#!/bin/sh -e
2
3load_input_modules() {
4 for module in mousedev evdev joydev; do
5 modprobe -q $module || true
6 done
7}
8
9if [ ! -e /sys/class/mem/null/uevent ]; then # <= 2.6.14
10 /lib/udev/udevsynthesize
11 load_input_modules
12 exit 0
13fi
14
15# replace $IFS with something which is not likely to appear in a sysfs path,
16# because some buggy drivers have spaces in their names
17oldifs="$IFS"
18IFS="|"
19
20for file in /sys/bus/*/devices/*/uevent /sys/class/*/*/uevent \
21 /sys/block/*/uevent /sys/block/*/*/uevent; do
22 case "$file" in
23 */device/uevent) ;; # skip followed device symlinks
24 */\*/*) ;;
25
26 */class/mem/*) # for /dev/null
27 first="$first${IFS}$file" ;;
28
29 */block/md[0-9]*)
30 last="$last${IFS}$file" ;;
31
32 *)
33 default="$default${IFS}$file" ;;
34 esac
35done
36
37for file in $first${IFS}$default${IFS}$last; do
38 [ "$file" ] || continue
39 echo 'add' > "$file" || true
40done
41
42IFS="$oldifs"
43
44case "$(uname -r)" in
45 2.6.1[0-5]|2.6.1[0-5][!0-9]*) # <= 2.6.15
46 load_input_modules
47 ;;
48esac
49
50exit 0
51
diff --git a/meta/recipes-core/udev/udev-145/enable-gudev.patch b/meta/recipes-core/udev/udev-145/enable-gudev.patch
deleted file mode 100644
index 8ee402b134..0000000000
--- a/meta/recipes-core/udev/udev-145/enable-gudev.patch
+++ /dev/null
@@ -1,50 +0,0 @@
1Upstream-Status: Inappropriate [configuration]
2
3Index: udev-145/configure.ac
4===================================================================
5--- udev-145.orig/configure.ac 2010-01-29 14:41:29.000000000 +0000
6+++ udev-145/configure.ac 2010-01-29 14:41:54.000000000 +0000
7@@ -49,16 +49,17 @@
8 AC_ARG_ENABLE([extras],
9 AS_HELP_STRING([--disable-extras], [disable extras with external dependencies]),
10 [], [enable_extras=yes])
11+
12+ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.7.0 gobject-2.0 >= 2.7.0])
13+ AC_SUBST([GLIB_CFLAGS])
14+ AC_SUBST([GLIB_LIBS])
15+
16 if test "x$enable_extras" = xyes; then
17 AC_PATH_PROG([GPERF], [gperf])
18 if test -z "$GPERF"; then
19 AC_MSG_ERROR([gperf is needed])
20 fi
21
22- PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.7.0 gobject-2.0 >= 2.7.0])
23- AC_SUBST([GLIB_CFLAGS])
24- AC_SUBST([GLIB_LIBS])
25-
26 AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found]))
27 AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found]))
28
29Index: udev-145/extras/Makefile.am
30===================================================================
31--- udev-145.orig/extras/Makefile.am 2010-01-29 14:43:56.000000000 +0000
32+++ udev-145/extras/Makefile.am 2010-01-29 14:44:11.000000000 +0000
33@@ -12,7 +12,8 @@
34 rule_generator \
35 scsi_id \
36 usb_id \
37- v4l_id
38+ v4l_id \
39+ gudev
40
41 if ENABLE_EXTRAS
42 SUBDIRS += \
43@@ -20,6 +21,5 @@
44 usb-db \
45 hid2hci \
46 keymap \
47- modem-modeswitch \
48- gudev
49+ modem-modeswitch
50 endif
diff --git a/meta/recipes-core/udev/udev-145/init b/meta/recipes-core/udev/udev-145/init
deleted file mode 100644
index eb5e50758b..0000000000
--- a/meta/recipes-core/udev/udev-145/init
+++ /dev/null
@@ -1,59 +0,0 @@
1#!/bin/sh -e
2
3### BEGIN INIT INFO
4# Provides: udev
5# Required-Start: mountvirtfs
6# Required-Stop:
7# Default-Start: S
8# Default-Stop:
9# Short-Description: Start udevd, populate /dev and load drivers.
10### END INIT INFO
11
12export TZ=/etc/localtime
13
14[ -d /sys/class ] || exit 1
15[ -r /proc/mounts ] || exit 1
16[ -x /sbin/udevd ] || exit 1
17[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
18
19kill_udevd() {
20 if [ -x /sbin/pidof ]; then
21 pid=`/sbin/pidof -x udevd`
22 [ -n "$pid" ] && kill $pid
23 fi
24}
25
26export ACTION=add
27# propagate /dev from /sys
28echo -n "Starting udev"
29
30# mount the tmpfs on /dev, if not already done
31LANG=C awk "\$2 == \"/dev\" && \$4 == \"tmpfs\" { exit 1 }" /proc/mounts && {
32 mount -n -o mode=0755 -t tmpfs none "/dev"
33 mkdir -m 0755 /dev/pts
34 mkdir -m 1777 /dev/shm
35}
36
37if [ -e /etc/dev.tar ]; then
38 (cd /; tar xf /etc/dev.tar)
39 not_first_boot=1
40fi
41
42# make_extra_nodes
43kill_udevd > "/dev/null" 2>&1
44
45 # trigger the sorted events
46 echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
47 /sbin/udevd -d
48
49 /sbin/udevadm control --env=STARTUP=1
50 if [ "$not_first_boot" != "" ];then
51 /sbin/udevadm trigger --subsystem-nomatch=tty --subsystem-nomatch=mem --subsystem-nomatch=vc --subsystem-nomatch=vtconsole --subsystem-nomatch=misc --subsystem-nomatch=dcon --subsystem-nomatch=pci_bus --subsystem-nomatch=graphics --subsystem-nomatch=backlight --subsystem-nomatch=video4linux --subsystem-nomatch=platform
52 (/sbin/udevadm settle --timeout=3; /sbin/udevadm control --env=STARTUP=)&
53 else
54 /sbin/udevadm trigger
55 /sbin/udevadm settle
56 fi
57
58echo
59exit 0
diff --git a/meta/recipes-core/udev/udev-145/local.rules b/meta/recipes-core/udev/udev-145/local.rules
deleted file mode 100644
index dab319b431..0000000000
--- a/meta/recipes-core/udev/udev-145/local.rules
+++ /dev/null
@@ -1,33 +0,0 @@
1# There are a number of modifiers that are allowed to be used in some
2# of the different fields. They provide the following subsitutions:
3#
4# %n the "kernel number" of the device.
5# For example, 'sda3' has a "kernel number" of '3'
6# %e the smallest number for that name which does not matches an existing node
7# %k the kernel name for the device
8# %M the kernel major number for the device
9# %m the kernel minor number for the device
10# %b the bus id for the device
11# %c the string returned by the PROGRAM
12# %s{filename} the content of a sysfs attribute
13# %% the '%' char itself
14#
15
16# Media automounting
17SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/mount.sh"
18SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh"
19
20# Handle network interface setup
21SUBSYSTEM=="net", ACTION=="add" RUN+="/etc/udev/scripts/network.sh"
22SUBSYSTEM=="net", ACTION=="remove" RUN+="/etc/udev/scripts/network.sh"
23
24# The first rtc device is symlinked to /dev/rtc
25KERNEL=="rtc0", SYMLINK+="rtc"
26
27# Try and modprobe for drivers for new hardware
28ACTION=="add", DEVPATH=="/devices/*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}"
29
30# Create a symlink to any touchscreen input device
31# Need to use ../ so the eventX can find the parent inputX modalias which is a directory above
32SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{../modalias}=="input:*-e0*,3,*a0,1,*18,*", SYMLINK+="input/touchscreen0"
33
diff --git a/meta/recipes-core/udev/udev-145/noasmlinkage.patch b/meta/recipes-core/udev/udev-145/noasmlinkage.patch
deleted file mode 100644
index 6d22b1d681..0000000000
--- a/meta/recipes-core/udev/udev-145/noasmlinkage.patch
+++ /dev/null
@@ -1,50 +0,0 @@
1Upstream-Status: Inappropriate [legacy version]
2
3Index: udev-141/udev/test-udev.c
4===================================================================
5--- udev-141.orig/udev/test-udev.c 2008-10-24 09:07:24.000000000 +0100
6+++ udev-141/udev/test-udev.c 2009-04-14 15:34:01.000000000 +0100
7@@ -30,7 +30,7 @@
8
9 #include "udev.h"
10
11-static void asmlinkage sig_handler(int signum)
12+static void sig_handler(int signum)
13 {
14 switch (signum) {
15 case SIGALRM:
16Index: udev-141/udev/udevadm-monitor.c
17===================================================================
18--- udev-141.orig/udev/udevadm-monitor.c 2009-03-29 19:07:01.000000000 +0100
19+++ udev-141/udev/udevadm-monitor.c 2009-04-14 15:34:01.000000000 +0100
20@@ -35,7 +35,7 @@
21
22 static int udev_exit;
23
24-static void asmlinkage sig_handler(int signum)
25+static void sig_handler(int signum)
26 {
27 if (signum == SIGINT || signum == SIGTERM)
28 udev_exit = 1;
29Index: udev-141/udev/udevd.c
30===================================================================
31--- udev-141.orig/udev/udevd.c 2009-03-29 19:07:01.000000000 +0100
32+++ udev-141/udev/udevd.c 2009-04-14 15:34:56.000000000 +0100
33@@ -172,7 +172,7 @@
34 udev_event_unref(event);
35 }
36
37-static void asmlinkage event_sig_handler(int signum)
38+static void event_sig_handler(int signum)
39 {
40 if (signum == SIGALRM)
41 exit(1);
42@@ -583,7 +583,7 @@
43 return 0;
44 }
45
46-static void asmlinkage sig_handler(int signum)
47+static void sig_handler(int signum)
48 {
49 switch (signum) {
50 case SIGINT:
diff --git a/meta/recipes-core/udev/udev-145/permissions.rules b/meta/recipes-core/udev/udev-145/permissions.rules
deleted file mode 100644
index 205b733292..0000000000
--- a/meta/recipes-core/udev/udev-145/permissions.rules
+++ /dev/null
@@ -1,131 +0,0 @@
1ACTION!="add", GOTO="permissions_end"
2
3# workarounds needed to synchronize with sysfs
4# only needed for kernels < v2.6.18-rc1
5ENV{PHYSDEVPATH}!="?*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus"
6SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", WAIT_FOR_SYSFS="ioerr_cnt"
7# only needed for kernels < 2.6.16
8SUBSYSTEM=="net", WAIT_FOR_SYSFS="address"
9# only needed for kernels < 2.6.17
10SUBSYSTEM=="net", ENV{DRIVER}=="?*", WAIT_FOR_SYSFS="device/driver"
11
12# devices needed to load the drivers providing them
13KERNEL=="tun", OPTIONS+="ignore_remove"
14KERNEL=="ppp", OPTIONS+="ignore_remove"
15KERNEL=="loop[0-9]*", OPTIONS+="ignore_remove"
16
17# default permissions for block devices
18SUBSYSTEM=="block", GROUP="disk"
19# the aacraid driver is broken and reports that disks removable (see #404927)
20SUBSYSTEM=="block", ATTRS{removable}=="1", \
21 DRIVERS!="aacraid", GROUP="floppy"
22# all block devices on these buses are "removable"
23SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394|mmc|pcmcia", GROUP="floppy"
24
25# IDE devices
26KERNEL=="hd[a-z]|pcd[0-9]*", DRIVERS=="ide-cdrom|pcd", \
27 IMPORT{program}="cdrom_id --export $tempnode"
28ENV{ID_CDROM}=="?*", GROUP="cdrom"
29KERNEL=="ht[0-9]*", GROUP="tape"
30KERNEL=="nht[0-9]*", GROUP="tape"
31
32# SCSI devices
33KERNEL=="sr[0-9]*", IMPORT{program}="cdrom_id --export $tempnode"
34SUBSYSTEMS=="scsi", ATTRS{type}=="1", GROUP="tape"
35SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="HP", GROUP="scanner"
36SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="Epson", GROUP="scanner"
37SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="EPSON", GROUP="scanner"
38SUBSYSTEMS=="scsi", ATTRS{type}=="4", GROUP="cdrom"
39SUBSYSTEMS=="scsi", ATTRS{type}=="5", GROUP="cdrom"
40SUBSYSTEMS=="scsi", ATTRS{type}=="6", GROUP="scanner"
41SUBSYSTEMS=="scsi", ATTRS{type}=="8", GROUP="tape"
42
43# USB devices
44KERNEL=="legousbtower*", MODE="0666"
45KERNEL=="lp[0-9]*", SUBSYSTEMS=="usb", GROUP="lp"
46
47# usbfs-like devices
48SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \
49 MODE="0664"
50
51# iRiver music players
52SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="plugdev", \
53 ATTRS{idVendor}=="4102", ATTRS{idProduct}=="10[01][135789]"
54
55# serial devices
56SUBSYSTEM=="tty", GROUP="dialout"
57SUBSYSTEM=="capi", GROUP="dialout"
58SUBSYSTEM=="slamr", GROUP="dialout"
59SUBSYSTEM=="zaptel", GROUP="dialout"
60
61# vc devices (all members of the tty subsystem)
62KERNEL=="ptmx", MODE="0666", GROUP="root"
63KERNEL=="console", MODE="0600", GROUP="root"
64KERNEL=="tty", MODE="0666", GROUP="root"
65KERNEL=="tty[0-9]*", GROUP="root"
66KERNEL=="pty*", MODE="0666", GROUP="tty"
67
68# video devices
69SUBSYSTEM=="video4linux", GROUP="video"
70SUBSYSTEM=="drm", GROUP="video"
71SUBSYSTEM=="dvb", GROUP="video"
72SUBSYSTEM=="em8300", GROUP="video"
73SUBSYSTEM=="graphics", GROUP="video"
74SUBSYSTEM=="nvidia", GROUP="video"
75
76# misc devices
77KERNEL=="random", MODE="0666"
78KERNEL=="urandom", MODE="0666"
79KERNEL=="mem", MODE="0640", GROUP="kmem"
80KERNEL=="kmem", MODE="0640", GROUP="kmem"
81KERNEL=="port", MODE="0640", GROUP="kmem"
82KERNEL=="full", MODE="0666"
83KERNEL=="null", MODE="0666"
84KERNEL=="zero", MODE="0666"
85KERNEL=="inotify", MODE="0666"
86KERNEL=="sgi_fetchop", MODE="0666"
87KERNEL=="sonypi", MODE="0666"
88KERNEL=="agpgart", GROUP="video"
89KERNEL=="nvram", GROUP="nvram"
90KERNEL=="rtc|rtc[0-9]*", GROUP="audio"
91KERNEL=="tpm*", MODE="0600", OWNER="tss", GROUP="tss"
92KERNEL=="fuse", GROUP="fuse"
93KERNEL=="kqemu", MODE="0666"
94KERNEL=="kvm", GROUP="kvm"
95KERNEL=="tun", MODE="0666",
96
97KERNEL=="cdemu[0-9]*", GROUP="cdrom"
98KERNEL=="pktcdvd[0-9]*", GROUP="cdrom"
99KERNEL=="pktcdvd", MODE="0644"
100
101KERNEL=="uverbs*", GROUP="rdma"
102KERNEL=="ucm*", GROUP="rdma"
103KERNEL=="rdma_ucm", GROUP="rdma"
104
105# printers and parallel devices
106SUBSYSTEM=="printer", GROUP="lp"
107SUBSYSTEM=="ppdev", GROUP="lp"
108KERNEL=="irlpt*", GROUP="lp"
109KERNEL=="pt[0-9]*", GROUP="tape"
110KERNEL=="pht[0-9]*", GROUP="tape"
111
112# sound devices
113SUBSYSTEM=="sound", GROUP="audio"
114
115# ieee1394 devices
116KERNEL=="raw1394", GROUP="disk"
117KERNEL=="dv1394*", GROUP="video"
118KERNEL=="video1394*", GROUP="video"
119
120# input devices
121KERNEL=="event[0-9]*", ATTRS{name}=="*dvb*|*DVB*|* IR *" \
122 MODE="0664", GROUP="video"
123KERNEL=="js[0-9]*", MODE="0664"
124KERNEL=="lirc[0-9]*", GROUP="video"
125
126# AOE character devices
127SUBSYSTEM=="aoe", MODE="0220", GROUP="disk"
128SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440"
129
130LABEL="permissions_end"
131
diff --git a/meta/recipes-core/udev/udev-145/run.rules b/meta/recipes-core/udev/udev-145/run.rules
deleted file mode 100644
index 75d71375bb..0000000000
--- a/meta/recipes-core/udev/udev-145/run.rules
+++ /dev/null
@@ -1,14 +0,0 @@
1# debugging monitor
2RUN+="socket:/org/kernel/udev/monitor"
3
4# run a command on remove events
5ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}"
6
7# ignore the events generated by virtual consoles
8KERNEL=="ptmx", OPTIONS+="last_rule"
9KERNEL=="console", OPTIONS+="last_rule"
10KERNEL=="tty" , OPTIONS+="last_rule"
11KERNEL=="tty[0-9]*", OPTIONS+="last_rule"
12KERNEL=="pty*", OPTIONS+="last_rule"
13SUBSYSTEM=="vc", OPTIONS+="last_rule"
14
diff --git a/meta/recipes-core/udev/udev-145/udev.rules b/meta/recipes-core/udev/udev-145/udev.rules
deleted file mode 100644
index a19d4a0bf6..0000000000
--- a/meta/recipes-core/udev/udev-145/udev.rules
+++ /dev/null
@@ -1,116 +0,0 @@
1# There are a number of modifiers that are allowed to be used in some
2# of the different fields. They provide the following subsitutions:
3#
4# %n the "kernel number" of the device.
5# For example, 'sda3' has a "kernel number" of '3'
6# %e the smallest number for that name which does not matches an existing node
7# %k the kernel name for the device
8# %M the kernel major number for the device
9# %m the kernel minor number for the device
10# %b the bus id for the device
11# %c the string returned by the PROGRAM
12# %s{filename} the content of a sysfs attribute
13# %% the '%' char itself
14#
15
16# workaround for devices which do not report media changes
17SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", \
18 ENV{ID_MODEL}=="IOMEGA_ZIP*", NAME="%k", OPTIONS+="all_partitions"
19SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTRS{media}=="floppy", \
20 OPTIONS+="all_partitions"
21
22# SCSI devices
23SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n"
24
25# USB devices
26SUBSYSTEMS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k"
27SUBSYSTEMS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k"
28SUBSYSTEMS=="usb", KERNEL=="dabusb*", NAME="usb/%k"
29SUBSYSTEMS=="usb", KERNEL=="hiddev*", NAME="usb/%k"
30SUBSYSTEMS=="usb", KERNEL=="legousbtower*", NAME="usb/%k"
31SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k"
32SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \
33 ATTRS{product}=="Palm Handheld*|Handspring Visor|palmOne Handheld", \
34 SYMLINK+="pilot"
35
36# usbfs-like devices
37SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add", \
38 NAME="%c"
39SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}"
40
41# serial devices
42KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20"
43KERNEL=="capi[0-9]*", NAME="capi/%n"
44
45# video devices
46KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", ACTION=="add", \
47 NAME="%c"
48KERNEL=="card[0-9]*", NAME="dri/%k"
49
50# misc devices
51KERNEL=="hw_random", NAME="hwrng"
52KERNEL=="tun", NAME="net/%k"
53KERNEL=="evtchn", NAME="xen/%k"
54
55KERNEL=="cdemu[0-9]*", NAME="cdemu/%n"
56KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n"
57KERNEL=="pktcdvd", NAME="pktcdvd/control"
58
59KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid"
60KERNEL=="msr[0-9]*", NAME="cpu/%n/msr"
61KERNEL=="microcode", NAME="cpu/microcode"
62
63KERNEL=="umad*", NAME="infiniband/%k"
64KERNEL=="issm*", NAME="infiniband/%k"
65KERNEL=="uverbs*", NAME="infiniband/%k"
66KERNEL=="ucm*", NAME="infiniband/%k"
67KERNEL=="rdma_ucm", NAME="infiniband/%k"
68
69# ALSA devices
70KERNEL=="controlC[0-9]*", NAME="snd/%k"
71KERNEL=="hwC[D0-9]*", NAME="snd/%k"
72KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k"
73KERNEL=="midiC[D0-9]*", NAME="snd/%k"
74KERNEL=="timer", NAME="snd/%k"
75KERNEL=="seq", NAME="snd/%k"
76
77# ieee1394 devices
78KERNEL=="dv1394*", NAME="dv1394/%n"
79KERNEL=="video1394*", NAME="video1394/%n"
80
81# input devices
82KERNEL=="mice", NAME="input/%k"
83KERNEL=="mouse[0-9]*", NAME="input/%k"
84KERNEL=="event[0-9]*", NAME="input/%k"
85KERNEL=="js[0-9]*", NAME="input/%k"
86KERNEL=="ts[0-9]*", NAME="input/%k"
87KERNEL=="uinput", NAME="input/%k"
88
89# Zaptel
90KERNEL=="zapctl", NAME="zap/ctl"
91KERNEL=="zaptimer", NAME="zap/timer"
92KERNEL=="zapchannel", NAME="zap/channel"
93KERNEL=="zappseudo", NAME="zap/pseudo"
94KERNEL=="zap[0-9]*", NAME="zap/%n"
95
96# AOE character devices
97SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k"
98SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k"
99SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k"
100SUBSYSTEM=="aoe", KERNEL=="revalidate", NAME="etherd/%k"
101
102# device mapper creates its own device nodes, so ignore these
103KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device"
104KERNEL=="device-mapper", NAME="mapper/control"
105
106KERNEL=="rfcomm[0-9]*", NAME="%k", GROUP="users", MODE="0660"
107
108# Firmware Helper
109ACTION=="add", SUBSYSTEM=="firmware", RUN+="/lib/udev/firmware.sh"
110
111# Samsung UARTS
112KERNEL=="s3c2410_serial[0-9]", NAME="ttySAC%n"
113
114# MXC UARTs
115KERNEL=="ttymxc[0-4]", NAME="ttymxc%n"
116
diff --git a/meta/recipes-core/udev/udev-145/unbreak.patch b/meta/recipes-core/udev/udev-145/unbreak.patch
deleted file mode 100644
index ef45c093e2..0000000000
--- a/meta/recipes-core/udev/udev-145/unbreak.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1Upstream-Status: Inappropriate [legacy version]
2
3Index: udev-141/extras/volume_id/lib/Makefile.am
4===================================================================
5--- udev-141.orig/extras/volume_id/lib/Makefile.am 2009-05-17 23:36:16.000000000 +0100
6+++ udev-141/extras/volume_id/lib/Makefile.am 2009-05-17 23:36:26.000000000 +0100
7@@ -54,19 +54,6 @@
8 -version-info $(VOLID_LT_CURRENT):$(VOLID_LT_REVISION):$(VOLID_LT_AGE) \
9 -export-symbols $(top_srcdir)/extras/volume_id/lib/exported_symbols
10
11-# move devel files to $(prefix)$(libdir_name) if needed
12-install-data-hook:
13- rm $(DESTDIR)$(rootlibdir)/libvolume_id.la
14- if test "$(prefix)" != "$(exec_prefix)"; then \
15- mkdir -p $(DESTDIR)$(prefix)/$(libdir_name); \
16- mv $(DESTDIR)$(rootlibdir)/libvolume_id.a $(DESTDIR)$(prefix)/$(libdir_name)/; \
17- so_img_name=$$(readlink $(DESTDIR)$(rootlibdir)/libvolume_id.so); \
18- rm $(DESTDIR)$(rootlibdir)/libvolume_id.so; \
19- so_img_rel_target_prefix=$$(echo $(prefix)/$(libdir_name) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \
20- ln -sf $$so_img_rel_target_prefix$(exec_prefix)/$(libdir_name)/$$so_img_name \
21- $(DESTDIR)$(prefix)/$(libdir_name)/libvolume_id.so; \
22- fi
23-
24 EXTRA_DIST = \
25 exported_symbols
26
diff --git a/meta/recipes-core/udev/udev.inc b/meta/recipes-core/udev/udev.inc
deleted file mode 100644
index eb096eee98..0000000000
--- a/meta/recipes-core/udev/udev.inc
+++ /dev/null
@@ -1,72 +0,0 @@
1SUMMARY = "/dev/ and hotplug management daemon"
2DESCRIPTION = "udev is a program which dynamically creates and removes device nodes from \
3/dev/. It responds to /sbin/hotplug device events and requires a 2.6 kernel."
4LICENSE = "GPLv2.0+ & LGPLv2.1+"
5
6SRC_URI += " \
7 file://udev.rules \
8 file://devfs-udev.rules \
9 file://links.conf \
10 file://permissions.rules \
11 file://mount.sh \
12 file://network.sh \
13 file://local.rules \
14 file://udev-cache \
15 file://init"
16
17UDEV_DEVFS_RULES ?= "0"
18
19PACKAGES =+ "udev-utils libvolume-id udev-cache"
20FILES_udev-utils = "${usrbindir}/udevinfo ${usrbindir}/udevtest"
21FILES_libvolume-id = "${base_libdir}/libvolume_id.so.*"
22FILES_udev-cache = "${sysconfdir}/init.d/udev-cache"
23
24RRECOMMENDS_${PN} += "udev-extraconf udev-cache"
25
26inherit update-rc.d autotools pkgconfig
27
28INITSCRIPT_PACKAGES = "udev udev-cache"
29INITSCRIPT_NAME_udev = "udev"
30INITSCRIPT_PARAMS_udev = "start 04 S ."
31INITSCRIPT_NAME_udev-cache = "udev-cache"
32INITSCRIPT_PARAMS_udev-cache = "start 36 S ."
33
34export CROSS = "${TARGET_PREFIX}"
35export HOSTCC = "${BUILD_CC}"
36export udevdir ?= "/dev"
37export usrbindir := "${bindir}"
38export usrsbindir := "${sbindir}"
39export etcdir = "${sysconfdir}"
40LD = "${CC}"
41bindir = "/bin"
42sbindir = "/sbin"
43
44UDEV_EXTRAS = "<override me>"
45FILES_${PN} += "${usrbindir}/* ${usrsbindir}/*"
46FILES_${PN}-dbg += "${usrbindir}/.debug ${usrsbindir}/.debug"
47EXTRA_OEMAKE = "-e \
48 'EXTRAS=${UDEV_EXTRAS}' \
49 'STRIP=echo'"
50
51do_install () {
52 install -d ${D}${usrsbindir} \
53 ${D}${sbindir}
54 oe_runmake 'DESTDIR=${D}' INSTALL=install install
55 install -d ${D}${sysconfdir}/init.d
56 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
57 install -m 0755 ${WORKDIR}/udev-cache ${D}${sysconfdir}/init.d/udev-cache
58
59 install -d ${D}${sysconfdir}/udev/rules.d/
60
61 install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules
62 install -m 0644 ${WORKDIR}/permissions.rules ${D}${sysconfdir}/udev/rules.d/permissions.rules
63 install -m 0644 ${WORKDIR}/udev.rules ${D}${sysconfdir}/udev/rules.d/udev.rules
64 if [ "${UDEV_DEVFS_RULES}" = "1" ]; then
65 install -m 0644 ${WORKDIR}/devfs-udev.rules ${D}${sysconfdir}/udev/rules.d/devfs-udev.rules
66 fi
67
68 install -d ${D}${sysconfdir}/udev/scripts/
69
70 install -m 0755 ${WORKDIR}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh
71 install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts
72}
diff --git a/meta/recipes-core/udev/udev_145.bb b/meta/recipes-core/udev/udev_145.bb
deleted file mode 100644
index b2e2294249..0000000000
--- a/meta/recipes-core/udev/udev_145.bb
+++ /dev/null
@@ -1,55 +0,0 @@
1RPROVIDES_${PN} = "hotplug"
2
3PR = "r11"
4
5SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \
6 file://enable-gudev.patch \
7 file://run.rules \
8 "
9
10require udev.inc
11
12INITSCRIPT_PARAMS = "start 03 S ."
13
14FILES_${PN} += "${base_libdir}/udev/*"
15FILES_${PN}-dbg += "${base_libdir}/udev/.debug"
16UDEV_EXTRAS = "extras/firmware/ extras/scsi_id/ extras/volume_id/"
17
18EXTRA_OECONF = "--with-udev-prefix= --disable-extras --disable-introspection"
19
20DEPENDS += "glib-2.0"
21
22do_install () {
23 install -d ${D}${usrsbindir} \
24 ${D}${sbindir}
25 oe_runmake 'DESTDIR=${D}' INSTALL=install install
26 install -d ${D}${sysconfdir}/init.d
27 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
28 install -m 0755 ${WORKDIR}/udev-cache ${D}${sysconfdir}/init.d/udev-cache
29
30 install -d ${D}${sysconfdir}/udev/rules.d/
31
32 cp ${S}/rules/rules.d/* ${D}${sysconfdir}/udev/rules.d/
33 cp ${S}/rules/packages/* ${D}${sysconfdir}/udev/rules.d/
34 install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules
35 #install -m 0644 ${WORKDIR}/permissions.rules ${D}${sysconfdir}/udev/rules.d/permissions.rules
36 #install -m 0644 ${WORKDIR}/run.rules ${D}${sysconfdir}/udev/rules.d/run.rules
37 #install -m 0644 ${WORKDIR}/udev.rules ${D}${sysconfdir}/udev/rules.d/udev.rules
38 #install -m 0644 ${WORKDIR}/links.conf ${D}${sysconfdir}/udev/links.conf
39 #if [ "${UDEV_DEVFS_RULES}" = "1" ]; then
40 # install -m 0644 ${WORKDIR}/devfs-udev.rules ${D}${sysconfdir}/udev/rules.d/devfs-udev.rules
41 #fi
42
43 # Remove some default rules that don't work well on embedded devices
44 #rm ${D}${sysconfdir}/udev/rules.d/60-persistent-input.rules
45 #rm ${D}${sysconfdir}/udev/rules.d/60-persistent-storage.rules
46 #rm ${D}${sysconfdir}/udev/rules.d/60-persistent-storage-tape.rules
47
48 install -d ${D}${sysconfdir}/udev/scripts/
49
50 install -m 0755 ${WORKDIR}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh
51 install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts
52
53 install -d ${D}${base_libdir}/udev/
54}
55