[oe-commits] Klaus Kurzmann : udev_151.bb: add rules for nokia900

git version control git at git.openembedded.org
Wed Oct 27 21:16:50 UTC 2010


Module: openembedded.git
Branch: master
Commit: a8d15196e943b20461994a3e9efaae0d0d592ec5
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=a8d15196e943b20461994a3e9efaae0d0d592ec5

Author: Klaus Kurzmann <mok at fluxnetz.de>
Date:   Sat Oct  2 16:34:50 2010 +0200

udev_151.bb: add rules for nokia900

Signed-off-by: Klaus Kurzmann <mok at fluxnetz.de>
Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>

---

 recipes/udev/files/nokia900/10-cmt_speech.rules    |    1 +
 recipes/udev/files/nokia900/nokia-n900-mac-hack.sh |   23 ++++++++++++++++++++
 .../nokia900/udev-rules-nokia-n900-hacks.rules     |    8 +++++++
 .../files/nokia900/udev-rules-nokia-n900-snd.rules |   10 ++++++++
 recipes/udev/udev_151.bb                           |   16 +++++++++++++-
 5 files changed, 57 insertions(+), 1 deletions(-)

diff --git a/recipes/udev/files/nokia900/10-cmt_speech.rules b/recipes/udev/files/nokia900/10-cmt_speech.rules
new file mode 100644
index 0000000..25f46ef
--- /dev/null
+++ b/recipes/udev/files/nokia900/10-cmt_speech.rules
@@ -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
index 0000000..c0b8251
--- /dev/null
+++ b/recipes/udev/files/nokia900/nokia-n900-mac-hack.sh
@@ -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
index 0000000..8c19e65
--- /dev/null
+++ b/recipes/udev/files/nokia900/udev-rules-nokia-n900-hacks.rules
@@ -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
index 0000000..413c165
--- /dev/null
+++ b/recipes/udev/files/nokia900/udev-rules-nokia-n900-snd.rules
@@ -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"
diff --git a/recipes/udev/udev_151.bb b/recipes/udev/udev_151.bb
index 554f86b..4796957 100644
--- a/recipes/udev/udev_151.bb
+++ b/recipes/udev/udev_151.bb
@@ -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





More information about the Openembedded-commits mailing list