maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Multimedia (https://talk.maemo.org/forumdisplay.php?f=32)
-   -   [WiP] Control media player with camera button when device is locked (https://talk.maemo.org/showthread.php?t=66448)

direx 2010-12-01 22:41

[WiP] Control media player with camera button when device is locked
 
1 Attachment(s)
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

cipper 2010-12-14 10:18

Re: [WiP] Control media player with camera button when device is locked
 
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 2010-12-27 11:41

Re: [WiP] Control media player with camera button when device is locked
 
Quote:

Originally Posted by cipper (Post 896518)
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.

Quote:

Originally Posted by cipper (Post 896518)
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.

cipper 2010-12-28 08:50

Re: [WiP] Control media player with camera button when device is locked
 
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?

direx 2010-12-28 11:17

Re: [WiP] Control media player with camera button when device is locked
 
Quote:

Originally Posted by cipper (Post 905847)
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 2011-02-08 10:11

Re: [WiP] Control media player with camera button when device is locked
 
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.

vi_ 2011-07-19 12:02

Re: [WiP] Control media player with camera button when device is locked
 
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.


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

vBulletin® Version 3.8.8