maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   Show the lock screen via script (dbus or other) (https://talk.maemo.org/showthread.php?t=79683)

hfilho 2011-11-04 17:55

Show the lock screen via script (dbus or other)
 
Hey all,

I'm trying to write a script (using dbus, but if other options are better, please let me know) to programmatically show the lock screen, simulating a power button press when the n900 is locked. Is there any way to do this?

I've tried monitoring dbus for the power button press, and came up with this dbus command:
Code:

dbus-send --type=signal --system --print-reply --dest=org.freedesktop.Hal /org/freedesktop/Hal/devices/computer_logicaldev_input org.freedesktop.Hal.Device.Condition string:'ButtonPressed' string:'power'
Alas, it doesn't work (nothing happens). Just for the record, the n900 was locked when I tried this (over SSH), and when I pressed the actual power button, the lock screen appeared.

Any help is much appreciated.

nicolai 2011-11-05 00:09

Re: Show the lock screen via script (dbus or other)
 
shell script (taken from
http://meego.gitorious.org/meego-mid...sts/mcetorture)

Code:

#!/bin/sh

EVENT_POWER_KEY="\x74\x00"
POWERBUTTON_EVENT_FILE=/dev/input/pwrbutton
EVENT_TIMESTAMP="\x48\x67\x98\x45\x5f\x16\x0b\x00"
EVENT_KEY_TYPE="\x01\x00"
EVENT_PRESS_VALUE="\x01\x00\x00\x00"
EVENT_RELEASE_VALUE="\x00\x00\x00\x00"

printf "$EVENT_TIMESTAMP$EVENT_KEY_TYPE$EVENT_POWER_KEY$EVENT_PRESS_VALUE$EVENT_TIMESTAMP$EVENT_KEY_TYPE$EVENT_POWER_KEY$EVENT_RELEASE_VALUE" > $POWERBUTTON_EVENT_FILE

For what is that good for?

hfilho 2011-11-05 01:49

Re: Show the lock screen via script (dbus or other)
 
Holly sh*t man, I'd never have got that in a million years. Thank you so much. For that torture script also, gonna study it carefully later, I'm sure it'll come in handy later on.

The purpose of this is I'm trying to do something about the problem others and myself are having of, the phone being locked and receiving a call, it getting unlocked and you accidentally pressing the touchscreen buttons (either answering or rejecting the call).

I've already managed to, when the incoming call rings, if the phone was locked, lock it again. But the screen just stays black, although it plays the ringing tone. I wanted a visual warning that it was actually ringing, specially for when I put it in silent. So I thought of showing the lock screen. I also plan to flash the led in a diferent color and rhythm, maybe a violet or orange tone, to distinguish it form the "missed call" and "full battery" ones, which are more common.

Now my next step is to try to get the calling number or contact name and write it on the lock screen. Wish me luck, and if you have any ideas that you care to share, they're more than welcome. You're apparently the local wizard :D

Cheers,

Heliton

moudy91 2012-01-23 07:57

Re: Show the lock screen via script (dbus or other)
 
Quote:

Originally Posted by nicolai (Post 1118512)
shell script (taken from
http://meego.gitorious.org/meego-mid...sts/mcetorture)

Code:

#!/bin/sh

EVENT_POWER_KEY="\x74\x00"
POWERBUTTON_EVENT_FILE=/dev/input/pwrbutton
EVENT_TIMESTAMP="\x48\x67\x98\x45\x5f\x16\x0b\x00"
EVENT_KEY_TYPE="\x01\x00"
EVENT_PRESS_VALUE="\x01\x00\x00\x00"
EVENT_RELEASE_VALUE="\x00\x00\x00\x00"

printf "$EVENT_TIMESTAMP$EVENT_KEY_TYPE$EVENT_POWER_KEY$EVENT_PRESS_VALUE$EVENT_TIMESTAMP$EVENT_KEY_TYPE$EVENT_POWER_KEY$EVENT_RELEASE_VALUE" > $POWERBUTTON_EVENT_FILE

For what is that good for?

Dear nicolai
correct me if am wrong that script will open the power button? because really i want a script to open the power button because mine is damage

moudy91 2012-01-26 10:00

Re: Show the lock screen via script (dbus or other)
 
Quote:

Originally Posted by nicolai (Post 1118512)
shell script (taken from
http://meego.gitorious.org/meego-mid...sts/mcetorture)

Code:

#!/bin/sh

EVENT_POWER_KEY="\x74\x00"
POWERBUTTON_EVENT_FILE=/dev/input/pwrbutton
EVENT_TIMESTAMP="\x48\x67\x98\x45\x5f\x16\x0b\x00"
EVENT_KEY_TYPE="\x01\x00"
EVENT_PRESS_VALUE="\x01\x00\x00\x00"
EVENT_RELEASE_VALUE="\x00\x00\x00\x00"

printf "$EVENT_TIMESTAMP$EVENT_KEY_TYPE$EVENT_POWER_KEY$EVENT_PRESS_VALUE$EVENT_TIMESTAMP$EVENT_KEY_TYPE$EVENT_POWER_KEY$EVENT_RELEASE_VALUE" > $POWERBUTTON_EVENT_FILE

For what is that good for?

can this script be done on a qbw command, and how???
because it most be a root.
thank you

nicolai 2012-01-26 11:00

Re: Show the lock screen via script (dbus or other)
 
Does it work with
sudo <scriptname>

moudy91 2012-01-28 07:14

Re: Show the lock screen via script (dbus or other)
 
Quote:

Originally Posted by nicolai (Post 1155966)
Does it work with
sudo <scriptname>

you mean save the script .sh then sudo that .sh file?? because i did that and nothing happens.

JonWW 2012-01-28 07:56

Re: Show the lock screen via script (dbus or other)
 
Quote:

Originally Posted by moudy91 (Post 1156839)
you mean save the script .sh then sudo that .sh file?? because i did that and nothing happens.

Correct, save script to file, but use this code to run it:
Code:

echo "/full/path/to/script"|root

moudy91 2012-01-28 08:58

Re: Show the lock screen via script (dbus or other)
 
Quote:

Originally Posted by JonWW (Post 1156849)
Correct, save script to file, but use this code to run it:
Code:

echo "/full/path/to/script"|root

i did copy the scipt to a txt file then save it to .sh
on a qbw i did put
Code:

echo "/home/user/MyDocs/Power.sh"|root
but nothing happens

JonWW 2012-01-29 21:26

Re: Show the lock screen via script (dbus or other)
 
Quote:

Originally Posted by moudy91 (Post 1156865)
i did copy the scipt to a txt file then save it to .sh
on a qbw i did put
Code:

echo "/home/user/MyDocs/Power.sh"|root
but nothing happens

Code should have been:
Code:

echo "sh /home/user/MyDocs/Power.sh"|root


All times are GMT. The time now is 07:23.

vBulletin® Version 3.8.8