Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Show the lock screen via script (dbus or other)

    Reply
    Page 1 of 2 | 1   2   | Next
    hfilho | # 1 | 2011-11-04, 17:55 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    nicolai | # 2 | 2011-11-05, 00:09 | Report

    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?

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 4 Users Say Thank You to nicolai For This Useful Post:
    Estel, JonWW, moudy91, wolke

     
    hfilho | # 3 | 2011-11-05, 01:49 | Report

    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

    Cheers,

    Heliton

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 3 Users Say Thank You to hfilho For This Useful Post:
    Estel, ioncelmare, nicolai

     
    moudy91 | # 4 | 2012-01-23, 07:57 | Report

    Originally Posted by nicolai View Post
    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

    Edit | Forward | Quote | Quick Reply | Thanks

     
    moudy91 | # 5 | 2012-01-26, 10:00 | Report

    Originally Posted by nicolai View Post
    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

    Edit | Forward | Quote | Quick Reply | Thanks

     
    nicolai | # 6 | 2012-01-26, 11:00 | Report

    Does it work with
    sudo <scriptname>

    Edit | Forward | Quote | Quick Reply | Thanks

     
    moudy91 | # 7 | 2012-01-28, 07:14 | Report

    Originally Posted by nicolai View Post
    Does it work with
    sudo <scriptname>
    you mean save the script .sh then sudo that .sh file?? because i did that and nothing happens.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    JonWW | # 8 | 2012-01-28, 07:56 | Report

    Originally Posted by moudy91 View Post
    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

    Edit | Forward | Quote | Quick Reply | Thanks

     
    moudy91 | # 9 | 2012-01-28, 08:58 | Report

    Originally Posted by JonWW View Post
    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

    Edit | Forward | Quote | Quick Reply | Thanks

     
    JonWW | # 10 | 2012-01-29, 21:26 | Report

    Originally Posted by moudy91 View Post
    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

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to JonWW For This Useful Post:
    moudy91

     
    Page 1 of 2 | 1   2   | Next
vBulletin® Version 3.8.8
Normal Logout