From: David-John Willis Date: Mon, 28 Feb 2011 14:50:13 +0000 (+0000) Subject: udev: Add omap3-pandora rules to the 165 recipe and bump PR. X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b63cedfa547c2be2a13c78364728aa8ceca8b001;p=openembedded.git udev: Add omap3-pandora rules to the 165 recipe and bump PR. * omap3-pandora rules are taken from the 151 recipes. --- diff --git a/recipes/udev/udev-165/omap3-pandora/local.rules b/recipes/udev/udev-165/omap3-pandora/local.rules index e433cf9593..42b7d61318 100644 --- a/recipes/udev/udev-165/omap3-pandora/local.rules +++ b/recipes/udev/udev-165/omap3-pandora/local.rules @@ -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-165/omap3-pandora/mount.sh b/recipes/udev/udev-165/omap3-pandora/mount.sh new file mode 100644 index 0000000000..716c6115dc --- /dev/null +++ b/recipes/udev/udev-165/omap3-pandora/mount.sh @@ -0,0 +1,91 @@ +#!/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 diff --git a/recipes/udev/udev_165.bb b/recipes/udev/udev_165.bb index d426aff6b6..3273593bef 100644 --- a/recipes/udev/udev_165.bb +++ b/recipes/udev/udev_165.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 = "r3" +PR = "r4" # Untested DEFAULT_PREFERENCE = "-1"