udev_151.bb: add rules for nokia900
authorKlaus Kurzmann <mok@fluxnetz.de>
Sat, 2 Oct 2010 14:34:50 +0000 (16:34 +0200)
committerMartin Jansa <Martin.Jansa@gmail.com>
Wed, 27 Oct 2010 21:12:13 +0000 (23:12 +0200)
Signed-off-by: Klaus Kurzmann <mok@fluxnetz.de>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
recipes/udev/files/nokia900/10-cmt_speech.rules [new file with mode: 0644]
recipes/udev/files/nokia900/nokia-n900-mac-hack.sh [new file with mode: 0644]
recipes/udev/files/nokia900/udev-rules-nokia-n900-hacks.rules [new file with mode: 0644]
recipes/udev/files/nokia900/udev-rules-nokia-n900-snd.rules [new file with mode: 0644]
recipes/udev/udev_151.bb

diff --git a/recipes/udev/files/nokia900/10-cmt_speech.rules b/recipes/udev/files/nokia900/10-cmt_speech.rules
new file mode 100644 (file)
index 0000000..25f46ef
--- /dev/null
@@ -0,0 +1 @@
+KERNEL=="cmt_speech", MODE="0777"
diff --git a/recipes/udev/files/nokia900/nokia-n900-mac-hack.sh b/recipes/udev/files/nokia900/nokia-n900-mac-hack.sh
new file mode 100644 (file)
index 0000000..c0b8251
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+if [ $# -ne 2 ]; then
+       echo "Usage: $0 iface newmac"
+       echo "       newmac is only saved if /etc/<iface>MAC is not found"
+       exit 1
+fi
+
+iface="$1"
+newmac="$2"
+macfile=/etc/"$iface"mac
+
+# If no MAC is found, save the one given as argument
+if [ ! -e $macfile ]; then
+   /bin/echo "$newmac" > $macfile
+# Otherwise load MAC from file
+else
+   newmac=`/bin/cat $macfile`
+fi
+
+# Configure interface
+/sbin/ifconfig "$iface" down
+/sbin/ifconfig "$iface" hw ether $newmac
diff --git a/recipes/udev/files/nokia900/udev-rules-nokia-n900-hacks.rules b/recipes/udev/files/nokia900/udev-rules-nokia-n900-hacks.rules
new file mode 100644 (file)
index 0000000..8c19e65
--- /dev/null
@@ -0,0 +1,8 @@
+# MAC address hack
+# forces n900 to always use the same MAC address that is generated in the first boot
+SUBSYSTEM=="net",KERNEL=="wlan0", RUN+="/lib/udev/nokia-n900-mac-hack.sh %k $attr{address}"
+
+# Create inputdev symlinks for kbslider contextkit plugin
+SUBSYSTEM=="input" ATTRS{name}=="TWL4030 Keypad" SYMLINK+="input/keypad"
+SUBSYSTEM=="input" ATTRS{name}=="gpio-keys" SYMLINK+="input/gpio-keys"
+
diff --git a/recipes/udev/files/nokia900/udev-rules-nokia-n900-snd.rules b/recipes/udev/files/nokia900/udev-rules-nokia-n900-snd.rules
new file mode 100644 (file)
index 0000000..413c165
--- /dev/null
@@ -0,0 +1,10 @@
+# ALSA devices
+KERNEL=="controlC[0-9]*",   NAME="snd/%k"
+KERNEL=="hwC[D0-9]*",       NAME="snd/%k"
+KERNEL=="pcmC[D0-9cp]*",    NAME="snd/%k"
+KERNEL=="midiC[D0-9]*",     NAME="snd/%k"
+KERNEL=="timer",        NAME="snd/%k"
+KERNEL=="seq",          NAME="snd/%k"
+
+KERNEL=="snd", SUBSYSTEM=="module", ACTION=="add", \
+    RUN+="/bin/ln -sf /proc/asound/oss/sndstat $root/sndstat"
index 554f86b..4796957 100644 (file)
@@ -3,7 +3,7 @@ DESCRIPTION = "udev is a daemon which dynamically creates and removes device nod
 the hotplug package and requires a kernel not older than 2.6.12."
 LICENSE = "GPLv2+"
 
-PR = "r19"
+PR = "r20"
 
 # Untested
 DEFAULT_PREFERENCE = "-1"
@@ -41,6 +41,13 @@ SRC_URI_append_bug = " \
        file://10-mx31.rules \
        file://bmi_eventpipe.sh "
 
+SRC_URI_append_nokia900 = " \
+       file://10-cmt_speech.rules \
+       file://udev-rules-nokia-n900-hacks.rules \
+       file://udev-rules-nokia-n900-snd.rules \
+       file://nokia-n900-mac-hack.sh \
+"
+
 PACKAGE_ARCH_bug = "bug"
 
 inherit update-rc.d autotools
@@ -145,6 +152,13 @@ do_install_append_bug() {
        install -m 0644 ${WORKDIR}/bmi_eventpipe.sh ${D}${sysconfdir}/udev/scripts/bmi_eventpipe.sh
 }
 
+do_install_append_nokia900() {
+       install -m 0644 ${WORKDIR}/10-cmt_speech.rules ${D}${sysconfdir}/udev/rules.d/10-cmt_speech.rules
+       install -m 0644 ${WORKDIR}/udev-rules-nokia-n900-hacks.rules ${D}${sysconfdir}/udev/rules.d/udev-rules-nokia-n900-hacks.rules
+       install -m 0644 ${WORKDIR}/udev-rules-nokia-n900-snd.rules ${D}${sysconfdir}/udev/rules.d/udev-rules-nokia-n900-snd.rules
+       install -m 0755 ${WORKDIR}/nokia-n900-mac-hack.sh ${D}${sysconfdir}/udev/scripts/nokia-n900-mac-hack.sh
+}
+
 # Create the cache after checkroot has run
 pkg_postinst_udev_append() {
        if test "x$D" != "x"; then