From b7c0b97dec8d44496972003a3258654945872d29 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sat, 6 May 2006 17:52:09 +0000 Subject: zaurusd: Use our own copy of zaurus-hinge.in instead of patching. Clean up the .bb a bit. --- .../files/mbinputmgr-honor-user-prefs.patch | 65 ---------------- packages/zaurusd/files/zaurus-hinge.in | 91 ++++++++++++++++++++++ packages/zaurusd/zaurusd_svn.bb | 17 ++-- 3 files changed, 101 insertions(+), 72 deletions(-) delete mode 100644 packages/zaurusd/files/mbinputmgr-honor-user-prefs.patch create mode 100644 packages/zaurusd/files/zaurus-hinge.in diff --git a/packages/zaurusd/files/mbinputmgr-honor-user-prefs.patch b/packages/zaurusd/files/mbinputmgr-honor-user-prefs.patch deleted file mode 100644 index e2d56874c9..0000000000 --- a/packages/zaurusd/files/mbinputmgr-honor-user-prefs.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- zaurusd/scripts/zaurus-hinge.in 2006-03-24 18:23:15.000000000 +0100 -+++ zaurusd/scripts/zaurus-hinge 2006-03-24 18:33:24.480748696 +0100 -@@ -18,6 +18,10 @@ - exit 1 - fi - -+panel_user="`ps aux|grep matchbox-panel|grep -v grep | awk '{print $2}'`" -+ -+ -+ - STATE=$1 - - if [ $STATE = "3" ]; then -@@ -29,8 +33,21 @@ - fi - - if [ $STATE = "0" ]; then -- #echo "lanscape" -- killproc @bindir@/mbinputmgr -+ #echo "landscape" -+ -+ # As matchbox-panel updates its written configuration right after an applet dies / is killed, we can not be sure -+ # whether the user had gpe-panel in his preferences after rotating to portrait. And since there is a slim chance -+ # that a user changes his preferences from time to time, we renew that dumped configuration every now and then ;) -+ -+ if ! test -e "/tmp/gpe-panel.session-$panel_user" -+ then -+ test -e /home/$panel_user/.matchbox/mbdock.session && cp /home/$panel_user/.matchbox/mbdock.session "/tmp/gpe-panel.session-$panel_user" -+ test -e "/tmp/gpe-panel.session-$panel_user" && cat "/tmp/gpe-panel.session-$panel_user" | grep -q panel || killproc @bindir@/mbinputmgr -+ else -+ cat "/tmp/gpe-panel.session-$panel_user" | grep -q panel || killproc @bindir@/mbinputmgr -+ rm "/tmp/gpe-panel.session-$panel_user" -+ fi -+ - # urg mbinputmgr should kill below - killproc @bindir@/matchbox-keyboard - killproc @bindir@/matchbox-stroke -@@ -47,8 +64,25 @@ - fi - # just to be extra safe - sleep 1 -- if [ -x @bindir@/mbinputmgr ]; then -- @bindir@/mbinputmgr & -+ -+ echo "panel_user = [$panel_user]" -+ -+ if ! test -e "/tmp/gpe-panel.session-$panel_user" -+ then -+ cp /home/$panel_user/.matchbox/mbdock.session "/tmp/gpe-panel.session-$panel_user" -+ else -+ rm "/tmp/gpe-panel.session-$panel_user" - fi -+ -+ if test -n "$panel_user" -+ then -+ echo "Running panel as user [$panel_user]" -+ ps aux | grep "$panel_user" | grep -q "mbinputmgr " || su $panel_user -c @bindir@/mbinputmgr & -+ else -+ # A failsafe can't hurt -+ echo "Warning: Running mbinputmgr as root!" -+ ps aux | grep -q "mbinputmgr " || @bindir@/mbinputmgr & -+ fi -+ - exit 0 - fi diff --git a/packages/zaurusd/files/zaurus-hinge.in b/packages/zaurusd/files/zaurus-hinge.in new file mode 100644 index 0000000000..1d4682e603 --- /dev/null +++ b/packages/zaurusd/files/zaurus-hinge.in @@ -0,0 +1,91 @@ +#!/bin/sh +# +# Quick handler for chkhinge26 and X. +# + +killproc() { # kill the named process(es) + pid=`/bin/ps -e x | + /bin/grep $1 | + /bin/grep -v grep | + /bin/sed -e 's/^ *//' -e 's/ .*//'` + [ "$pid" != "" ] && kill $pid +} + +export DISPLAY=:0 + +if [ -z "$1" ]; then + echo "Usage: hinge-handler ( 3 = closed, 0 = landscape, 2 = portrait )" + exit 1 +fi + +panel_user="`ps aux|grep matchbox-panel|grep -v grep | awk '{print $2}'`" + + + +STATE=$1 + +if [ $STATE = "3" ]; then + #echo "sleeping" +# +# uncomment 'if' block below to have zaurus suspend on hinge close +# +# if [ -x @bindir@/apm ]; then +# apm -s +# fi + exit 0 +fi + +if [ $STATE = "0" ]; then + #echo "landscape" + + # As matchbox-panel updates its written configuration right after an applet dies / is killed, we can not be sure + # whether the user had gpe-panel in his preferences after rotating to portrait. And since there is a slim chance + # that a user changes his preferences from time to time, we renew that dumped configuration every now and then ;) + + if ! test -e "/tmp/gpe-panel.session-$panel_user" + then + test -e /home/$panel_user/.matchbox/mbdock.session && cp /home/$panel_user/.matchbox/mbdock.session "/tmp/gpe-panel.session-$panel_user" + test -e "/tmp/gpe-panel.session-$panel_user" && cat "/tmp/gpe-panel.session-$panel_user" | grep -q panel || killproc @bindir@/mbinputmgr + else + cat "/tmp/gpe-panel.session-$panel_user" | grep -q panel || killproc @bindir@/mbinputmgr + rm "/tmp/gpe-panel.session-$panel_user" + fi + + # urg mbinputmgr should kill below + killproc @bindir@/matchbox-keyboard + killproc @bindir@/matchbox-stroke + if [ -x @bindir@/xrandr ]; then + xrandr -o normal + fi + exit 0 +fi + +if [ $STATE = "2" ]; then + #echo "portrait" + if [ -x @bindir@/xrandr ]; then + @bindir@/xrandr -o left + fi + # just to be extra safe + sleep 1 + + echo "panel_user = [$panel_user]" + + if ! test -e "/tmp/gpe-panel.session-$panel_user" + then + cp /home/$panel_user/.matchbox/mbdock.session "/tmp/gpe-panel.session-$panel_user" + else + rm "/tmp/gpe-panel.session-$panel_user" + fi + + if test -n "$panel_user" + then + echo "Running panel as user [$panel_user]" + ps aux | grep "$panel_user" | grep -q "mbinputmgr " || su $panel_user -c @bindir@/mbinputmgr & + else + # A failsafe can't hurt + echo "Warning: Running mbinputmgr as root!" + ps aux | grep -q "mbinputmgr " || @bindir@/mbinputmgr & + fi + + exit 0 +fi diff --git a/packages/zaurusd/zaurusd_svn.bb b/packages/zaurusd/zaurusd_svn.bb index 52a7b353d3..ec385d4934 100644 --- a/packages/zaurusd/zaurusd_svn.bb +++ b/packages/zaurusd/zaurusd_svn.bb @@ -1,20 +1,23 @@ -LICENSE = "GPL" +DESCRIPTION = "Daemon to handle device specifc features." SECTION = "base" MAINTAINER = "Richard Purdie " -DESCRIPTION = "Daemon to handle device specifc features." -PV = "0.0+svn${SRCDATE}" -PR = "r2" +LICENSE = "GPL" DEPENDS = "tslib" +PV = "0.0+svn${SRCDATE}" +PR = "r4" SRC_URI = "svn://svn.o-hand.com/repos/misc/trunk;module=zaurusd;proto=http \ - file://mbinputmgr-honor-user-prefs.patch;patch=1" + file://zaurus-hinge.in" + S = "${WORKDIR}/${PN}" PACKAGE_ARCH = "${MACHINE_ARCH}" -inherit autotools pkgconfig +do_configure_prepend () { + cp ${WORKDIR}/zaurus-hinge.in ${S}/scripts +} -inherit update-rc.d +inherit autotools pkgconfig update-rc.d INITSCRIPT_NAME = "zaurusd" INITSCRIPT_PARAMS = "start 99 5 2 . stop 20 0 1 6 ." -- cgit v1.2.3