maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Disable touchscreen on longpress switch key (https://talk.maemo.org/showthread.php?t=71153)

ale152 2011-03-17 19:43

Disable touchscreen on longpress switch key
 
Hello!
I'm trying to have touchscreen disabled on switch key long press.
I'm editing the /usr/bin/longpress.sh file of Matan's longpress app.
This is the original script:
Code:

#!/bin/sh

if [ `hal-get-property --udi /org/freedesktop/Hal/devices/platform_kb_lock --key button.state.value` == true  ] ; then
#  echo press >> /tmp/kllp
#  date >> /tmp/kllp
  echo $$ > /tmp/kb_lock_long_pid
  sleep 2
  if [ -f /tmp/kb_lock_long_pid ] ; then
  rm -f /tmp/kb_lock_long_pid
#  echo long >> /tmp/kllp
#  date >> /tmp/kllp
#  run-standalone.sh env >> /tmp/kllp
  if true ; then
    if dbus-send --print-reply --system --dest=com.nokia.mce --type=method_call /com/nokia/mce/request com.nokia.mce.request.get_device_mode | grep -q normal ; then
    dbus-send --system --dest=com.nokia.mce --type=method_call /com/nokia/mce/request com.nokia.mce.request.req_device_mode_change string:"offline"
    else
    dbus-send --system --dest=com.nokia.mce --type=method_call /com/nokia/mce/request com.nokia.mce.request.req_device_mode_change string:"normal"
    fi
  else
    if grep -q silent /home/user/.profiled/current ; then
    run-standalone.sh dbus-send --session --dest=com.nokia.profiled --type=method_call /com/nokia/profiled com.nokia.profiled.set_profile string:"general"
    else
    run-standalone.sh dbus-send --session --dest=com.nokia.profiled --type=method_call /com/nokia/profiled com.nokia.profiled.set_profile string:"silent"
    fi
  fi
    if \
    dbus-send --print-reply --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.get_tklock_mode | grep -q unlocked
    then
      dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_tklock_mode_change string:"locked"
    else
      dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_tklock_mode_change string:"unlocked"
    fi
  fi
else
 if [ -f /tmp/kb_lock_long_pid ] ; then
  kill `cat /tmp/kb_lock_long_pid`
  rm -f /tmp/kb_lock_long_pid
#  echo del >> /tmp/kllp
#  date >> /tmp/kllp
 fi
fi &

I just replaced [14-19] lines with:
Code:

  t=$(cat /sys/devices/platform/omap2_mcspi.1/spi1.0/disable_ts)
  if [ "$t" -eq "0" ]
  then
    echo 1 > /sys/devices/platform/omap2_mcspi.1/spi1.0/disable_ts
    dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Touch has been disabled"
  else
    echo 0 > /sys/devices/platform/omap2_mcspi.1/spi1.0/disable_ts
    dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Touch has been enabled"
  fi

But it doesn't work :(
Where's the problem?
Thank you.


All times are GMT. The time now is 00:56.

vBulletin® Version 3.8.8