maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Detect hw keyboard slide event (https://talk.maemo.org/showthread.php?t=62198)

Willem Liu 2010-09-13 11:56

Re: Detect hw keyboard slide event
 
Quote:

Originally Posted by MohammadAG (Post 814845)
That's not exactly an event though is it, it requires you to poll the file instead of listening to the keyboard slides.

MohammadAG, hmm yes that's quite a drawback. I'll have to study lockdaemons source code to see if there is any dbus calls used there which receives the signal from the keyboard.

lma 2010-09-13 11:57

Re: Detect hw keyboard slide event
 
There should also be a dbus signal (/org/freedesktop/Hal/devices/platform_slide on Diablo) so you don't need to poll /sys unnecessarily.

Willem Liu 2010-09-13 12:04

Re: Detect hw keyboard slide event
 
This is for informational purposes. To monitor dbus calls live:

Code:

dbus-monitor --profile --system
Just to have all the related information in one place.

nicolai 2010-09-13 12:09

Re: Detect hw keyboard slide event
 
Quote:

Originally Posted by Willem Liu (Post 814852)
MohammadAG, hmm yes that's quite a drawback. I'll have to study lockdaemons source code to see if there is any dbus calls used there which receives the signal from the keyboard.

You should listen for the dbus event, which only tells you the
state has changed. Than you read the value from
/sys/devices/platform/gpio-switch/slide/state
to see, if the slide is open or closed.

regards
Nicolai

Willem Liu 2010-09-13 12:14

Re: Detect hw keyboard slide event
 
Quote:

Originally Posted by nicolai (Post 814863)
You should listen for the dbus event, which only tells you the
state has changed. Than you read the value from
/sys/devices/platform/gpio-switch/slide/state
to see, if the slide is open or closed.

regards
Nicolai

Thanks! That's good to know. It would've been great if the dbus event would've carried that information with it, but I suppose I can't have it all.

pelago 2010-09-13 12:49

Re: Detect hw keyboard slide event
 
In case you haven't found it already, the initial thread for lockdaemon is http://talk.maemo.org/showthread.php?t=47439

Willem Liu 2010-09-13 12:58

Re: Detect hw keyboard slide event
 
Quote:

Originally Posted by pelago (Post 814880)
In case you haven't found it already, the initial thread for lockdaemon is http://talk.maemo.org/showthread.php?t=47439

Thanks. I did find it, but it's good to have that link here as well.

Willem Liu 2010-09-13 13:55

Re: Detect hw keyboard slide event
 
For informational purposes. Here is a quote from an answer to the same question from the qt-interest mailing list.

Quote:

You can try MCE Dbus Interface. Something like:

QDBusConnection::systemBus().connect(MCE_SERVICE, MCE_SIGNAL_PATH, MCE_SIGNAL_IF, MCE_TKLOCK_MODE_SIG, this, SLOT(onTKLockModeChanged(QString)));

Where onTKLockModeChanged is a simple slot method.

fsguru 2010-09-13 14:12

Re: Detect hw keyboard slide event
 
Quote:

Originally Posted by Willem Liu (Post 814886)
Thanks. I did find it, but it's good to have that link here as well.

You can use the "hal" infrastructure.

ssh into the phone or run in xterm:

lshal -m

You should be able to see the hal events if you now slide the keyboard.

You can use "libhal-dev" if you program in C.

This tuttorial should help you get going:

http://madison-project.wdfiles.com/l...l_Tutorial.pdf

Willem Liu 2010-09-13 14:15

Re: Detect hw keyboard slide event
 
@fsguru

That's great info. Thanks.


All times are GMT. The time now is 22:10.

vBulletin® Version 3.8.8