Active Topics

 


Reply
Thread Tools
Posts: 11 | Thanked: 0 times | Joined on Nov 2011
#1
In n900 i use d-bus

Code:
dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_tklock_mode_change string:"locked"
But on n9 it does not work.

Why?

Aegis rule:
Code:
<aegis>
    <request policy="add">
        <credential name="dsme::DeviceStateControl" />
        <credential name="mce::DeviceModeControl" />
        
        <for path="applauncherd-launcher::/usr/bin/applauncherd.bin" />
    </request>
</aegis>
Also it is possible emulation button power pressed?
 
SPARTAN563's Avatar
Posts: 92 | Thanked: 92 times | Joined on May 2011 @ Stellenbosch, South Africa
#2
The issue is that aegis won't grant you access to mceeviceModeControl without a valid certificate.

You will have to check me on this, since I haven't actually tested it, but I'm pretty certain you can use mceeviceControlMode when you install from the Ovi store. So the idea is to write your code up using a debug call or something like that whenever you want to lock, and then when you want to publish it you change that for the actual call.

More info on how to implement the lock interfaces can be found in the Harmattan documentation:
http://harmattan-dev.nokia.com/docs/...cks.html?tab=0

As for emulating a power key press, I don't think that is possible without knowing the low level hardware and coding some stuff up in Assembly.
__________________
Sierra Softworks
 
Posts: 11 | Thanked: 0 times | Joined on Nov 2011
#3
Ok, thx.
How to install "MeeGo 1.2 Harmattan API" manually?
Qt SDK package manager say:
Can't find missing dependency (com.nokia.ndk.tools.madde.qemu.system-=0.13.52)
 
SPARTAN563's Avatar
Posts: 92 | Thanked: 92 times | Joined on May 2011 @ Stellenbosch, South Africa
#4
Hmm, I downloaded the redistributable SDK from Nokia's website (developer.nokia.com) and that seemed to work fine. I don't really used the SDK Package Manager since it never seemed to work for me.
__________________
Sierra Softworks
 
Posts: 11 | Thanked: 0 times | Joined on Nov 2011
#5
And I have downloaded Qt_SDK_Lin64_1.1.4 from developer.nokia.com, and "Harmattan API" not checked ant not installed.
 
Posts: 11 | Thanked: 0 times | Joined on Nov 2011
#6
 
Posts: 986 | Thanked: 1,526 times | Joined on Jul 2010
#7
Originally Posted by unreg View Post
In n900 i use d-bus

Code:
dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_tklock_mode_change string:"locked"
But on n9 it does not work.

Why?

Aegis rule:
Code:
<aegis>
    <request policy="add">
        <credential name="dsme::DeviceStateControl" />
        <credential name="mce::DeviceModeControl" />
        
        <for path="applauncherd-launcher::/usr/bin/applauncherd.bin" />
    </request>
</aegis>
Also it is possible emulation button power pressed?

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
EDIT:
note that this probably {certainly?} requires an open kernel.

taken from:
https://meego.gitorious.org/meego-mi...sts/mcetorture

Last edited by wolke; 2012-01-24 at 22:35.
 

The Following User Says Thank You to wolke For This Useful Post:
Posts: 986 | Thanked: 1,526 times | Joined on Jul 2010
#8
here is my script, which i stick at /usr/local/bin/lock

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|lock]
    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 =~ /^(-l|--unlock|unlock)$/){
    powerButton if getLock eq 'locked';
  }elsif($arg =~ /^(-g|--get|get)$/){
    print getLock() . "\n";
  }else{
    die $usage;
  }
}

&main(@ARGV);
 

The Following User Says Thank You to wolke For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 20:04.