diff options
| author | Koen Kooi <koen@dominion.thruhere.net> | 2011-05-29 21:15:33 +0200 |
|---|---|---|
| committer | Koen Kooi <koen@dominion.thruhere.net> | 2011-05-30 13:54:49 +0200 |
| commit | a753f40478a1b4b7ee831f880bc5cac0cddb3758 (patch) | |
| tree | f82d14827a5fdf70235ac353478133f49e22a8ec | |
| parent | c1111466bd1307f810c4494573bb28f924dceda4 (diff) | |
| download | meta-openembedded-a753f40478a1b4b7ee831f880bc5cac0cddb3758.tar.gz | |
udev: drop 168 and associated files
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
17 files changed, 0 insertions, 1537 deletions
diff --git a/meta-oe/recipes-core/udev/udev/links.conf b/meta-oe/recipes-core/udev/udev/links.conf deleted file mode 100644 index a9f8b58b27..0000000000 --- a/meta-oe/recipes-core/udev/udev/links.conf +++ /dev/null | |||
| @@ -1,24 +0,0 @@ | |||
| 1 | # This file does not exist. Please do not ask the debian maintainer about it. | ||
| 2 | # You may use it to do strange and wonderful things, at your risk. | ||
| 3 | |||
| 4 | L fd /proc/self/fd | ||
| 5 | L stdin /proc/self/fd/0 | ||
| 6 | L stdout /proc/self/fd/1 | ||
| 7 | L stderr /proc/self/fd/2 | ||
| 8 | L core /proc/kcore | ||
| 9 | L sndstat /proc/asound/oss/sndstat | ||
| 10 | L MAKEDEV /sbin/MAKEDEV | ||
| 11 | |||
| 12 | D pts | ||
| 13 | D shm | ||
| 14 | |||
| 15 | M null c 1 3 | ||
| 16 | M console c 5 1 | ||
| 17 | |||
| 18 | # Hic sunt leones. | ||
| 19 | M ppp c 108 0 | ||
| 20 | D loop | ||
| 21 | M loop/0 b 7 0 | ||
| 22 | D net | ||
| 23 | M net/tun c 10 200 | ||
| 24 | |||
diff --git a/meta-oe/recipes-core/udev/udev/local.rules b/meta-oe/recipes-core/udev/udev/local.rules deleted file mode 100644 index da4b38593c..0000000000 --- a/meta-oe/recipes-core/udev/udev/local.rules +++ /dev/null | |||
| @@ -1,35 +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 | ||
| 17 | SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/mount.sh" | ||
| 18 | SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh" | ||
| 19 | |||
| 20 | # Handle network interface setup | ||
| 21 | SUBSYSTEM=="net", ACTION=="add" RUN+="/etc/udev/scripts/network.sh" | ||
| 22 | SUBSYSTEM=="net", ACTION=="remove" RUN+="/etc/udev/scripts/network.sh" | ||
| 23 | |||
| 24 | # The first rtc device is symlinked to /dev/rtc | ||
| 25 | KERNEL=="rtc0", SYMLINK+="rtc" | ||
| 26 | |||
| 27 | #The first framebuffer is symlinked to /dev/fb | ||
| 28 | KERNEL=="fb0", SYMLINK+="fb" | ||
| 29 | |||
| 30 | # Try and modprobe for drivers for new hardware | ||
| 31 | ACTION=="add", DEVPATH=="/devices/*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" | ||
| 32 | |||
| 33 | # Create a symlink to any touchscreen input device | ||
| 34 | SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="input:*-e0*,3,*a0,1,*18,*", SYMLINK+="input/touchscreen0" | ||
| 35 | SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="ads7846", SYMLINK+="input/touchscreen0" | ||
diff --git a/meta-oe/recipes-core/udev/udev/mount.blacklist b/meta-oe/recipes-core/udev/udev/mount.blacklist deleted file mode 100644 index d3ebb17176..0000000000 --- a/meta-oe/recipes-core/udev/udev/mount.blacklist +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | /dev/loop | ||
| 2 | /dev/ram | ||
| 3 | /dev/mtdblock | ||
diff --git a/meta-oe/recipes-core/udev/udev/mount.sh b/meta-oe/recipes-core/udev/udev/mount.sh deleted file mode 100644 index 81bcfba5e3..0000000000 --- a/meta-oe/recipes-core/udev/udev/mount.sh +++ /dev/null | |||
| @@ -1,72 +0,0 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | # Called from udev | ||
| 4 | # Attemp to mount any added block devices | ||
| 5 | # and remove any removed devices | ||
| 6 | # | ||
| 7 | |||
| 8 | MOUNT="/bin/mount" | ||
| 9 | PMOUNT="/usr/bin/pmount" | ||
| 10 | UMOUNT="/bin/umount" | ||
| 11 | name="`basename "$DEVNAME"`" | ||
| 12 | |||
| 13 | for line in `cat /etc/udev/mount.blacklist | grep -v ^#` | ||
| 14 | do | ||
| 15 | if ( echo "$DEVNAME" | grep -q "$line" ) | ||
| 16 | then | ||
| 17 | logger "udev/mount.sh" "[$DEVNAME] is blacklisted, ignoring" | ||
| 18 | exit 0 | ||
| 19 | fi | ||
| 20 | done | ||
| 21 | |||
| 22 | automount() { | ||
| 23 | ! test -d "/media/$name" && mkdir -p "/media/$name" | ||
| 24 | |||
| 25 | if ! $MOUNT -t auto -o async,relatime $DEVNAME "/media/$name" | ||
| 26 | then | ||
| 27 | #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/media/$name\" failed!" | ||
| 28 | rm_dir "/media/$name" | ||
| 29 | else | ||
| 30 | logger "mount.sh/automount" "Auto-mount of [/media/$name] successful" | ||
| 31 | touch "/tmp/.automount-$name" | ||
| 32 | fi | ||
| 33 | } | ||
| 34 | |||
| 35 | rm_dir() { | ||
| 36 | # We do not want to rm -r populated directories | ||
| 37 | if test "`find "$1" | wc -l | tr -d " "`" -lt 2 -a -d "$1" | ||
| 38 | then | ||
| 39 | ! test -z "$1" && rm -r "$1" | ||
| 40 | else | ||
| 41 | logger "mount.sh/automount" "Not removing non-empty directory [$1]" | ||
| 42 | fi | ||
| 43 | } | ||
| 44 | |||
| 45 | if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ]; then | ||
| 46 | if [ -x "$PMOUNT" ]; then | ||
| 47 | $PMOUNT $DEVNAME 2> /dev/null | ||
| 48 | elif [ -x $MOUNT ]; then | ||
| 49 | $MOUNT $DEVNAME 2> /dev/null | ||
| 50 | fi | ||
| 51 | |||
| 52 | # If the device isn't mounted at this point, it isn't configured in fstab | ||
| 53 | # 20061107: Small correction: The rootfs partition may be called just "rootfs" and not by | ||
| 54 | # its true device name so this would break. If the rootfs is mounted on two places | ||
| 55 | # during boot, it confuses the heck out of fsck. So Im auto-adding the root-partition | ||
| 56 | # to /etc/udev/mount.blacklist via postinst | ||
| 57 | |||
| 58 | cat /proc/mounts | awk '{print $1}' | grep -q "^$DEVNAME$" || automount | ||
| 59 | |||
| 60 | fi | ||
| 61 | |||
| 62 | |||
| 63 | |||
| 64 | if [ "$ACTION" = "remove" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then | ||
| 65 | for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 -d " " ` | ||
| 66 | do | ||
| 67 | $UMOUNT -l $mnt | ||
| 68 | done | ||
| 69 | |||
| 70 | # Remove empty directories from auto-mounter | ||
| 71 | test -e "/tmp/.automount-$name" && rm_dir "/media/$name" | ||
| 72 | fi | ||
diff --git a/meta-oe/recipes-core/udev/udev/network.sh b/meta-oe/recipes-core/udev/udev/network.sh deleted file mode 100644 index 182c26d86a..0000000000 --- a/meta-oe/recipes-core/udev/udev/network.sh +++ /dev/null | |||
| @@ -1,58 +0,0 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # udevd does clearenv(). Export shell PATH to children. | ||
| 4 | export PATH | ||
| 5 | |||
| 6 | # Do not run when pcmcia-cs is installed | ||
| 7 | test -x /sbin/cardctl && exit 0 | ||
| 8 | |||
| 9 | # We get two "add" events for hostap cards due to wifi0 | ||
| 10 | echo "$INTERFACE" | grep -q wifi && exit 0 | ||
| 11 | |||
| 12 | |||
| 13 | # Check if /etc/init.d/network has been run yet to see if we are | ||
| 14 | # called by starting /etc/rcS.d/S03udev and not by hotplugging a device | ||
| 15 | # | ||
| 16 | # At this stage, network interfaces should not be brought up | ||
| 17 | # automatically because: | ||
| 18 | # a) /etc/init.d/network has not been run yet (security issue) | ||
| 19 | # b) /var has not been populated yet so /etc/resolv,conf points to | ||
| 20 | # oblivion, making the network unusable | ||
| 21 | # | ||
| 22 | |||
| 23 | spoofp="`grep ^spoofprotect /etc/network/options`" | ||
| 24 | if test -z "$spoofp" | ||
| 25 | then | ||
| 26 | # This is the default from /etc/init.d/network | ||
| 27 | spoofp_val=yes | ||
| 28 | else | ||
| 29 | spoofp_val=${spoofp#spoofprotect=} | ||
| 30 | fi | ||
| 31 | |||
| 32 | test "$spoofp_val" = yes && spoofp_val=1 || spoofp_val=0 | ||
| 33 | |||
| 34 | # I think it is safe to assume that "lo" will always be there ;) | ||
| 35 | if test "`cat /proc/sys/net/ipv4/conf/lo/rp_filter`" != "$spoofp_val" -a -n "$spoofp_val" | ||
| 36 | then | ||
| 37 | echo "$INTERFACE" >> /dev/udev_network_queue | ||
| 38 | exit 0 | ||
| 39 | fi | ||
| 40 | |||
| 41 | # | ||
| 42 | # Code taken from pcmcia-cs:/etc/pcmcia/network | ||
| 43 | # | ||
| 44 | |||
| 45 | # if this interface has an entry in /etc/network/interfaces, let ifupdown | ||
| 46 | # handle it | ||
| 47 | if grep -q "iface \+$INTERFACE" /etc/network/interfaces; then | ||
| 48 | case $ACTION in | ||
| 49 | add) | ||
| 50 | ifconfig | grep -q "^$INTERFACE" || ifup $INTERFACE | ||
| 51 | ;; | ||
| 52 | remove) | ||
| 53 | ifdown $INTERFACE | ||
| 54 | ;; | ||
| 55 | esac | ||
| 56 | |||
| 57 | exit 0 | ||
| 58 | fi | ||
diff --git a/meta-oe/recipes-core/udev/udev/noasmlinkage.patch b/meta-oe/recipes-core/udev/udev/noasmlinkage.patch deleted file mode 100644 index 0d8e854c0e..0000000000 --- a/meta-oe/recipes-core/udev/udev/noasmlinkage.patch +++ /dev/null | |||
| @@ -1,38 +0,0 @@ | |||
| 1 | |||
| 2 | # | ||
| 3 | # Patch managed by http://www.holgerschurig.de/patcher.html | ||
| 4 | # | ||
| 5 | |||
| 6 | --- udev-062/udev.c~noasmlinkage.patch | ||
| 7 | +++ udev-062/udev.c | ||
| 8 | @@ -54,7 +54,7 @@ | ||
| 9 | } | ||
| 10 | #endif | ||
| 11 | |||
| 12 | -static void asmlinkage sig_handler(int signum) | ||
| 13 | +static void sig_handler(int signum) | ||
| 14 | { | ||
| 15 | switch (signum) { | ||
| 16 | case SIGALRM: | ||
| 17 | --- udev-062/udevd.c~noasmlinkage.patch | ||
| 18 | +++ udev-062/udevd.c | ||
| 19 | @@ -639,7 +639,7 @@ | ||
| 20 | return msg; | ||
| 21 | } | ||
| 22 | |||
| 23 | -static void asmlinkage sig_handler(int signum) | ||
| 24 | +static void sig_handler(int signum) | ||
| 25 | { | ||
| 26 | int rc; | ||
| 27 | |||
| 28 | --- udev-062/udevstart.c~noasmlinkage.patch | ||
| 29 | +++ udev-062/udevstart.c | ||
| 30 | @@ -323,7 +323,7 @@ | ||
| 31 | exec_list(&device_list); | ||
| 32 | } | ||
| 33 | |||
| 34 | -static void asmlinkage sig_handler(int signum) | ||
| 35 | +static void sig_handler(int signum) | ||
| 36 | { | ||
| 37 | switch (signum) { | ||
| 38 | case SIGALRM: | ||
diff --git a/meta-oe/recipes-core/udev/udev/permissions.rules b/meta-oe/recipes-core/udev/udev/permissions.rules deleted file mode 100644 index f4f94a6dbe..0000000000 --- a/meta-oe/recipes-core/udev/udev/permissions.rules +++ /dev/null | |||
| @@ -1,110 +0,0 @@ | |||
| 1 | ACTION!="add", GOTO="permissions_end" | ||
| 2 | |||
| 3 | # devices needed to load the drivers providing them | ||
| 4 | KERNEL=="tun", OPTIONS+="ignore_remove" | ||
| 5 | KERNEL=="ppp", OPTIONS+="ignore_remove" | ||
| 6 | KERNEL=="loop[0-9]*", OPTIONS+="ignore_remove" | ||
| 7 | |||
| 8 | # default permissions for block devices | ||
| 9 | SUBSYSTEM=="block", GROUP="disk" | ||
| 10 | # the aacraid driver is broken and reports that disks removable (see #404927) | ||
| 11 | SUBSYSTEM=="block", ATTRS{removable}=="1", \ | ||
| 12 | DRIVERS!="aacraid", GROUP="floppy" | ||
| 13 | # all block devices on these buses are "removable" | ||
| 14 | SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394|mmc|pcmcia", GROUP="floppy" | ||
| 15 | |||
| 16 | # IDE devices | ||
| 17 | KERNEL=="hd[a-z]|pcd[0-9]*", DRIVERS=="ide-cdrom|pcd", \ | ||
| 18 | IMPORT{program}="cdrom_id --export $tempnode" | ||
| 19 | ENV{ID_CDROM}=="?*", GROUP="cdrom" | ||
| 20 | KERNEL=="ht[0-9]*", GROUP="tape" | ||
| 21 | KERNEL=="nht[0-9]*", GROUP="tape" | ||
| 22 | |||
| 23 | # SCSI devices | ||
| 24 | KERNEL=="sr[0-9]*", IMPORT{program}="cdrom_id --export $tempnode" | ||
| 25 | SUBSYSTEMS=="scsi", ATTRS{type}=="1", GROUP="tape" | ||
| 26 | SUBSYSTEMS=="scsi", ATTRS{type}=="4", GROUP="cdrom" | ||
| 27 | SUBSYSTEMS=="scsi", ATTRS{type}=="5", GROUP="cdrom" | ||
| 28 | SUBSYSTEMS=="scsi", ATTRS{type}=="8", GROUP="tape" | ||
| 29 | |||
| 30 | # USB devices | ||
| 31 | KERNEL=="legousbtower*", MODE="0666" | ||
| 32 | KERNEL=="lp[0-9]*", SUBSYSTEMS=="usb", GROUP="lp" | ||
| 33 | |||
| 34 | # usbfs-like devices | ||
| 35 | SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \ | ||
| 36 | MODE="0664" | ||
| 37 | |||
| 38 | # iRiver music players | ||
| 39 | SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="plugdev", \ | ||
| 40 | ATTRS{idVendor}=="4102", ATTRS{idProduct}=="10[01][135789]" | ||
| 41 | |||
| 42 | # serial devices | ||
| 43 | SUBSYSTEM=="tty", GROUP="dialout" | ||
| 44 | SUBSYSTEM=="capi", GROUP="dialout" | ||
| 45 | SUBSYSTEM=="slamr", GROUP="dialout" | ||
| 46 | SUBSYSTEM=="zaptel", GROUP="dialout" | ||
| 47 | |||
| 48 | # vc devices (all members of the tty subsystem) | ||
| 49 | KERNEL=="ptmx", MODE="0666", GROUP="root" | ||
| 50 | KERNEL=="console", MODE="0600", GROUP="root" | ||
| 51 | KERNEL=="tty", MODE="0666", GROUP="root" | ||
| 52 | KERNEL=="tty[0-9]*", GROUP="root" | ||
| 53 | KERNEL=="pty*", MODE="0666", GROUP="tty" | ||
| 54 | |||
| 55 | # video devices | ||
| 56 | SUBSYSTEM=="video4linux", GROUP="video" | ||
| 57 | SUBSYSTEM=="drm", GROUP="video" | ||
| 58 | SUBSYSTEM=="dvb", GROUP="video" | ||
| 59 | SUBSYSTEM=="em8300", GROUP="video" | ||
| 60 | SUBSYSTEM=="graphics", GROUP="video" | ||
| 61 | SUBSYSTEM=="nvidia", GROUP="video" | ||
| 62 | |||
| 63 | # misc devices | ||
| 64 | KERNEL=="random", MODE="0666" | ||
| 65 | KERNEL=="urandom", MODE="0666" | ||
| 66 | KERNEL=="mem", MODE="0640", GROUP="kmem" | ||
| 67 | KERNEL=="kmem", MODE="0640", GROUP="kmem" | ||
| 68 | KERNEL=="port", MODE="0640", GROUP="kmem" | ||
| 69 | KERNEL=="full", MODE="0666" | ||
| 70 | KERNEL=="null", MODE="0666" | ||
| 71 | KERNEL=="zero", MODE="0666" | ||
| 72 | KERNEL=="inotify", MODE="0666" | ||
| 73 | KERNEL=="sgi_fetchop", MODE="0666" | ||
| 74 | KERNEL=="sonypi", MODE="0666" | ||
| 75 | KERNEL=="agpgart", GROUP="video" | ||
| 76 | KERNEL=="rtc|rtc[0-9]*", GROUP="audio" | ||
| 77 | KERNEL=="kqemu", MODE="0666" | ||
| 78 | KERNEL=="tun", MODE="0666", | ||
| 79 | |||
| 80 | KERNEL=="cdemu[0-9]*", GROUP="cdrom" | ||
| 81 | KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" | ||
| 82 | KERNEL=="pktcdvd", MODE="0644" | ||
| 83 | |||
| 84 | # printers and parallel devices | ||
| 85 | SUBSYSTEM=="printer", GROUP="lp" | ||
| 86 | SUBSYSTEM=="ppdev", GROUP="lp" | ||
| 87 | KERNEL=="irlpt*", GROUP="lp" | ||
| 88 | KERNEL=="pt[0-9]*", GROUP="tape" | ||
| 89 | KERNEL=="pht[0-9]*", GROUP="tape" | ||
| 90 | |||
| 91 | # sound devices | ||
| 92 | SUBSYSTEM=="sound", GROUP="audio" | ||
| 93 | |||
| 94 | # ieee1394 devices | ||
| 95 | KERNEL=="raw1394", GROUP="disk" | ||
| 96 | KERNEL=="dv1394*", GROUP="video" | ||
| 97 | KERNEL=="video1394*", GROUP="video" | ||
| 98 | |||
| 99 | # input devices | ||
| 100 | KERNEL=="event[0-9]*", ATTRS{name}=="*dvb*|*DVB*|* IR *" \ | ||
| 101 | MODE="0664", GROUP="video" | ||
| 102 | KERNEL=="js[0-9]*", MODE="0664" | ||
| 103 | KERNEL=="lirc[0-9]*", GROUP="video" | ||
| 104 | |||
| 105 | # AOE character devices | ||
| 106 | SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" | ||
| 107 | SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" | ||
| 108 | |||
| 109 | LABEL="permissions_end" | ||
| 110 | |||
diff --git a/meta-oe/recipes-core/udev/udev/run.rules b/meta-oe/recipes-core/udev/udev/run.rules deleted file mode 100644 index 75d71375bb..0000000000 --- a/meta-oe/recipes-core/udev/udev/run.rules +++ /dev/null | |||
| @@ -1,14 +0,0 @@ | |||
| 1 | # debugging monitor | ||
| 2 | RUN+="socket:/org/kernel/udev/monitor" | ||
| 3 | |||
| 4 | # run a command on remove events | ||
| 5 | ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" | ||
| 6 | |||
| 7 | # ignore the events generated by virtual consoles | ||
| 8 | KERNEL=="ptmx", OPTIONS+="last_rule" | ||
| 9 | KERNEL=="console", OPTIONS+="last_rule" | ||
| 10 | KERNEL=="tty" , OPTIONS+="last_rule" | ||
| 11 | KERNEL=="tty[0-9]*", OPTIONS+="last_rule" | ||
| 12 | KERNEL=="pty*", OPTIONS+="last_rule" | ||
| 13 | SUBSYSTEM=="vc", OPTIONS+="last_rule" | ||
| 14 | |||
diff --git a/meta-oe/recipes-core/udev/udev/udev-compat-wrapper-patch b/meta-oe/recipes-core/udev/udev/udev-compat-wrapper-patch deleted file mode 100644 index c90d05aefa..0000000000 --- a/meta-oe/recipes-core/udev/udev/udev-compat-wrapper-patch +++ /dev/null | |||
| @@ -1,37 +0,0 @@ | |||
| 1 | This patch should be applied on platforms which support kernels < 2.6.27 and need udev-compat package. | ||
| 2 | |||
| 3 | It should be applied after: | ||
| 4 | sed -i "s:/sbin/udevd:\$UDEVD:g;s:/sbin/udevadm:\$UDEVADM:g" init | ||
| 5 | |||
| 6 | It has not .patch suffix, because such files would not be copied to | ||
| 7 | WORKDIR and cannot be selectively applied on another source file. | ||
| 8 | |||
| 9 | --- init | ||
| 10 | +++ init | ||
| 11 | @@ -11,6 +11,17 @@ | ||
| 12 | |||
| 13 | export TZ=/etc/localtime | ||
| 14 | |||
| 15 | +UDEVD="/sbin/udevd" | ||
| 16 | +UDEVADM="/sbin/udevadm" | ||
| 17 | +# If we are running an old kernel and have a static udev present use that instead | ||
| 18 | +if [ -e /sbin/udevd-compat ] ; then | ||
| 19 | + KERNELMICROVER="$(uname -r | sed 's/^[0-9]*\.[0-9]*\.\([0-9]*\).*$/\1/')" | ||
| 20 | + if [ $KERNELMICROVER -lt 27 ] ; then | ||
| 21 | + UDEVD="/sbin/udevd-compat" | ||
| 22 | + UDEVADM="/sbin/udevadm-compat" | ||
| 23 | + fi | ||
| 24 | +fi | ||
| 25 | + | ||
| 26 | [ -d /sys/class ] || exit 1 | ||
| 27 | [ -r /proc/mounts ] || exit 1 | ||
| 28 | [ -x $UDEVD ] || exit 1 | ||
| 29 | @@ -21,6 +32,8 @@ | ||
| 30 | if [ -x /sbin/pidof ]; then | ||
| 31 | pid=`/sbin/pidof -x udevd` | ||
| 32 | [ -n "$pid" ] && kill $pid | ||
| 33 | + pid=`/sbin/pidof -x udevd-compat` | ||
| 34 | + [ -n "$pid" ] && kill $pid | ||
| 35 | fi | ||
| 36 | } | ||
| 37 | |||
diff --git a/meta-oe/recipes-core/udev/udev/udev-replace-le16toh.patch b/meta-oe/recipes-core/udev/udev/udev-replace-le16toh.patch deleted file mode 100644 index 7776c9a10e..0000000000 --- a/meta-oe/recipes-core/udev/udev/udev-replace-le16toh.patch +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 1 | This patch is needed on uclibc. | ||
| 2 | |||
| 3 | -Khem | ||
| 4 | |||
| 5 | Index: udev-151/extras/ata_id/ata_id.c | ||
| 6 | =================================================================== | ||
| 7 | --- udev-151.orig/extras/ata_id/ata_id.c 2010-06-04 14:08:41.912730501 -0700 | ||
| 8 | +++ udev-151/extras/ata_id/ata_id.c 2010-06-04 14:09:31.492734527 -0700 | ||
| 9 | @@ -168,7 +168,11 @@ static void disk_identify_fixup_uint16 ( | ||
| 10 | uint16_t *p; | ||
| 11 | |||
| 12 | p = (uint16_t *) identify; | ||
| 13 | - p[offset_words] = le16toh (p[offset_words]); | ||
| 14 | +#if __BYTE_ORDER == __LITTLE_ENDIAN | ||
| 15 | + p[offset_words] = p[offset_words]; | ||
| 16 | +#else | ||
| 17 | + p[offset_words] = __bswap_16 (p[offset_words]); | ||
| 18 | +#endif | ||
| 19 | } | ||
| 20 | |||
| 21 | /** | ||
diff --git a/meta-oe/recipes-core/udev/udev/udev-replace-lutimes.patch b/meta-oe/recipes-core/udev/udev/udev-replace-lutimes.patch deleted file mode 100644 index dd77897345..0000000000 --- a/meta-oe/recipes-core/udev/udev/udev-replace-lutimes.patch +++ /dev/null | |||
| @@ -1,25 +0,0 @@ | |||
| 1 | This patch is needed on uclibc | ||
| 2 | |||
| 3 | -Khem | ||
| 4 | Index: udev-151/udev/udev-node.c | ||
| 5 | =================================================================== | ||
| 6 | --- udev-151.orig/udev/udev-node.c 2010-06-04 14:18:59.082727182 -0700 | ||
| 7 | +++ udev-151/udev/udev-node.c 2010-06-04 14:20:27.485282812 -0700 | ||
| 8 | @@ -57,7 +57,7 @@ int udev_node_mknod(struct udev_device * | ||
| 9 | preserve = 1; | ||
| 10 | udev_selinux_lsetfilecon(udev, file, mode); | ||
| 11 | /* update time stamp when we re-use the node, like on media change events */ | ||
| 12 | - utimes(file, NULL); | ||
| 13 | + utimensat(AT_FDCWD, file, NULL, 0); | ||
| 14 | } else { | ||
| 15 | char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; | ||
| 16 | |||
| 17 | @@ -178,7 +178,7 @@ static int node_symlink(struct udev *ude | ||
| 18 | info(udev, "preserve already existing symlink '%s' to '%s'\n", | ||
| 19 | slink, target); | ||
| 20 | udev_selinux_lsetfilecon(udev, slink, S_IFLNK); | ||
| 21 | - lutimes(slink, NULL); | ||
| 22 | + utimensat(AT_FDCWD, slink, NULL, AT_SYMLINK_NOFOLLOW); | ||
| 23 | goto exit; | ||
| 24 | } | ||
| 25 | } | ||
diff --git a/meta-oe/recipes-core/udev/udev/udev.rules b/meta-oe/recipes-core/udev/udev/udev.rules deleted file mode 100644 index c20cdcc153..0000000000 --- a/meta-oe/recipes-core/udev/udev/udev.rules +++ /dev/null | |||
| @@ -1,113 +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 | ||
| 17 | SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", \ | ||
| 18 | ENV{ID_MODEL}=="IOMEGA_ZIP*", OPTIONS+="all_partitions" | ||
| 19 | SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTRS{media}=="floppy", \ | ||
| 20 | OPTIONS+="all_partitions" | ||
| 21 | |||
| 22 | # SCSI devices | ||
| 23 | SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" | ||
| 24 | |||
| 25 | # USB devices | ||
| 26 | SUBSYSTEMS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" | ||
| 27 | SUBSYSTEMS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" | ||
| 28 | SUBSYSTEMS=="usb", KERNEL=="dabusb*", NAME="usb/%k" | ||
| 29 | SUBSYSTEMS=="usb", KERNEL=="hiddev*", NAME="usb/%k" | ||
| 30 | SUBSYSTEMS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" | ||
| 31 | SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" | ||
| 32 | SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ | ||
| 33 | ATTRS{product}=="Palm Handheld*|Handspring Visor|palmOne Handheld", \ | ||
| 34 | SYMLINK+="pilot" | ||
| 35 | |||
| 36 | # usbfs-like devices | ||
| 37 | SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add", \ | ||
| 38 | NAME="%c" | ||
| 39 | SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" | ||
| 40 | |||
| 41 | # serial devices | ||
| 42 | KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" | ||
| 43 | KERNEL=="capi[0-9]*", NAME="capi/%n" | ||
| 44 | |||
| 45 | # video devices | ||
| 46 | KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", ACTION=="add", \ | ||
| 47 | NAME="%c" | ||
| 48 | KERNEL=="card[0-9]*", NAME="dri/%k" | ||
| 49 | |||
| 50 | # misc devices | ||
| 51 | KERNEL=="hw_random", NAME="hwrng" | ||
| 52 | KERNEL=="tun", NAME="net/%k" | ||
| 53 | KERNEL=="evtchn", NAME="xen/%k" | ||
| 54 | |||
| 55 | KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" | ||
| 56 | KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" | ||
| 57 | KERNEL=="pktcdvd", NAME="pktcdvd/control" | ||
| 58 | |||
| 59 | KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" | ||
| 60 | KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" | ||
| 61 | KERNEL=="microcode", NAME="cpu/microcode" | ||
| 62 | |||
| 63 | KERNEL=="umad*", NAME="infiniband/%k" | ||
| 64 | KERNEL=="issm*", NAME="infiniband/%k" | ||
| 65 | KERNEL=="uverbs*", NAME="infiniband/%k" | ||
| 66 | KERNEL=="ucm*", NAME="infiniband/%k" | ||
| 67 | KERNEL=="rdma_ucm", NAME="infiniband/%k" | ||
| 68 | |||
| 69 | # ALSA devices | ||
| 70 | KERNEL=="controlC[0-9]*", NAME="snd/%k" | ||
| 71 | KERNEL=="hwC[D0-9]*", NAME="snd/%k" | ||
| 72 | KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" | ||
| 73 | KERNEL=="midiC[D0-9]*", NAME="snd/%k" | ||
| 74 | KERNEL=="timer", NAME="snd/%k" | ||
| 75 | KERNEL=="seq", NAME="snd/%k" | ||
| 76 | |||
| 77 | # ieee1394 devices | ||
| 78 | KERNEL=="dv1394*", NAME="dv1394/%n" | ||
| 79 | KERNEL=="video1394*", NAME="video1394/%n" | ||
| 80 | |||
| 81 | # input devices | ||
| 82 | KERNEL=="mice", NAME="input/%k" | ||
| 83 | KERNEL=="mouse[0-9]*", NAME="input/%k" | ||
| 84 | KERNEL=="event[0-9]*", NAME="input/%k" | ||
| 85 | KERNEL=="js[0-9]*", NAME="input/%k" | ||
| 86 | KERNEL=="ts[0-9]*", NAME="input/%k" | ||
| 87 | KERNEL=="uinput", NAME="input/%k" | ||
| 88 | |||
| 89 | # Zaptel | ||
| 90 | KERNEL=="zapctl", NAME="zap/ctl" | ||
| 91 | KERNEL=="zaptimer", NAME="zap/timer" | ||
| 92 | KERNEL=="zapchannel", NAME="zap/channel" | ||
| 93 | KERNEL=="zappseudo", NAME="zap/pseudo" | ||
| 94 | KERNEL=="zap[0-9]*", NAME="zap/%n" | ||
| 95 | |||
| 96 | # AOE character devices | ||
| 97 | SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k" | ||
| 98 | SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k" | ||
| 99 | SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" | ||
| 100 | SUBSYSTEM=="aoe", KERNEL=="revalidate", NAME="etherd/%k" | ||
| 101 | |||
| 102 | # device mapper creates its own device nodes, so ignore these | ||
| 103 | KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device" | ||
| 104 | KERNEL=="device-mapper", NAME="mapper/control" | ||
| 105 | |||
| 106 | KERNEL=="rfcomm[0-9]*", GROUP="users", MODE="0660" | ||
| 107 | |||
| 108 | # Samsung UARTS | ||
| 109 | KERNEL=="s3c2410_serial[0-9]", NAME="ttySAC%n" | ||
| 110 | |||
| 111 | # MXC UARTs | ||
| 112 | KERNEL=="ttymxc[0-4]", NAME="ttymxc%n" | ||
| 113 | |||
diff --git a/meta-oe/recipes-core/udev/udev/udev_network_queue.sh b/meta-oe/recipes-core/udev/udev/udev_network_queue.sh deleted file mode 100644 index 05e08e9d1b..0000000000 --- a/meta-oe/recipes-core/udev/udev/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 | |||
| 9 | do_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 | |||
| 24 | do_stop() { | ||
| 25 | /bin/true | ||
| 26 | } | ||
| 27 | |||
| 28 | case "$1" in | ||
| 29 | start) do_start;; | ||
| 30 | stop) do_stop;; | ||
| 31 | restart) do_stop | ||
| 32 | do_start;; | ||
| 33 | *) echo "Usage: `basename $0` [ start | stop | restart ]" | ||
| 34 | exit 0;; | ||
| 35 | esac | ||
diff --git a/meta-oe/recipes-core/udev/udev/udevsynthesize.patch b/meta-oe/recipes-core/udev/udev/udevsynthesize.patch deleted file mode 100644 index 7811188485..0000000000 --- a/meta-oe/recipes-core/udev/udev/udevsynthesize.patch +++ /dev/null | |||
| @@ -1,776 +0,0 @@ | |||
| 1 | --- udev-081/udevsynthesize.c.orig 2006-01-29 12:22:45.000000000 +0100 | ||
| 2 | +++ udev-081/udevsynthesize.c 2006-01-29 12:22:40.000000000 +0100 | ||
| 3 | @@ -0,0 +1,763 @@ | ||
| 4 | +/* | ||
| 5 | + * udevcoldplug.c | ||
| 6 | + * | ||
| 7 | + * Copyright (C) 2005 SUSE Linux Products GmbH | ||
| 8 | + * | ||
| 9 | + * Author: | ||
| 10 | + * Kay Sievers <kay.sievers@vrfy.org> | ||
| 11 | + * | ||
| 12 | + * Synthesize kernel events from sysfs information and pass them | ||
| 13 | + * to the udevd daemon. | ||
| 14 | + * | ||
| 15 | + * This program is free software; you can redistribute it and/or modify it | ||
| 16 | + * under the terms of the GNU General Public License as published by the | ||
| 17 | + * Free Software Foundation version 2 of the License. | ||
| 18 | + * | ||
| 19 | + * This program is distributed in the hope that it will be useful, but | ||
| 20 | + * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 21 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 22 | + * General Public License for more details. | ||
| 23 | + * | ||
| 24 | + * You should have received a copy of the GNU General Public License along | ||
| 25 | + * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 26 | + * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 27 | + * | ||
| 28 | + */ | ||
| 29 | + | ||
| 30 | +#include <stdlib.h> | ||
| 31 | +#include <stddef.h> | ||
| 32 | +#include <string.h> | ||
| 33 | +#include <stdio.h> | ||
| 34 | +#include <unistd.h> | ||
| 35 | +#include <errno.h> | ||
| 36 | +#include <ctype.h> | ||
| 37 | +#include <fcntl.h> | ||
| 38 | +#include <dirent.h> | ||
| 39 | +#include <signal.h> | ||
| 40 | +#include <syslog.h> | ||
| 41 | +#include <sys/socket.h> | ||
| 42 | +#include <sys/un.h> | ||
| 43 | +#include <sys/wait.h> | ||
| 44 | +#include <sys/stat.h> | ||
| 45 | +#include <sys/types.h> | ||
| 46 | + | ||
| 47 | +#include "udev_libc_wrapper.h" | ||
| 48 | +#include "udev.h" | ||
| 49 | +#include "udevd.h" | ||
| 50 | +#include "udev_version.h" | ||
| 51 | +#include "logging.h" | ||
| 52 | + | ||
| 53 | +#include "list.h" | ||
| 54 | + | ||
| 55 | +#ifndef DT_DIR | ||
| 56 | +#define DT_DIR 4 | ||
| 57 | +#endif | ||
| 58 | + | ||
| 59 | +static const char *udev_log_str; | ||
| 60 | +static int udevd_sock = -1; | ||
| 61 | + | ||
| 62 | +#ifdef USE_LOG | ||
| 63 | +void log_message(int priority, const char *format, ...) | ||
| 64 | +{ | ||
| 65 | + va_list args; | ||
| 66 | + | ||
| 67 | + if (priority > udev_log_priority) | ||
| 68 | + return; | ||
| 69 | + | ||
| 70 | + va_start(args, format); | ||
| 71 | + vsyslog(priority, format, args); | ||
| 72 | + va_end(args); | ||
| 73 | +} | ||
| 74 | +#endif | ||
| 75 | + | ||
| 76 | +struct device { | ||
| 77 | + struct list_head node; | ||
| 78 | + struct udevd_msg msg; | ||
| 79 | + size_t bufpos; | ||
| 80 | + char *path; | ||
| 81 | +}; | ||
| 82 | + | ||
| 83 | +static dev_t read_devt(const char *path) | ||
| 84 | +{ | ||
| 85 | + char filename[PATH_SIZE]; | ||
| 86 | + char majorminor[64]; | ||
| 87 | + unsigned int major, minor; | ||
| 88 | + ssize_t count; | ||
| 89 | + int fd; | ||
| 90 | + | ||
| 91 | + snprintf(filename, sizeof(filename), "%s/%s", path, "dev"); | ||
| 92 | + filename[sizeof(filename)-1] = '\0'; | ||
| 93 | + | ||
| 94 | + fd = open(filename, O_RDONLY); | ||
| 95 | + if (fd < 0) | ||
| 96 | + return 0; | ||
| 97 | + | ||
| 98 | + count = read(fd, majorminor, sizeof(majorminor)); | ||
| 99 | + close(fd); | ||
| 100 | + majorminor[count] = '\0'; | ||
| 101 | + if (sscanf(majorminor, "%u:%u", &major, &minor) != 2) | ||
| 102 | + return 0; | ||
| 103 | + dbg("found major=%d, minor=%d", major, minor); | ||
| 104 | + | ||
| 105 | + return makedev(major, minor); | ||
| 106 | +} | ||
| 107 | + | ||
| 108 | +static ssize_t read_file(const char *directory, const char *file, char *str, size_t len) | ||
| 109 | +{ | ||
| 110 | + char filename[PATH_SIZE]; | ||
| 111 | + ssize_t count; | ||
| 112 | + int fd; | ||
| 113 | + | ||
| 114 | + memset(filename, 0, sizeof(filename)); | ||
| 115 | + snprintf(filename, sizeof(filename), "%s/%s", directory, file); | ||
| 116 | + filename[sizeof(filename)-1] = '\0'; | ||
| 117 | + | ||
| 118 | + fd = open(filename, O_RDONLY); | ||
| 119 | + if (fd < 0) | ||
| 120 | + return -1; | ||
| 121 | + | ||
| 122 | + count = read(fd, str, len-1); | ||
| 123 | + close(fd); | ||
| 124 | + | ||
| 125 | + if (count > (ssize_t)len) | ||
| 126 | + count = len; | ||
| 127 | + str[count-1] = '\0'; | ||
| 128 | + | ||
| 129 | + return count; | ||
| 130 | +} | ||
| 131 | + | ||
| 132 | +static ssize_t read_link(const char *directory, const char *file, char *str, size_t size) | ||
| 133 | +{ | ||
| 134 | + char filename[PATH_SIZE]; | ||
| 135 | + char target[PATH_SIZE]; | ||
| 136 | + int len; | ||
| 137 | + char *back; | ||
| 138 | + char *strip; | ||
| 139 | + int level = 1; | ||
| 140 | + | ||
| 141 | + snprintf(filename, sizeof(filename), "%s/%s", directory, file); | ||
| 142 | + filename[sizeof(filename)-1] = '\0'; | ||
| 143 | + | ||
| 144 | + len = readlink(filename, target, sizeof(target)-1); | ||
| 145 | + if (len < 0) | ||
| 146 | + return -1; | ||
| 147 | + target[len] = '\0'; | ||
| 148 | + | ||
| 149 | + back = target; | ||
| 150 | + while (strncmp(back, "../", 3) == 0) { | ||
| 151 | + back += 3; | ||
| 152 | + level++; | ||
| 153 | + } | ||
| 154 | + while(level--) { | ||
| 155 | + strip = strrchr(filename, '/'); | ||
| 156 | + if (!strip) | ||
| 157 | + return -1; | ||
| 158 | + strip[0] = '\0'; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + snprintf(str, size, "%s/%s", filename, back); | ||
| 162 | + str[size-1] = '\0'; | ||
| 163 | + | ||
| 164 | + return len; | ||
| 165 | +} | ||
| 166 | + | ||
| 167 | +static char *add_env_key(struct device *device, const char *key, const char *value) | ||
| 168 | +{ | ||
| 169 | + size_t pos = device->bufpos; | ||
| 170 | + device->bufpos += sprintf(&device->msg.envbuf[device->bufpos], "%s=%s", key, value)+1; | ||
| 171 | + return &device->msg.envbuf[pos]; | ||
| 172 | +} | ||
| 173 | + | ||
| 174 | +static struct device *device_create(const char *path, const char *subsystem, dev_t devt) | ||
| 175 | +{ | ||
| 176 | + struct device *device; | ||
| 177 | + const char *devpath = &path[strlen(sysfs_path)]; | ||
| 178 | + char target[PATH_SIZE]; | ||
| 179 | + | ||
| 180 | + device = malloc(sizeof(struct device)); | ||
| 181 | + if (device == NULL) { | ||
| 182 | + dbg("error malloc"); | ||
| 183 | + return NULL; | ||
| 184 | + } | ||
| 185 | + memset(device, 0x00, sizeof(struct device)); | ||
| 186 | + | ||
| 187 | + device->path = add_env_key(device, "DEVPATH", devpath); | ||
| 188 | + device->path += strlen("DEVPATH="); | ||
| 189 | + add_env_key(device, "SUBSYSTEM", subsystem); | ||
| 190 | + add_env_key(device, "ACTION", "add"); | ||
| 191 | + add_env_key(device, "UDEV_COLDPLUG", "1"); | ||
| 192 | + | ||
| 193 | + if (major(devt)) { | ||
| 194 | + char number[32]; | ||
| 195 | + sprintf(number, "%u", major(devt)); | ||
| 196 | + add_env_key(device, "MAJOR", number); | ||
| 197 | + sprintf(number, "%u", minor(devt)); | ||
| 198 | + add_env_key(device, "MINOR", number); | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + if (strncmp(devpath, "/block/", strlen("/block/")) == 0 || | ||
| 202 | + strncmp(devpath, "/class/", strlen("/class/")) == 0) { | ||
| 203 | + char physpath[PATH_SIZE]; | ||
| 204 | + | ||
| 205 | + if (read_link(path, "device", physpath, sizeof(physpath)) > (ssize_t)strlen(sysfs_path)) { | ||
| 206 | + add_env_key(device, "PHYSDEVPATH", &physpath[strlen(sysfs_path)]); | ||
| 207 | + if (read_link(physpath, "driver", target, sizeof(target)) > (ssize_t)strlen(sysfs_path)) { | ||
| 208 | + char *pos = strrchr(target, '/'); | ||
| 209 | + if (pos) | ||
| 210 | + add_env_key(device, "PHYSDEVDRIVER", &pos[1]); | ||
| 211 | + } | ||
| 212 | + if (read_link(physpath, "bus", target, sizeof(target)) > (ssize_t)strlen(sysfs_path)) { | ||
| 213 | + char *pos = strrchr(target, '/'); | ||
| 214 | + if (pos) | ||
| 215 | + add_env_key(device, "PHYSDEVBUS", &pos[1]); | ||
| 216 | + } | ||
| 217 | + } | ||
| 218 | + } else if (strncmp(devpath, "/devices/", strlen("/devices/")) == 0) { | ||
| 219 | + if (read_link(path, "driver", target, sizeof(target)) > (ssize_t)strlen(sysfs_path)) { | ||
| 220 | + char *pos = strrchr(target, '/'); | ||
| 221 | + if (pos) | ||
| 222 | + add_env_key(device, "PHYSDEVDRIVER", &pos[1]); | ||
| 223 | + } | ||
| 224 | + if (read_link(path, "bus", target, sizeof(target)) > (ssize_t)strlen(sysfs_path)) { | ||
| 225 | + char *pos = strrchr(target, '/'); | ||
| 226 | + if (pos) | ||
| 227 | + add_env_key(device, "PHYSDEVBUS", &pos[1]); | ||
| 228 | + } | ||
| 229 | + } | ||
| 230 | + | ||
| 231 | + return device; | ||
| 232 | +} | ||
| 233 | + | ||
| 234 | +static int device_list_insert(struct list_head *device_list, struct device *device) | ||
| 235 | +{ | ||
| 236 | + struct device *loop_device; | ||
| 237 | + | ||
| 238 | + dbg("insert: '%s'", device->path); | ||
| 239 | + | ||
| 240 | + /* sort files in lexical order */ | ||
| 241 | + list_for_each_entry(loop_device, device_list, node) | ||
| 242 | + if (strcmp(loop_device->path, device->path) > 0) | ||
| 243 | + break; | ||
| 244 | + | ||
| 245 | + list_add_tail(&device->node, &loop_device->node); | ||
| 246 | + | ||
| 247 | + return 0; | ||
| 248 | +} | ||
| 249 | + | ||
| 250 | +static int add_device_udevd(struct device *device) | ||
| 251 | +{ | ||
| 252 | + size_t msg_len; | ||
| 253 | + struct sockaddr_un saddr; | ||
| 254 | + socklen_t addrlen; | ||
| 255 | + int retval; | ||
| 256 | + | ||
| 257 | + memset(&saddr, 0x00, sizeof(struct sockaddr_un)); | ||
| 258 | + saddr.sun_family = AF_LOCAL; | ||
| 259 | + /* use abstract namespace for socket path */ | ||
| 260 | + strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); | ||
| 261 | + addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; | ||
| 262 | + | ||
| 263 | + strcpy(device->msg.magic, UDEV_MAGIC); | ||
| 264 | + device->msg.type = UDEVD_UEVENT_UDEVSEND; | ||
| 265 | + | ||
| 266 | + msg_len = offsetof(struct udevd_msg, envbuf) + device->bufpos; | ||
| 267 | + dbg("msg_len=%i", msg_len); | ||
| 268 | + | ||
| 269 | + retval = sendto(udevd_sock, &device->msg, msg_len, 0, (struct sockaddr *)&saddr, addrlen); | ||
| 270 | + if (retval < 0) | ||
| 271 | + return -1; | ||
| 272 | + | ||
| 273 | + return 0; | ||
| 274 | +} | ||
| 275 | + | ||
| 276 | +static void exec_list(struct list_head *device_list, const char *first[], const char *last[]) | ||
| 277 | +{ | ||
| 278 | + struct device *loop_device; | ||
| 279 | + struct device *tmp_device; | ||
| 280 | + int i; | ||
| 281 | + | ||
| 282 | + /* handle the "first" type devices first */ | ||
| 283 | + if (first) | ||
| 284 | + list_for_each_entry_safe(loop_device, tmp_device, device_list, node) { | ||
| 285 | + for (i = 0; first[i] != NULL; i++) { | ||
| 286 | + if (strncmp(loop_device->path, first[i], strlen(first[i])) == 0) { | ||
| 287 | + add_device_udevd(loop_device); | ||
| 288 | + list_del(&loop_device->node); | ||
| 289 | + free(loop_device); | ||
| 290 | + break; | ||
| 291 | + } | ||
| 292 | + } | ||
| 293 | + } | ||
| 294 | + | ||
| 295 | + /* handle the devices we are allowed to, excluding the "last" type devices */ | ||
| 296 | + if (last) | ||
| 297 | + list_for_each_entry_safe(loop_device, tmp_device, device_list, node) { | ||
| 298 | + int found = 0; | ||
| 299 | + for (i = 0; last[i] != NULL; i++) { | ||
| 300 | + if (strncmp(loop_device->path, last[i], strlen(last[i])) == 0) { | ||
| 301 | + found = 1; | ||
| 302 | + break; | ||
| 303 | + } | ||
| 304 | + } | ||
| 305 | + if (found) | ||
| 306 | + continue; | ||
| 307 | + | ||
| 308 | + add_device_udevd(loop_device); | ||
| 309 | + list_del(&loop_device->node); | ||
| 310 | + free(loop_device); | ||
| 311 | + } | ||
| 312 | + | ||
| 313 | + /* handle the rest of the devices */ | ||
| 314 | + list_for_each_entry_safe(loop_device, tmp_device, device_list, node) { | ||
| 315 | + add_device_udevd(loop_device); | ||
| 316 | + list_del(&loop_device->node); | ||
| 317 | + free(loop_device); | ||
| 318 | + } | ||
| 319 | +} | ||
| 320 | + | ||
| 321 | +static int udev_scan_class(void) | ||
| 322 | +{ | ||
| 323 | + char base[PATH_SIZE]; | ||
| 324 | + DIR *dir; | ||
| 325 | + struct dirent *dent; | ||
| 326 | + LIST_HEAD(device_list); | ||
| 327 | + | ||
| 328 | + /* we want /dev/null and /dev/console first */ | ||
| 329 | + const char *first[] = { | ||
| 330 | + "/class/mem", | ||
| 331 | + "/class/tty", | ||
| 332 | + NULL, | ||
| 333 | + }; | ||
| 334 | + | ||
| 335 | + snprintf(base, sizeof(base), "%s/class", sysfs_path); | ||
| 336 | + base[sizeof(base)-1] = '\0'; | ||
| 337 | + | ||
| 338 | + dir = opendir(base); | ||
| 339 | + if (!dir) | ||
| 340 | + return -1; | ||
| 341 | + | ||
| 342 | + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { | ||
| 343 | + char dirname[PATH_SIZE]; | ||
| 344 | + DIR *dir2; | ||
| 345 | + struct dirent *dent2; | ||
| 346 | + | ||
| 347 | + if (dent->d_name[0] == '.') | ||
| 348 | + continue; | ||
| 349 | + | ||
| 350 | + snprintf(dirname, sizeof(dirname), "%s/%s", base, dent->d_name); | ||
| 351 | + dirname[sizeof(dirname)-1] = '\0'; | ||
| 352 | + | ||
| 353 | + dir2 = opendir(dirname); | ||
| 354 | + if (!dir2) | ||
| 355 | + continue; | ||
| 356 | + for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { | ||
| 357 | + char dirname2[PATH_SIZE]; | ||
| 358 | + struct device *device; | ||
| 359 | + dev_t devt; | ||
| 360 | + | ||
| 361 | + if (dent2->d_name[0] == '.') | ||
| 362 | + continue; | ||
| 363 | + if (dent2->d_type != DT_DIR) | ||
| 364 | + continue; | ||
| 365 | + | ||
| 366 | + snprintf(dirname2, sizeof(dirname2), "%s/%s", dirname, dent2->d_name); | ||
| 367 | + dirname2[sizeof(dirname2)-1] = '\0'; | ||
| 368 | + devt = read_devt(dirname2); | ||
| 369 | + device = device_create(dirname2, dent->d_name, devt); | ||
| 370 | + | ||
| 371 | + if (strcmp(dent->d_name, "net") == 0 || | ||
| 372 | + strcmp(dent->d_name, "bluetooth") == 0) { | ||
| 373 | + add_env_key(device, "INTERFACE", dent2->d_name); | ||
| 374 | + } else if (strcmp(dent->d_name, "pcmcia_socket") == 0 && | ||
| 375 | + strlen(dent->d_name) > 14) { | ||
| 376 | + add_env_key(device, "SOCKET_NO", | ||
| 377 | + dent2->d_name + 14); | ||
| 378 | + } | ||
| 379 | + | ||
| 380 | + device_list_insert(&device_list, device); | ||
| 381 | + } | ||
| 382 | + closedir(dir2); | ||
| 383 | + } | ||
| 384 | + closedir(dir); | ||
| 385 | + exec_list(&device_list, first, NULL); | ||
| 386 | + | ||
| 387 | + return 0; | ||
| 388 | +} | ||
| 389 | + | ||
| 390 | +static int udev_scan_block(void) | ||
| 391 | +{ | ||
| 392 | + char base[PATH_SIZE]; | ||
| 393 | + DIR *dir; | ||
| 394 | + struct dirent *dent; | ||
| 395 | + LIST_HEAD(device_list); | ||
| 396 | + | ||
| 397 | + /* dm wants to have the block devices around before it */ | ||
| 398 | + const char *last[] = { | ||
| 399 | + "/block/dm", | ||
| 400 | + NULL, | ||
| 401 | + }; | ||
| 402 | + | ||
| 403 | + snprintf(base, sizeof(base), "%s/block", sysfs_path); | ||
| 404 | + base[sizeof(base)-1] = '\0'; | ||
| 405 | + | ||
| 406 | + dir = opendir(base); | ||
| 407 | + if (!dir) | ||
| 408 | + return -1; | ||
| 409 | + | ||
| 410 | + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { | ||
| 411 | + char dirname[PATH_SIZE]; | ||
| 412 | + struct device *device; | ||
| 413 | + struct dirent *dent2; | ||
| 414 | + DIR *dir2; | ||
| 415 | + dev_t devt; | ||
| 416 | + | ||
| 417 | + if (dent->d_name[0] == '.') | ||
| 418 | + continue; | ||
| 419 | + if (dent->d_type != DT_DIR) | ||
| 420 | + continue; | ||
| 421 | + | ||
| 422 | + snprintf(dirname, sizeof(dirname), "%s/%s", base, dent->d_name); | ||
| 423 | + dirname[sizeof(dirname)-1] = '\0'; | ||
| 424 | + devt = read_devt(dirname); | ||
| 425 | + if (major(devt)) { | ||
| 426 | + device = device_create(dirname, "block", devt); | ||
| 427 | + device_list_insert(&device_list, device); | ||
| 428 | + } | ||
| 429 | + | ||
| 430 | + /* look for partitions */ | ||
| 431 | + dir2 = opendir(dirname); | ||
| 432 | + if (!dir2) | ||
| 433 | + continue; | ||
| 434 | + for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { | ||
| 435 | + char dirname2[PATH_SIZE]; | ||
| 436 | + | ||
| 437 | + if (dent2->d_name[0] == '.') | ||
| 438 | + continue; | ||
| 439 | + if (dent2->d_type != DT_DIR) | ||
| 440 | + continue; | ||
| 441 | + | ||
| 442 | + snprintf(dirname2, sizeof(dirname2), "%s/%s", dirname, dent2->d_name); | ||
| 443 | + dirname2[sizeof(dirname2)-1] = '\0'; | ||
| 444 | + devt = read_devt(dirname2); | ||
| 445 | + if (major(devt)) { | ||
| 446 | + device = device_create(dirname2, "block", devt); | ||
| 447 | + device_list_insert(&device_list, device); | ||
| 448 | + continue; | ||
| 449 | + } | ||
| 450 | + } | ||
| 451 | + closedir(dir2); | ||
| 452 | + } | ||
| 453 | + closedir(dir); | ||
| 454 | + exec_list(&device_list, NULL, last); | ||
| 455 | + | ||
| 456 | + return 0; | ||
| 457 | +} | ||
| 458 | + | ||
| 459 | +static int pci_handler(struct device *device) | ||
| 460 | +{ | ||
| 461 | + char path[PATH_SIZE]; | ||
| 462 | + char value[PATH_SIZE]; | ||
| 463 | + char vendor[PATH_SIZE]; | ||
| 464 | + char product[PATH_SIZE]; | ||
| 465 | + const char *name; | ||
| 466 | + | ||
| 467 | + snprintf(path, sizeof(path), "%s%s", sysfs_path, device->path); | ||
| 468 | + path[sizeof(path)-1] = '\0'; | ||
| 469 | + | ||
| 470 | + if (read_file(path, "modalias", value, sizeof(value)) > 0) | ||
| 471 | + add_env_key(device, "MODALIAS", value); | ||
| 472 | + | ||
| 473 | + name = strrchr(device->path, '/'); | ||
| 474 | + if (name) | ||
| 475 | + add_env_key(device, "PCI_SLOT_NAME", &name[1]); | ||
| 476 | + | ||
| 477 | + if (read_file(path, "class", value, sizeof(value)) > 0) | ||
| 478 | + add_env_key(device, "PCI_CLASS", &value[2]); | ||
| 479 | + | ||
| 480 | + if (read_file(path, "vendor", vendor, sizeof(vendor)) > 0 && | ||
| 481 | + read_file(path, "device", product, sizeof(product)) > 0) { | ||
| 482 | + snprintf(value, sizeof(value), "%s:%s", &vendor[2], &product[2]); | ||
| 483 | + path[sizeof(value)-1] = '\0'; | ||
| 484 | + add_env_key(device, "PCI_ID", value); | ||
| 485 | + } | ||
| 486 | + | ||
| 487 | + if (read_file(path, "subsystem_vendor", vendor, sizeof(vendor)) > 0 && | ||
| 488 | + read_file(path, "subsystem_device", product, sizeof(product)) > 0) { | ||
| 489 | + snprintf(value, sizeof(value), "%s:%s", &vendor[2], &product[2]); | ||
| 490 | + path[sizeof(value)-1] = '\0'; | ||
| 491 | + add_env_key(device, "PCI_SUBSYS_ID", value); | ||
| 492 | + } | ||
| 493 | + | ||
| 494 | + return 0; | ||
| 495 | +} | ||
| 496 | + | ||
| 497 | +static int usb_handler(struct device *device) | ||
| 498 | +{ | ||
| 499 | + char path[PATH_SIZE]; | ||
| 500 | + char value[PATH_SIZE]; | ||
| 501 | + char str1[PATH_SIZE]; | ||
| 502 | + char str2[PATH_SIZE]; | ||
| 503 | + char str3[PATH_SIZE]; | ||
| 504 | + unsigned int int1; | ||
| 505 | + unsigned int int2; | ||
| 506 | + unsigned int int3; | ||
| 507 | + char *pos; | ||
| 508 | + | ||
| 509 | + snprintf(path, sizeof(path), "%s%s", sysfs_path, device->path); | ||
| 510 | + path[sizeof(path)-1] = '\0'; | ||
| 511 | + | ||
| 512 | + /* device events have : in their directory name */ | ||
| 513 | + pos = strrchr(path, '/'); | ||
| 514 | + if (!strchr(pos, ':')) | ||
| 515 | + return 0; /* and do not have other variables */ | ||
| 516 | + | ||
| 517 | + if (read_file(path, "modalias", value, sizeof(value)) > 0) | ||
| 518 | + add_env_key(device, "MODALIAS", value); | ||
| 519 | + | ||
| 520 | + if (read_file(path, "bInterfaceClass", str1, sizeof(str1)) > 0 && | ||
| 521 | + read_file(path, "bInterfaceSubClass", str2, sizeof(str2)) > 0 && | ||
| 522 | + read_file(path, "bInterfaceProtocol", str3, sizeof(str3)) > 0) { | ||
| 523 | + int1 = (int) strtol(str1, NULL, 16); | ||
| 524 | + int2 = (int) strtol(str2, NULL, 16); | ||
| 525 | + int3 = (int) strtol(str3, NULL, 16); | ||
| 526 | + snprintf(value, sizeof(value), "%u/%u/%u", int1, int2, int3); | ||
| 527 | + path[sizeof(value)-1] = '\0'; | ||
| 528 | + add_env_key(device, "INTERFACE", value); | ||
| 529 | + } | ||
| 530 | + | ||
| 531 | + /* move to the parent directory */ | ||
| 532 | + pos[0] = '\0'; | ||
| 533 | + | ||
| 534 | + if (read_file(path, "idVendor", str1, sizeof(str1)) > 0 && | ||
| 535 | + read_file(path, "idProduct", str2, sizeof(str2)) > 0 && | ||
| 536 | + read_file(path, "bcdDevice", str3, sizeof(str3)) > 0) { | ||
| 537 | + int1 = (int) strtol(str1, NULL, 16); | ||
| 538 | + int2 = (int) strtol(str2, NULL, 16); | ||
| 539 | + int3 = (int) strtol(str3, NULL, 16); | ||
| 540 | + snprintf(value, sizeof(value), "%x/%x/%x", int1, int2, int3); | ||
| 541 | + path[sizeof(value)-1] = '\0'; | ||
| 542 | + add_env_key(device, "PRODUCT", value); | ||
| 543 | + } | ||
| 544 | + | ||
| 545 | + if (read_file(path, "bDeviceClass", str1, sizeof(str1)) > 0 && | ||
| 546 | + read_file(path, "bDeviceSubClass", str2, sizeof(str2)) > 0 && | ||
| 547 | + read_file(path, "bDeviceProtocol", str3, sizeof(str3)) > 0) { | ||
| 548 | + int1 = (int) strtol(str1, NULL, 16); | ||
| 549 | + int2 = (int) strtol(str2, NULL, 16); | ||
| 550 | + int3 = (int) strtol(str3, NULL, 16); | ||
| 551 | + snprintf(value, sizeof(value), "%u/%u/%u", int1, int2, int3); | ||
| 552 | + path[sizeof(value)-1] = '\0'; | ||
| 553 | + add_env_key(device, "TYPE", value); | ||
| 554 | + } | ||
| 555 | + | ||
| 556 | + if (read_file(path, "devnum", str2, sizeof(str2)) > 0) { | ||
| 557 | + pos = strrchr(path, 'b'); | ||
| 558 | + int1 = (int) strtol(pos + 1, NULL, 16); | ||
| 559 | + int2 = (int) strtol(str2, NULL, 16); | ||
| 560 | + snprintf(value, sizeof(value), | ||
| 561 | + "/proc/bus/usb/%03d/%03d", int1, int2); | ||
| 562 | + path[sizeof(value)-1] = '\0'; | ||
| 563 | + add_env_key(device, "DEVICE", value); | ||
| 564 | + } | ||
| 565 | + | ||
| 566 | + return 0; | ||
| 567 | +} | ||
| 568 | + | ||
| 569 | +static int serio_handler(struct device *device) | ||
| 570 | +{ | ||
| 571 | + char path[PATH_SIZE]; | ||
| 572 | + char value[PATH_SIZE]; | ||
| 573 | + | ||
| 574 | + snprintf(path, sizeof(path), "%s%s", sysfs_path, device->path); | ||
| 575 | + path[sizeof(path)-1] = '\0'; | ||
| 576 | + | ||
| 577 | + if (read_file(path, "modalias", value, sizeof(value)) > 0) | ||
| 578 | + add_env_key(device, "MODALIAS", value); | ||
| 579 | + | ||
| 580 | + if (read_file(path, "id/type", value, sizeof(value)) > 0) | ||
| 581 | + add_env_key(device, "SERIO_TYPE", value); | ||
| 582 | + | ||
| 583 | + if (read_file(path, "id/proto", value, sizeof(value)) > 0) | ||
| 584 | + add_env_key(device, "SERIO_PROTO", value); | ||
| 585 | + | ||
| 586 | + if (read_file(path, "id/id", value, sizeof(value)) > 0) | ||
| 587 | + add_env_key(device, "SERIO_ID", value); | ||
| 588 | + | ||
| 589 | + if (read_file(path, "id/extra", value, sizeof(value)) > 0) | ||
| 590 | + add_env_key(device, "SERIO_EXTRA", value); | ||
| 591 | + | ||
| 592 | + return 0; | ||
| 593 | +} | ||
| 594 | + | ||
| 595 | +static int ccw_handler(struct device *device) | ||
| 596 | +{ | ||
| 597 | + char path[PATH_SIZE]; | ||
| 598 | + char value[PATH_SIZE], *tmp; | ||
| 599 | + | ||
| 600 | + snprintf(path, sizeof(path), "%s%s", sysfs_path, device->path); | ||
| 601 | + path[sizeof(path)-1] = '\0'; | ||
| 602 | + | ||
| 603 | + if (read_file(path, "modalias", value, sizeof(value)) > 0) | ||
| 604 | + add_env_key(device, "MODALIAS", value); | ||
| 605 | + | ||
| 606 | + if (read_file(path, "cutype", value, sizeof(value)) > 0) { | ||
| 607 | + value[4] = 0; | ||
| 608 | + tmp = &value[5]; | ||
| 609 | + add_env_key(device, "CU_TYPE", value); | ||
| 610 | + add_env_key(device, "CU_MODEL", tmp); | ||
| 611 | + } | ||
| 612 | + | ||
| 613 | + if (read_file(path, "devtype", value, sizeof(value)) > 0) { | ||
| 614 | + if (value[0] == 'n') { | ||
| 615 | + add_env_key(device, "DEV_TYPE", "0000"); | ||
| 616 | + add_env_key(device, "DEV_MODEL", "00"); | ||
| 617 | + } | ||
| 618 | + else { | ||
| 619 | + value[4] = 0; | ||
| 620 | + tmp = &value[5]; | ||
| 621 | + add_env_key(device, "DEV_TYPE", value); | ||
| 622 | + add_env_key(device, "DEV_MODEL", tmp); | ||
| 623 | + } | ||
| 624 | + } | ||
| 625 | + | ||
| 626 | + return 0; | ||
| 627 | +} | ||
| 628 | + | ||
| 629 | +static int modalias_handler(struct device *device) | ||
| 630 | +{ | ||
| 631 | + char path[PATH_SIZE]; | ||
| 632 | + char value[PATH_SIZE]; | ||
| 633 | + | ||
| 634 | + snprintf(path, sizeof(path), "%s%s", sysfs_path, device->path); | ||
| 635 | + path[sizeof(path)-1] = '\0'; | ||
| 636 | + | ||
| 637 | + if (read_file(path, "modalias", value, sizeof(value)) > 0) | ||
| 638 | + add_env_key(device, "MODALIAS", value); | ||
| 639 | + | ||
| 640 | + return 0; | ||
| 641 | +} | ||
| 642 | + | ||
| 643 | +static int udev_scan_bus(const char *bus, int bus_handler(struct device *device)) | ||
| 644 | +{ | ||
| 645 | + char base[PATH_SIZE]; | ||
| 646 | + DIR *dir; | ||
| 647 | + struct dirent *dent; | ||
| 648 | + LIST_HEAD(device_list); | ||
| 649 | + | ||
| 650 | + snprintf(base, sizeof(base), "%s/bus/%s/devices", sysfs_path, bus); | ||
| 651 | + base[sizeof(base)-1] = '\0'; | ||
| 652 | + | ||
| 653 | + dir = opendir(base); | ||
| 654 | + if (!dir) | ||
| 655 | + return -1; | ||
| 656 | + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { | ||
| 657 | + char devpath[PATH_SIZE]; | ||
| 658 | + struct device *device; | ||
| 659 | + | ||
| 660 | + if (dent->d_name[0] == '.') | ||
| 661 | + continue; | ||
| 662 | + | ||
| 663 | + if (read_link(base, dent->d_name, devpath, sizeof(devpath)) < 0) | ||
| 664 | + continue; | ||
| 665 | + | ||
| 666 | + device = device_create(devpath, bus, makedev(0, 0)); | ||
| 667 | + if (bus_handler) { | ||
| 668 | + if (bus_handler(device) < 0) { | ||
| 669 | + dbg("'%s' bus handler skipped event", devpath); | ||
| 670 | + free(device); | ||
| 671 | + continue; | ||
| 672 | + } | ||
| 673 | + } | ||
| 674 | + | ||
| 675 | + device_list_insert(&device_list, device); | ||
| 676 | + } | ||
| 677 | + closedir(dir); | ||
| 678 | + exec_list(&device_list, NULL, NULL); | ||
| 679 | + | ||
| 680 | + return 0; | ||
| 681 | +} | ||
| 682 | + | ||
| 683 | +static int udev_scan_devices(void) | ||
| 684 | +{ | ||
| 685 | + char base[PATH_SIZE]; | ||
| 686 | + DIR *dir; | ||
| 687 | + struct dirent *dent; | ||
| 688 | + | ||
| 689 | + snprintf(base, sizeof(base), "%s/bus", sysfs_path); | ||
| 690 | + base[sizeof(base)-1] = '\0'; | ||
| 691 | + | ||
| 692 | + dir = opendir(base); | ||
| 693 | + if (!dir) | ||
| 694 | + return -1; | ||
| 695 | + | ||
| 696 | + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { | ||
| 697 | + if (dent->d_name[0] == '.') | ||
| 698 | + continue; | ||
| 699 | + if (dent->d_type != DT_DIR) | ||
| 700 | + continue; | ||
| 701 | + | ||
| 702 | + /* add bus specific env values */ | ||
| 703 | + if (strcmp(dent->d_name, "pci") == 0) | ||
| 704 | + udev_scan_bus("pci", pci_handler); | ||
| 705 | + else if (strcmp(dent->d_name, "usb") == 0) | ||
| 706 | + udev_scan_bus("usb", usb_handler); | ||
| 707 | + else if (strcmp(dent->d_name, "serio") == 0) | ||
| 708 | + udev_scan_bus("serio", serio_handler); | ||
| 709 | + else if (strcmp(dent->d_name, "ccw") == 0) | ||
| 710 | + udev_scan_bus("ccw", ccw_handler); | ||
| 711 | + else | ||
| 712 | + udev_scan_bus(dent->d_name, modalias_handler); | ||
| 713 | + } | ||
| 714 | + closedir(dir); | ||
| 715 | + | ||
| 716 | + return 0; | ||
| 717 | +} | ||
| 718 | + | ||
| 719 | +int main(int argc, char *argv[], char *envp[]) | ||
| 720 | +{ | ||
| 721 | + LIST_HEAD(device_list); | ||
| 722 | + int i; | ||
| 723 | + | ||
| 724 | + logging_init("udevcoldplug"); | ||
| 725 | + udev_config_init(); sysfs_init(); | ||
| 726 | + dbg("version %s", UDEV_VERSION); | ||
| 727 | + | ||
| 728 | + udev_log_str = getenv("UDEV_LOG"); | ||
| 729 | + | ||
| 730 | + /* disable all logging if not explicitely requested */ | ||
| 731 | + if (udev_log_str == NULL) | ||
| 732 | + udev_log_priority = 0; | ||
| 733 | + | ||
| 734 | + for (i = 1 ; i < argc; i++) { | ||
| 735 | + char *arg = argv[i]; | ||
| 736 | + | ||
| 737 | + if (strcmp(arg, "help") == 0 || strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { | ||
| 738 | + printf("Usage: udevcoldplug \n" | ||
| 739 | + " --help print this help text\n\n"); | ||
| 740 | + exit(0); | ||
| 741 | + } else { | ||
| 742 | + fprintf(stderr, "unknown option\n\n"); | ||
| 743 | + exit(1); | ||
| 744 | + } | ||
| 745 | + } | ||
| 746 | + | ||
| 747 | + udevd_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); | ||
| 748 | + if (udevd_sock < 0) { | ||
| 749 | + err("error getting socket"); | ||
| 750 | + return 1; | ||
| 751 | + } | ||
| 752 | + | ||
| 753 | + /* create nodes for already available devices */ | ||
| 754 | + udev_scan_class(); | ||
| 755 | + udev_scan_block(); | ||
| 756 | + | ||
| 757 | + /* synthesize events for bus devices | ||
| 758 | + * may load modules or configure the device */ | ||
| 759 | + udev_scan_devices(); | ||
| 760 | + | ||
| 761 | + if (udevd_sock >= 0) | ||
| 762 | + close(udevd_sock); | ||
| 763 | + logging_close(); | ||
| 764 | + | ||
| 765 | + return 0; | ||
| 766 | +} | ||
| 767 | --- udev-081/Makefile | ||
| 768 | +++ udev-081/Makefile | ||
| 769 | @@ -58,6 +58,7 @@ PROGRAMS = \ | ||
| 770 | udevmonitor \ | ||
| 771 | udevinfo \ | ||
| 772 | udevtest \ | ||
| 773 | + udevsynthesize \ | ||
| 774 | udevstart | ||
| 775 | |||
| 776 | HEADERS = \ | ||
diff --git a/meta-oe/recipes-core/udev/udev/udevsynthesize.sh b/meta-oe/recipes-core/udev/udev/udevsynthesize.sh deleted file mode 100644 index d58217c144..0000000000 --- a/meta-oe/recipes-core/udev/udev/udevsynthesize.sh +++ /dev/null | |||
| @@ -1,51 +0,0 @@ | |||
| 1 | #!/bin/sh -e | ||
| 2 | |||
| 3 | load_input_modules() { | ||
| 4 | for module in mousedev evdev joydev; do | ||
| 5 | modprobe -q $module || true | ||
| 6 | done | ||
| 7 | } | ||
| 8 | |||
| 9 | if [ ! -e /sys/class/mem/null/uevent ]; then # <= 2.6.14 | ||
| 10 | /lib/udev/udevsynthesize | ||
| 11 | load_input_modules | ||
| 12 | exit 0 | ||
| 13 | fi | ||
| 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 | ||
| 17 | oldifs="$IFS" | ||
| 18 | IFS="|" | ||
| 19 | |||
| 20 | for 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 | ||
| 35 | done | ||
| 36 | |||
| 37 | for file in $first${IFS}$default${IFS}$last; do | ||
| 38 | [ "$file" ] || continue | ||
| 39 | echo 'add' > "$file" || true | ||
| 40 | done | ||
| 41 | |||
| 42 | IFS="$oldifs" | ||
| 43 | |||
| 44 | case "$(uname -r)" in | ||
| 45 | 2.6.1[0-5]|2.6.1[0-5][!0-9]*) # <= 2.6.15 | ||
| 46 | load_input_modules | ||
| 47 | ;; | ||
| 48 | esac | ||
| 49 | |||
| 50 | exit 0 | ||
| 51 | |||
diff --git a/meta-oe/recipes-core/udev/udev_168.bb b/meta-oe/recipes-core/udev/udev_168.bb deleted file mode 100644 index c37d087618..0000000000 --- a/meta-oe/recipes-core/udev/udev_168.bb +++ /dev/null | |||
| @@ -1,122 +0,0 @@ | |||
| 1 | DESCRIPTION = "udev is a daemon which dynamically creates and removes device nodes from \ | ||
| 2 | /dev/, handles hotplug events and loads drivers at boot time. It replaces \ | ||
| 3 | the hotplug package and requires a kernel not older than 2.6.27." | ||
| 4 | |||
| 5 | # udev 169 will bump kernel requirements up to 2.6.36 for ARM: | ||
| 6 | # http://git.kernel.org/?p=linux/hotplug/udev.git;a=commit;h=67a77c8bf299f6264f001677becd056316ebce2f | ||
| 7 | |||
| 8 | LICENSE = "GPLv2+ & LGPLv2.1+" | ||
| 9 | LICENSE_${PN} = "GPLv2+" | ||
| 10 | LICENSE_libudev = "LGPLv2.1+" | ||
| 11 | LICENSE_libgudev = "LGPLv2.1+" | ||
| 12 | LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \ | ||
| 13 | file://libudev/COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \ | ||
| 14 | file://extras/gudev/COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343" | ||
| 15 | |||
| 16 | # Needed for udev-extras | ||
| 17 | DEPENDS = "gperf-native usbutils acl glib-2.0" | ||
| 18 | |||
| 19 | SRC_URI = "http://kernel.org/pub/linux/utils/kernel/hotplug/udev-${PV}.tar.gz" | ||
| 20 | SRC_URI[md5sum] = "08eb7c2564bc89defcefdaa6ec4a9fc1" | ||
| 21 | SRC_URI[sha256sum] = "1d5c548d7c85d30b3508b82ad88d853e28dddb6c526d0e67aa92ac18af93d218" | ||
| 22 | |||
| 23 | SRC_URI += " \ | ||
| 24 | file://run.rules \ | ||
| 25 | file://udev.rules \ | ||
| 26 | file://links.conf \ | ||
| 27 | file://permissions.rules \ | ||
| 28 | file://mount.sh \ | ||
| 29 | file://mount.blacklist \ | ||
| 30 | file://network.sh \ | ||
| 31 | file://local.rules \ | ||
| 32 | file://default \ | ||
| 33 | file://init \ | ||
| 34 | file://cache \ | ||
| 35 | file://udev-compat-wrapper-patch \ | ||
| 36 | " | ||
| 37 | |||
| 38 | PR = "r3" | ||
| 39 | |||
| 40 | inherit update-rc.d autotools | ||
| 41 | |||
| 42 | EXTRA_OECONF += " --with-udev-prefix= \ | ||
| 43 | --with-libdir-name=${base_libdir} \ | ||
| 44 | --with-pci-ids-path=/usr/share/misc \ | ||
| 45 | --disable-introspection \ | ||
| 46 | ac_cv_file__usr_share_pci_ids=no \ | ||
| 47 | ac_cv_file__usr_share_hwdata_pci_ids=no \ | ||
| 48 | ac_cv_file__usr_share_misc_pci_ids=yes \ | ||
| 49 | --sbindir=${base_sbindir} \ | ||
| 50 | --libexecdir=${base_libdir}/udev \ | ||
| 51 | --with-rootlibdir=${base_libdir} \ | ||
| 52 | --with-systemdsystemunitdir=${base_libdir}/systemd/system/ \ | ||
| 53 | " | ||
| 54 | |||
| 55 | INITSCRIPT_NAME = "udev" | ||
| 56 | INITSCRIPT_PARAMS = "start 04 S ." | ||
| 57 | |||
| 58 | PACKAGES =+ "${PN}-systemd libudev libgudev udev-utils udev-consolekit" | ||
| 59 | |||
| 60 | FILES_${PN}-systemd = "${base_libdir}/systemd/system/" | ||
| 61 | |||
| 62 | FILES_libudev = "${base_libdir}/libudev.so.*" | ||
| 63 | FILES_libgudev = "${base_libdir}/libgudev*.so.*" | ||
| 64 | |||
| 65 | FILES_udev-utils = "${bindir}/udevinfo ${bindir}/udevtest ${base_sbindir}/udevadm" | ||
| 66 | |||
| 67 | RPROVIDES_${PN} = "hotplug" | ||
| 68 | FILES_${PN} += "${usrbindir}/* ${usrsbindir}/udevd" | ||
| 69 | FILES_${PN}-dbg += "${usrbindir}/.debug ${usrsbindir}/.debug" | ||
| 70 | RDEPENDS_${PN} += "module-init-tools-depmod udev-utils" | ||
| 71 | |||
| 72 | # udev installs binaries under $(udev_prefix)/lib/udev, even if ${libdir} | ||
| 73 | # is ${prefix}/lib64 | ||
| 74 | FILES_${PN} += "/lib/udev*" | ||
| 75 | FILES_${PN}-dbg += "/lib/udev/.debug" | ||
| 76 | |||
| 77 | FILES_${PN}-consolekit += "${libdir}/ConsoleKit" | ||
| 78 | RDEPENDS_${PN}-consolekit += "consolekit" | ||
| 79 | |||
| 80 | # Package up systemd files | ||
| 81 | FILES_${PN} += "${base_libdir}/systemd" | ||
| 82 | |||
| 83 | do_install () { | ||
| 84 | install -d ${D}${usrsbindir} \ | ||
| 85 | ${D}${sbindir} | ||
| 86 | oe_runmake 'DESTDIR=${D}' INSTALL=install install | ||
| 87 | install -d ${D}${sysconfdir}/init.d | ||
| 88 | install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev | ||
| 89 | install -m 0755 ${WORKDIR}/cache ${D}${sysconfdir}/init.d/udev-cache | ||
| 90 | |||
| 91 | install -d ${D}${sysconfdir}/default | ||
| 92 | install -m 0755 ${WORKDIR}/default ${D}${sysconfdir}/default/udev | ||
| 93 | |||
| 94 | cp ${S}/rules/rules.d/* ${D}${sysconfdir}/udev/rules.d/ | ||
| 95 | |||
| 96 | install -m 0644 ${WORKDIR}/mount.blacklist ${D}${sysconfdir}/udev/ | ||
| 97 | install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules | ||
| 98 | install -m 0644 ${WORKDIR}/permissions.rules ${D}${sysconfdir}/udev/rules.d/permissions.rules | ||
| 99 | install -m 0644 ${WORKDIR}/run.rules ${D}${sysconfdir}/udev/rules.d/run.rules | ||
| 100 | install -m 0644 ${WORKDIR}/udev.rules ${D}${sysconfdir}/udev/rules.d/udev.rules | ||
| 101 | install -m 0644 ${WORKDIR}/links.conf ${D}${sysconfdir}/udev/links.conf | ||
| 102 | |||
| 103 | touch ${D}${sysconfdir}/udev/saved.uname | ||
| 104 | touch ${D}${sysconfdir}/udev/saved.cmdline | ||
| 105 | touch ${D}${sysconfdir}/udev/saved.devices | ||
| 106 | touch ${D}${sysconfdir}/udev/saved.atags | ||
| 107 | |||
| 108 | install -d ${D}${sysconfdir}/udev/scripts/ | ||
| 109 | |||
| 110 | install -m 0755 ${WORKDIR}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh | ||
| 111 | install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts | ||
| 112 | } | ||
| 113 | |||
| 114 | # Create the cache after checkroot has run | ||
| 115 | pkg_postinst_udev_append() { | ||
| 116 | if test "x$D" != "x"; then | ||
| 117 | OPT="-r $D" | ||
| 118 | else | ||
| 119 | OPT="-s" | ||
| 120 | fi | ||
| 121 | update-rc.d $OPT udev-cache start 36 S . | ||
| 122 | } | ||
diff --git a/meta-oe/recipes-core/udev/udev_171.bb b/meta-oe/recipes-core/udev/udev_171.bb index 612da1062a..c02f4f3256 100644 --- a/meta-oe/recipes-core/udev/udev_171.bb +++ b/meta-oe/recipes-core/udev/udev_171.bb | |||
| @@ -13,9 +13,6 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \ | |||
| 13 | file://libudev/COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \ | 13 | file://libudev/COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \ |
| 14 | file://extras/gudev/COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343" | 14 | file://extras/gudev/COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343" |
| 15 | 15 | ||
| 16 | # Needs more testing | ||
| 17 | DEFAULT_PREFERENCE = "-1" | ||
| 18 | |||
| 19 | # Needed for udev-extras | 16 | # Needed for udev-extras |
| 20 | DEPENDS = "gperf-native usbutils acl glib-2.0" | 17 | DEPENDS = "gperf-native usbutils acl glib-2.0" |
| 21 | 18 | ||
