maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N9 / N950 (https://talk.maemo.org/forumdisplay.php?f=51)
-   -   [Anounce] [N9] Volume/Power Button Monitor (https://talk.maemo.org/showthread.php?t=82538)

wolke 2013-02-26 05:07

Re: [Anounce] [N9] Volume/Power Button Monitor
 
woo, new features from lcferrum, including proximity sensor support!

lots of changes to project structure though, so merge-o-clock

wolke 2013-02-27 06:45

Re: [Anounce] [N9] Volume/Power Button Monitor
 
preparing 0.5.3.
i added the proximity sensor button from lcferrum's source. i also wrote an mt-toggles plugin, which is a separate, optional deb that will only work with 0.5.3 or higher.

the toggle turns n9bm on/off, and of course it depends on mt-toggles.

if someone feels like testing this, i would appreciate it. ;)

https://www.dropbox.com/s/cki0sq7z4m....5.3_armel.deb

https://www.dropbox.com/s/n8w24z0sop..._0.1_armel.deb

wolke 2013-02-27 07:39

Re: [Anounce] [N9] Volume/Power Button Monitor
 
0.5.3 also auto-loads a default config when you first install it.
{edit: only when no config file exists; your config file should never be overwritten}

the default config is now user-friendly and hand-editable, with things you can uncomment like cameraplus.

wolke 2013-03-02 18:39

Re: [Anounce] [N9] Volume/Power Button Monitor
 
released 0.5.3

wolke 2013-03-11 22:44

Re: [Anounce] [N9] Volume/Power Button Monitor
 
released n9bm-toggle v0.2 the toggle now detects whether n9bm is running.

imaginaryenemy 2013-04-21 04:09

I'm trying to have an application launched with double click on power button. For some reason I am too dense to make this happen...
Code:

action=xdg-open /usr/share/applications/shutdown_harmattan.desktop, powerButton, doubleClick, always
I have also tried it with keeping "cmd" in the line also.
What am i missing? This IS possible, right?

wolke 2013-04-21 06:46

Re: [Anounce] [N9] Volume/Power Button Monitor
 
you need the cmd, and parentheses around the cmd.
action=cmd(xdg shutdown.desktop)

wolke 2013-04-21 06:57

Re: [Anounce] [N9] Volume/Power Button Monitor
 
this works for me:
action=cmd(xdg-open /usr/share/applications/clock.desktop),powerButton,doubleClick,always

imaginaryenemy 2013-04-21 07:13

I tried that also (based on an example you gave in another post) without any luck. I just tried again, and it still won't work. Is there some simple step I'm forgetting?

wolke 2013-04-21 07:14

Re: [Anounce] [N9] Volume/Power Button Monitor
 
oh snap, there is; reboot! 0.5.3 has a bug where it never reloads your config file! ill upload 0.5.4 with it fixed right now.

wolke 2013-04-21 07:19

Re: [Anounce] [N9] Volume/Power Button Monitor
 
uploaded new version 0.5.4
config changes are automatically reloaded; there is no need to reboot or restart n9bm.

{this was always the case; there was a regression in 0.5.3.}

imaginaryenemy 2013-04-21 07:22

That did the trick! Thanks!

imaginaryenemy 2013-04-21 12:34

Reboot still appears to be necessary...

wolke 2013-04-22 05:50

Re: [Anounce] [N9] Volume/Power Button Monitor
 
oh, are you sure? i tested it a bunch, and it works fine for me in 0.5.4. it explicitly does not work for me, ever, in 0.5.3

one easy way to test is to take a known working config, and then swap volumeUp/Down. save the file, and then check if the buttons are swapped. if they are NOT, do nothing and then restart. if they are then swapped, let me know.

imaginaryenemy 2013-04-22 06:10

I had changed the config file and rebooted before you uploaded 0.5.4. I updated to 0.5.4 and changed the desktop file that it opened just to verify a reboot wasn't needed. Though the config file showed it was changed, it opened the previous desktop file not the new one. I had to reboot to make the change work. HOWEVER, i have since decided that maybe i didn't want that action after all, so i deleted the action from the config file and the changes took affect without needing a reboot...

wolke 2013-04-22 16:40

Re: [Anounce] [N9] Volume/Power Button Monitor
 
thanks, that makes sense. yea, i still dont use double-click power. cant think of anything to use it for.

funny, i currently already use double-click power in lowpowerscreen, as a workaround to get lpsmagic to update, but thats not part of n9bm.

maxdroid 2013-06-01 16:17

Re: [Anounce] [N9] Volume/Power Button Monitor
 
can i make volume up or down into powerbutton if phone is off or in standyby mode?
Would be cool since my powerbutton is completely broken atm.

wolke 2013-06-01 16:48

Re: [Anounce] [N9] Volume/Power Button Monitor
 
Quote:

Originally Posted by maxdroid (Post 1348670)
can i make volume up or down into powerbutton if phone is off or in standyby mode?
Would be cool since my powerbutton is completely broken atm.

damn that sux. {im sure you know this already, but you can boot it using the nokia flasher program from a computer.}


the most useful thing i can think of that n9bm could do for you, is make double-tap volume-up unlock the phone when in low-power-screen. {is that what you mean by standby?}

as for when the phone is off, the answer is simply no, sorry. this is an application; it requires the machine to be powered on, a kernel to be loaded, and user software to be running.

maxdroid 2013-06-01 18:46

Re: [Anounce] [N9] Volume/Power Button Monitor
 
Quote:

Originally Posted by wolke (Post 1348682)
damn that sux. {im sure you know this already, but you can boot it using the nokia flasher program from a computer.}


the most useful thing i can think of that n9bm could do for you, is make double-tap volume-up unlock the phone when in low-power-screen. {is that what you mean by standby?}

as for when the phone is off, the answer is simply no, sorry. this is an application; it requires the machine to be powered on, a kernel to be loaded, and user software to be running.

Yea, I know.. But I'll live.
Yes I heard about it, but never tried it. I guess you need to connect the usb in off mode to a computer that has some program installed then and runt the reboot command.

Yes that is what I mean by standby. Although I've disabled the clock so it's black until I tap it.
Would be nice with the volume up to make it wake up since the tap is a bit buggy at times and I can't slide the screen, so then I have to wait until it goes into standby again (lock screen goes black) and try it again.
Can I use the volume up as normal when phone is wokened with this app you think? Would be nice to be able to lock it with volume up in lock screen (to shorten the wait until next try if buggy)
Thankyou! =)

wolke 2013-06-01 18:48

Re: [Anounce] [N9] Volume/Power Button Monitor
 
yes, you can make it so that in low-power-screen, double-vol-up unlocks the phone, and when NOT in low-power-screen, it does everything as normal

maxdroid 2013-06-01 18:51

Re: [Anounce] [N9] Volume/Power Button Monitor
 
Quote:

Originally Posted by wolke (Post 1348708)
yes, you can make it so that in low-power-screen, double-vol-up unlocks the phone, and when NOT in low-power-screen, it does everything as normal

Okey perfect. I guess I just need to make sure my phone is charged decently before I head out then and install this app and I'll be okay :)

Hey Wolke, I also wondered if I can lock it in lock screen with the volume up ( just the opposite of waking it up low power screen) and have it work like normal once I'm in.

wolke 2013-06-01 18:52

Re: [Anounce] [N9] Volume/Power Button Monitor
 
lock it while IN lock screen? sorry, i dont follow.

wolke 2013-06-01 18:55

Re: [Anounce] [N9] Volume/Power Button Monitor
 
btw, unlocking is not a built-in part of n9bm.

you will need to find a script that works for your flavor {inception, open mode, open mode + aegis-neutered kernel, whtaever}.

then simply put cmd(/home/user/MyDocs/unlock-script.sh) in the n9bm conf file.

maxdroid 2013-06-01 18:57

Re: [Anounce] [N9] Volume/Power Button Monitor
 
Quote:

Originally Posted by wolke (Post 1348712)
lock it while IN lock screen? sorry, i dont follow.

I mean if you double tap it you're in lock screen, then if it is buggy and I can't slide the screen to "get in" I could just double volume it and screen goes black and then I do it once more and I see lock screen again so I can slide it and get in.

As I said sometimes my phone is buggy and then I have to wait until screen goes black (a few sec) to try it again and see if sliding registers.

wolke 2013-06-01 19:09

Re: [Anounce] [N9] Volume/Power Button Monitor
 
ah. i was already assuming that you wanted vol+ to unlock it from the lock screen AND the low-power-screen. that makes more sense, right?

maxdroid 2013-06-01 19:17

Re: [Anounce] [N9] Volume/Power Button Monitor
 
Quote:

Originally Posted by wolke (Post 1348718)
ah. i was already assuming that you wanted vol+ to unlock it from the lock screen AND the low-power-screen. that makes more sense, right?

Sure! Why not!! :)
Although a single press on volume button for lock screen would be nice, cause i got meecast widget installed there just left of clock which looks really nice imo. Although as long as double tap works for seeing it it's okay too.

How would I go about making this work? All I have is fastern9 installed (and alternative os at boot, nitdroid, which I never use)

wolke 2013-06-01 19:24

Re: [Anounce] [N9] Volume/Power Button Monitor
 
first, tackle the problem of getting a command the locks/unlocks that works for you. heres mine:

Code:

#!/usr/bin/perl
#Copyright 2012 Elliot Wolk
#License: GNU GENERAL PUBLIC LICENSE v3 or later, at your choice
use strict;
use warnings;

my $usage = "Usage:
  $0 or $0 [-t|--toggle|toggle]
    simulates pushing the power-button
  $0 [-g|--get|get]
    prints locked or unlocked, or exits with error code
    determined by dbus method com.nokia.mce.request.get_tklock_mode
  $0 [-l|--lock|lock]
    if 'get' returns unlocked, simulates pushing the power-button
  $0 [-u|--unlock|unlock]
    if 'get' returns locked, simulates pushing the power-button
";

sub getLock(){
  my @cmd = qw(dbus-send
    --system
    --print-reply
    --type=method_call
    --dest=com.nokia.mce
    /com/nokia/mce/request
    com.nokia.mce.request.get_tklock_mode
  );

  my $tklockMode = `@cmd`;
  if($tklockMode =~ /string "(locked|unlocked)"/){
    return $1;
  }else{
    die "Error- couldnt understand dbus reply '$tklockMode'\n";
  }
}

sub powerButton(){
  my $EVENT_POWER_KEY='\x74\x00';
  my $POWERBUTTON_EVENT_FILE='/dev/input/pwrbutton';
  my $EVENT_TIMESTAMP='\x48\x67\x98\x45\x5f\x16\x0b\x00';
  my $EVENT_KEY_TYPE='\x01\x00';
  my $EVENT_PRESS_VALUE='\x01\x00\x00\x00';
  my $EVENT_RELEASE_VALUE='\x00\x00\x00\x00';

  my $bytes = join '', (
    $EVENT_TIMESTAMP,
    $EVENT_KEY_TYPE,
    $EVENT_POWER_KEY,
    $EVENT_PRESS_VALUE,
    $EVENT_TIMESTAMP,
    $EVENT_KEY_TYPE,
    $EVENT_POWER_KEY,
    $EVENT_RELEASE_VALUE,
  );

  system "printf \"$bytes\" > $POWERBUTTON_EVENT_FILE";
}

sub main(@){
  my $arg = shift;
  $arg = '--toggle' if not defined $arg;
  die $usage if @_ > 0;
  if($arg =~ /^(-t|--toggle|toggle)$/){
    powerButton;
  }elsif($arg =~ /^(-l|--lock|lock)$/){
    powerButton if getLock eq 'unlocked';
  }elsif($arg =~ /^(-u|--unlock|unlock)$/){
    powerButton if getLock eq 'locked';
  }elsif($arg =~ /^(-g|--get|get)$/){
    print getLock() . "\n";
  }else{
    die $usage;
  }
}

&main(@ARGV);

i have NO IDEA if this works without open mode.
to test it out, save it as lock.pl and copy it to MyDocs.

test it in a terminal by running: perl ~/MyDocs/lock.pl

if that locks your phone, then it works.

after that, install n9bm, and make sure it works for you by going into low-power-screen and holding down volume-up. the torch should come on.

THEN, modify the config file: /home/user/.config/n9-button-monitor.ini and add this line:

action=cmd(perl /home/user/MyDocs/lock.pl),volumeUp,doubleClick,screenLocked

wolke 2013-06-01 19:35

Re: [Anounce] [N9] Volume/Power Button Monitor
 
ok, so the word on the street is that you need probably inception to do this.

install inception, {look up how to do this, theres plenty of resources available}, and then run the lock script with ariadne like this:
ariadne perl /home/user/MyDocs/lock.pl

if that works, you can stick that in your n9bm config file.

if that doesnt work, try poking around the inception thread and asking how to lock/unlock with a command as user in closed mode.

maxdroid 2013-06-01 19:36

Re: [Anounce] [N9] Volume/Power Button Monitor
 
cool!

I almost am a complete noob about this. How do I actually save your text/script into a .pl file that I need to transfer to my phone?

wolke 2013-06-01 19:40

Re: [Anounce] [N9] Volume/Power Button Monitor
 
you can either open up a text editor, paste it in, save it.
or just download it directly with this link:
https://raw.github.com/teleshoes/n9-...FILES/bin/lock

wolke 2013-06-01 19:41

Re: [Anounce] [N9] Volume/Power Button Monitor
 
in most browsers, thats right-click, save link as, "lock.pl"

maxdroid 2013-06-01 19:51

Re: [Anounce] [N9] Volume/Power Button Monitor
 
Quote:

Originally Posted by wolke (Post 1348729)
you can either open up a text editor, paste it in, save it.
or just download it directly with this link:
https://raw.github.com/teleshoes/n9-...FILES/bin/lock

Inception then huh. Feels like I'm in limbo. :p
Think I will have to make this happen soon. Tanks for your effort in helping! Hope it works! :)
Have a good one Wolke!

wolke 2013-06-01 20:14

Re: [Anounce] [N9] Volume/Power Button Monitor
 
no problem. good luck

manialog 2013-06-01 22:29

Re: [Anounce] [N9] Volume/Power Button Monitor
 
Not uninstalling. How to do needed

wolke 2013-06-02 07:08

Re: [Anounce] [N9] Volume/Power Button Monitor
 
Quote:

Originally Posted by manialog (Post 1348794)
Not uninstalling. How to do needed

sorry, is there something i can do for you?

manialog 2013-06-02 07:10

Re: [Anounce] [N9] Volume/Power Button Monitor
 
I managed to uninstall using terminal thanx

adnankamal9 2013-06-25 14:09

Re: [Anounce] [N9] Volume/Power Button Monitor
 
This is really nice. but can you please tell me the easiest way of installing & uninstalling this mod. i really wanted to check this. Please do let me know what to do and how to do. thanks. :)

wolke 2013-06-25 15:18

Re: [Anounce] [N9] Volume/Power Button Monitor
 
the same way youd install any deb. perhaps something like this:

download the deb
copy it to MyDocs
open a terminal
devel-su
dpkg -i MyDocs/n9-button-monitor*.deb
apt-get -f install

open a terminal
devel-su
apt-get remove n9-button-monitor




to customize it, open up redak, or your favorite text editor, and edit /home/user/.config/n9-button-monitor.ini

adnankamal9 2013-06-26 08:33

Re: [Anounce] [N9] Volume/Power Button Monitor
 
Quote:

Originally Posted by wolke (Post 1354624)
the same way youd install any deb. perhaps something like this:

download the deb
copy it to MyDocs
open a terminal
devel-su
dpkg -i MyDocs/n9-button-monitor*.deb
apt-get -f install

open a terminal
devel-su
apt-get remove n9-button-monitor




to customize it, open up redak, or your favorite text editor, and edit /home/user/.config/n9-button-monitor.ini


Thank you very much. You people are great. You think so much that in my opinion even Nokia didnt think about.

wolke 2013-06-26 15:35

Re: [Anounce] [N9] Volume/Power Button Monitor
 
you are very welcome!


All times are GMT. The time now is 02:39.

vBulletin® Version 3.8.8