udev 154: Add newest omap3-pandora rules and custom mount.sh (from 151).
authorDavid-John Willis <John.Willis@Distant-earth.com>
Wed, 29 Sep 2010 20:22:03 +0000 (21:22 +0100)
committerDavid-John Willis <John.Willis@Distant-earth.com>
Mon, 4 Apr 2011 19:15:46 +0000 (20:15 +0100)
recipes/udev/udev-154/omap3-pandora/local.rules
recipes/udev/udev-154/omap3-pandora/mount.sh [new file with mode: 0644]
recipes/udev/udev_154.bb

index e433cf9..42b7d61 100644 (file)
@@ -31,10 +31,19 @@ KERNEL=="fb0",  SYMLINK+="fb"
 ACTION=="add", DEVPATH=="/devices/*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}"
 
 # Create a symlink to any touchscreen input device
-SUBSYSTEM=="input", KERNEL=="event[0-9]*", SYSFS{modalias}=="input:*-e0*,3,*a0,1,*18,*", SYMLINK+="input/touchscreen0"
-SUBSYSTEM=="input", KERNEL=="event[0-9]*", SYSFS{modalias}=="ads7846", SYMLINK+="input/touchscreen0"
+SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="input:*-e0*,3,*a0,1,*18,*", SYMLINK+="input/touchscreen0"
+SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="ads7846", SYMLINK+="input/touchscreen0"
 
 # Local UDEV rule changes for the Pandora system.
 
 # Let all users access the event devices using EVDEV (the OpenPandora is not multiuser after all).
-KERNEL=="event[0-9]",MODE="0666"
\ No newline at end of file
+KERNEL=="event[0-9]", MODE="0666"
+KERNEL=="mice",                        NAME="input/%k", MODE="0666"
+KERNEL=="mouse[0-9]*",         NAME="input/%k", MODE="0666"
+KERNEL=="event[0-9]*",         NAME="input/%k", MODE="0666"
+KERNEL=="js[0-9]*",            NAME="input/%k", MODE="0666"
+KERNEL=="ts[0-9]*",            NAME="input/%k", MODE="0666"
+KERNEL=="uinput",              NAME="input/%k", MODE="0666"
+
+# reserve fb2 for the system
+KERNEL=="fb2", ACTION=="add",  MODE="0600"
diff --git a/recipes/udev/udev-154/omap3-pandora/mount.sh b/recipes/udev/udev-154/omap3-pandora/mount.sh
new file mode 100644 (file)
index 0000000..091e650
--- /dev/null
@@ -0,0 +1,92 @@
+#!/bin/sh
+#
+# Called from udev
+#
+# Attempt to mount any added block devices and remove any removed devices.
+#
+
+MOUNT="/bin/mount"
+PMOUNT="/usr/bin/pmount"
+UMOUNT="/bin/umount"
+blkid="/usr/sbin/blkid"
+name="`basename "$DEVNAME"`"
+name2="`$blkid "$DEVNAME" -c /dev/null -o value -s LABEL | sed 's/ /_/g'`"
+name3=$(echo $DEVNAME | sed 's/.*dev.//g')
+
+for line in `grep -v ^# /etc/udev/mount.blacklist`
+do
+       if ( echo "$DEVNAME" | grep -q "$line" )
+       then
+               logger "udev/mount.sh" "[$DEVNAME] is blacklisted, ignoring"
+               exit 0
+       fi
+done
+
+automount() {
+       if [ -n "$name2" ]
+       then
+               c=1
+               while ( grep "/media/$name2"  /proc/mounts); do
+                       name2="$name2-$c"
+                       c=$(expr $c + 1)
+               done
+               name="$name2"
+       fi
+       ! test -d "/media/$name" && mkdir -p "/media/$name"
+
+
+       if ! $MOUNT -t auto -o dirsync,noatime,umask=0 $DEVNAME "/media/$name" && ! $MOUNT -t auto -o dirsync,noatime $DEVNAME "/media/$name"
+       then
+               #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/media/$name\" failed!"
+               rm_dir "/media/$name"
+       else
+               logger "mount.sh/automount" "Auto-mount of [/media/$name] successful"
+               touch "/tmp/.automount-$name3"
+               fstype=$(cat /etc/mtab | grep $DEVNAME | awk  '{print $3}')
+               echo "$DEVNAME  1000    0       $fstype dirsync,noatime,umask=0 /media/$name" >> /media/.hal-mtab
+               touch /media/.hal-mtab-lock
+       fi
+}
+
+rm_dir() {
+       # We do not want to rm -r populated directories
+       if test "`find "$1" | wc -l | tr -d " "`" -lt 2 -a -d "$1"
+       then
+               ! test -z "$1" && rm -r "$1"
+       else
+               logger "mount.sh/automount" "Not removing non-empty directory [$1]"
+       fi
+}
+
+if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ]; then
+       if [ -x "$PMOUNT" ]; then
+               $PMOUNT $DEVNAME 2> /dev/null
+       elif [ -x $MOUNT ]; then
+               $MOUNT $DEVNAME 2> /dev/null
+       fi
+
+       # If the device isn't mounted at this point, it isn't configured in fstab
+       # 20061107: Small correction: The rootfs partition may be called just "rootfs" and not by
+       #           its true device name so this would break. If the rootfs is mounted on two places
+       #           during boot, it confuses the heck out of fsck. So Im auto-adding the root-partition
+       #           to /etc/udev/mount.blacklist via postinst
+
+       cat /proc/mounts | awk '{print $1}' | grep -q "^$DEVNAME$" || automount
+
+fi
+
+if [ "$ACTION" = "remove" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then
+       for mnt in `grep "$DEVNAME" /proc/mounts | cut -f 2 -d " " `
+       do
+               # 20100306: Remove the mount point forcibly (Lazy) as the user has already removed the device by the 
+               # DJWillis: time this fires so any handles are bad anyway. This should stop 'stale' folders being
+               #           left around all the time. | cut -d ' ' -f 2 | sed 's/\\040/ /g'
+               mnt2=$(echo $mnt | sed 's/\\040/ /g')
+               $UMOUNT -l "$mnt2"
+       done
+
+       # Remove empty directories from auto-mounter
+       sed -e "/$name3/d" /media/.hal-mtab > /tmp/.hal-mtab
+       mv /tmp/.hal-mtab /media/.hal-mtab
+       test -e "/tmp/.automount-$name3" && rm_dir "$mnt2"
+fi
index 8b416e2..fcb6471 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 = "r8"
+PR = "r9"
 
 # Untested
 DEFAULT_PREFERENCE = "-1"