Notices


Reply
Thread Tools
direx's Avatar
Posts: 102 | Thanked: 153 times | Joined on Feb 2010
#1
Since I don't want to take my N900 out of my pocket for skipping songs I've been doing some research on how to control the media player with the camera button. I have created a patch for ShortcutD to accomplish this - grab ShortcutD 0.1.4 or later from the official repos.

Part 1 - Configuring ShortcutD

This is pretty straightforward and nothing new. Simply install ShortcutD through the app manager and you'll be able to configure the camera key in a settings applet.

My favorite ShortcutD configuration:
  • Camera short press: Dashboard (really useful when browsing the web in fullscreen mode)
  • Camera long press: next song in Media Player
  • Proximity sensor disabled

If you do not want to use ShortcutD you can also use thp's script.

Part 2 - Enabling camera key when the device is locked

This is a bit tricky. Sadly the camera key is being disabled when locking the device. I've already submitted an enhancment request for ShortcutD, but for now I am working on a standalone solution (hoping that this concept will soon be adopted by the ShortcutD developers).

What you need:
Just install dbus-scripts and enablecambutton and the camera key should work even when the N900 is locked. To revert back to the default Maemo behaviour simply uninstall this package again.

Please note: you shoud not map critical things to "Camera short press", as this action can easily be toggled by accident when the device is in your pocket. "Camera long press" is somewhat less critical.

Thanks to cipper, who had the idea to use dbus-scripts instead of pynotify!

- direx
Attached Files
File Type: deb enablecambutton_0.1-1_armel.deb (1.2 KB, 209 views)

Last edited by direx; 2011-02-11 at 09:24.
 

The Following 14 Users Say Thank You to direx For This Useful Post:
Posts: 169 | Thanked: 56 times | Joined on Jan 2010 @ Italia
#2
Thank you direx! Is the same concept applicable to the volume keys?
Is this going to replace the closed-source extended-locked-mediaplayer-control?
 
direx's Avatar
Posts: 102 | Thanked: 153 times | Joined on Feb 2010
#3
Originally Posted by cipper View Post
Thank you direx! Is the same concept applicable to the volume keys?
Not really - the volume keys are enabled when the device is locked anyway. The just need some sort of remapping.

Originally Posted by cipper View Post
Is this going to replace the closed-source extended-locked-mediaplayer-control?
It could. But since I am fine with the camera button control I am not going to put any efforts into this.
 
Posts: 169 | Thanked: 56 times | Joined on Jan 2010 @ Italia
#4
Hi direx,

following the overclocking wiki page I added the file /etc/dbus-scripts.d/locked with content:

/usr/local/bin/underclock * * com.nokia.mce.signal tklock_mode_ind locked

and the file /usr/local/bin/underclock with content

#!/bin/sh
echo 0 > /sys/devices/platform/gpio-switch/cam_focus/disable


so that it automatically sets to zero the flag when the device gets locked. It seems to work fine. Couldn't be this solution a simple alternative to your script?
 

The Following User Says Thank You to cipper For This Useful Post:
direx's Avatar
Posts: 102 | Thanked: 153 times | Joined on Feb 2010
#5
Originally Posted by cipper View Post
Hi direx,

following the overclocking wiki page I added the file /etc/dbus-scripts.d/locked with content:

/usr/local/bin/underclock * * com.nokia.mce.signal tklock_mode_ind locked
Cool, this is a much better approach - I'll take a deeper look at it.

Thanks!
 
direx's Avatar
Posts: 102 | Thanked: 153 times | Joined on Feb 2010
#6
As I promised I updated the initial post yesterday. I am now using dbus-scripts instead of pynotify, which is definitely a better and cleaner approach.

I am not sure if this should/could go into extras. Maybe I'll add a little GUI for controlling the behavior - I don't know if this is needed, though.
 

The Following 3 Users Say Thank You to direx For This Useful Post:
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#7
I know this is an old thread however I have to stick my oar in.

1. using the lock signal on dbus is silly because..what if your phone has autolock on a timeout? Potentially you could have to unlock>lock just to activate the thing!

2. Dbus scripts, while really cool is pretty heavy on cpu power, what with waking up to check every thing against it's rule set.


A far better way to do this is:

Code:
sudo echo 0 > /sys/devices/platform/gpio-switch/cam_focus/disable & sudo chmod 444 /sys/devices/platform/gpio-switch/cam_focus/disable
This sets the disable off then makes the file read only thats it. No daemons, no scripts nothing. Now with shortcutd you can set short press to task-switcher (which does nothing when the screen is off) and long press to skip/pause whatever.
__________________
N900: One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.
 

The Following 4 Users Say Thank You to vi_ For This Useful Post:
Reply


 
Forum Jump


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