Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

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

    Reply
    direx | # 1 | 2010-12-01, 22:41 | Report

    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:
    • dbus-scripts (in extras-devel) [direct link]
    • enablecambutton (from this post)

    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

    Edit | Forward | Quote | Quick Reply | Thanks
    Attached Files
    File Type: deb enablecambutton_0.1-1_armel.deb (1.2 KB, 212 views)

    Last edited by direx; 2011-02-11 at 09:24.
    The Following 14 Users Say Thank You to direx For This Useful Post:
    Atto, bitrocky, cipper, codeMonkey, maemo55, Maj3stic, Mentalist Traceur, Mr.Rent, OVK, SavageD, SSLMM, vi_, vkv.raju, zimon

     
    cipper | # 2 | 2010-12-14, 10:18 | Report

    Thank you direx! Is the same concept applicable to the volume keys?
    Is this going to replace the closed-source extended-locked-mediaplayer-control?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    direx | # 3 | 2010-12-27, 11:41 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    cipper | # 4 | 2010-12-28, 08:50 | Report

    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?

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

     
    direx | # 5 | 2010-12-28, 11:17 | Report

    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!

    Edit | Forward | Quote | Quick Reply | Thanks

     
    direx | # 6 | 2011-02-08, 10:11 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 3 Users Say Thank You to direx For This Useful Post:
    codeMonkey, F2thaK, OVK

     
    vi_ | # 7 | 2011-07-19, 12:02 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 4 Users Say Thank You to vi_ For This Useful Post:
    ivyking, mr_pingu, nokiabot, sixwheeledbeast

     
vBulletin® Version 3.8.8
Normal Logout