summaryrefslogtreecommitdiff
path: root/packages/udev/udev-084/udevsynthesize.sh
diff options
context:
space:
mode:
authorJohn Bowler <jbowler@nslu2-linux.org>2006-02-06 18:36:28 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2006-02-06 18:36:28 +0000
commit5c70d86825ced73fe07d02a4647e70c54f2efe07 (patch)
tree23b7b80934d3f7d54d036bfa71c7ffae68dd169b /packages/udev/udev-084/udevsynthesize.sh
parent11ec8ab68be596ed8fca854042f2e8815da19ce2 (diff)
parentedab0569b271a6c11d611afcdeb3f8a5a3a682e6 (diff)
merge of 87274db5332eba6f472a3332129b88b8282ccda2
and 3b6a0bff32c9c79ebeb059cd1559d7731542af03
Diffstat (limited to 'packages/udev/udev-084/udevsynthesize.sh')
-rw-r--r--packages/udev/udev-084/udevsynthesize.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/packages/udev/udev-084/udevsynthesize.sh b/packages/udev/udev-084/udevsynthesize.sh
new file mode 100644
index 0000000000..d58217c144
--- /dev/null
+++ b/packages/udev/udev-084/udevsynthesize.sh
@@ -0,0 +1,51 @@
+#!/bin/sh -e
+
+load_input_modules() {
+ for module in mousedev evdev joydev; do
+ modprobe -q $module || true
+ done
+}
+
+if [ ! -e /sys/class/mem/null/uevent ]; then # <= 2.6.14
+ /lib/udev/udevsynthesize
+ load_input_modules
+ exit 0
+fi
+
+# replace $IFS with something which is not likely to appear in a sysfs path,
+# because some buggy drivers have spaces in their names
+oldifs="$IFS"
+IFS="|"
+
+for file in /sys/bus/*/devices/*/uevent /sys/class/*/*/uevent \
+ /sys/block/*/uevent /sys/block/*/*/uevent; do
+ case "$file" in
+ */device/uevent) ;; # skip followed device symlinks
+ */\*/*) ;;
+
+ */class/mem/*) # for /dev/null
+ first="$first${IFS}$file" ;;
+
+ */block/md[0-9]*)
+ last="$last${IFS}$file" ;;
+
+ *)
+ default="$default${IFS}$file" ;;
+ esac
+done
+
+for file in $first${IFS}$default${IFS}$last; do
+ [ "$file" ] || continue
+ echo 'add' > "$file" || true
+done
+
+IFS="$oldifs"
+
+case "$(uname -r)" in
+ 2.6.1[0-5]|2.6.1[0-5][!0-9]*) # <= 2.6.15
+ load_input_modules
+ ;;
+esac
+
+exit 0
+