maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   General (https://talk.maemo.org/forumdisplay.php?f=7)
-   -   Enabling right click with Dbus scripts and proximity sensor (https://talk.maemo.org/showthread.php?t=70307)

vi_ 2011-02-24 17:03

Enabling right click with Dbus scripts and proximity sensor
 
In my quest to enable a real right click (not that press and hold bollocks that is made of constant fail) I have arrived at the conclusion that the optimal way to do this would be to use the rather annoying proximity sensor.

My idea, to enable right click by pressing the proximity sensor.

How to achieve this? As far as I can tell the way to do this is with proximityd, a dbus script and xmodmap.

That is you turn on right click support (either a button or ties to the launch of particular programs) this enables P.sensor polling by proximityd which in turn reports the condition of the sensor to dbus. dbus scripts then reacts to sensor covered to swap left and right mouse buttons, switch back when sensor uncovered.

While this seems strait forward in words I am struggling to see how to monitor for the proximity switch condition change on the dbus.

proximityd

dbus scripts

Any thoughts on how to do this?

vi_ 2011-02-25 08:16

Re: Dbus scripts settings and proximity sensor
 
Nobody?

Cool, lets all jerk off about how microsoft have *** jacked our beloved nokia some more.

Here we have the 'string' from dbus-scripts to match all wlan events:
Code:

/some/script * * com.nokia.icd status_changed * WLAN_INFRA
How do I write a similar string to match proximity sensor events ala this:

Code:

/some/script * * com.nokia.icd status_changed <some network> WLAN_INFRA CONNECTED
com.nokia.icd <-- i.e. what comes in place of this bit?

Cue 2011-02-25 09:01

Re: Dbus scripts settings and proximity sensor
 
Quote:

Originally Posted by vi_ (Post 955031)
Nobody?

Cool, lets all jerk off about how microsoft have *** jacked our beloved nokia some more.

Here we have the 'string' from dbus-scripts to match all wlan events:
Code:

/some/script * * com.nokia.icd status_changed * WLAN_INFRA
How do I write a similar string to match proximity sensor events ala this:

Code:

/some/script * * com.nokia.icd status_changed <some network> WLAN_INFRA CONNECTED
com.nokia.icd <-- i.e. what comes in place of this bit?

I have absolutely no idea but I think you're not getting an answer because most people seeing this don't know. You may have more luck contacting the creator of shortcutd perhaps or looking at its code.

naabi 2011-02-25 09:10

Re: Dbus scripts settings and proximity sensor
 
Use e.g. the command line tool called dbus-monitor. There might be even better options, but I don't recall currently.

kitwalker 2011-02-25 09:12

Re: Dbus scripts settings and proximity sensor
 
Not sure if this will help you, but dug up this old post:

http://talk.maemo.org/showpost.php?p=368865&postcount=2

I checked it using cat and is working.

But polling on a file value may not be a good idea huh? Something that can be done based on this?

BTW, love your idea of right click using proximity sensor!

vi_ 2011-02-25 09:16

Re: Dbus scripts settings and proximity sensor
 
just done that, used:

dbus-monitor "type='signal'

To see the 'open' and close' signals. I am getting closer however I cannot quite see how to piece this together yet.

I emailed hopbeat asking if he would consider incorporating such functionality into shortcutd however he simply ignored me.

I am surprised nobody has addressed this right click issue before. I mean battle for wesnoth, comix, every friggin text field there is has a r/click context menu that we cannot use!

Cue 2011-02-25 09:27

Re: Dbus scripts settings and proximity sensor
 
Quote:

Originally Posted by vi_ (Post 955056)
just done that, used:

dbus-monitor "type='signal'

To see the 'open' and close' signals. I am getting closer however I cannot quite see how to piece this together yet.

I emailed hopbeat asking if he would consider incorporating such functionality into shortcutd however he simply ignored me.

I am surprised nobody has addressed this right click issue before. I mean battle for wesnoth, comix, every friggin text field there is has a r/click context menu that we cannot use!

I'm a little confused by the problem. Do the signals not show when you cover the proximity sensor? What exactly are you having trouble with?

vi_ 2011-02-25 09:40

Re: Dbus scripts settings and proximity sensor
 
My problem is this is my first forray into dbus scripts and I am unfamilliar with the nomenclature. The documentation says:

Code:

# First argument is sender
 # Second argument is destination
 # For SIGNAL and METHOD_CALL, third argument is interface
 # For SIGNAL and METHOD_CALL, fourth argument is member
 # Other arguments depend on the message


/some/script/here * * <proximityd interface> <member> <somthing else>

What is the interface name of proximityd?

vi_ 2011-02-25 09:47

Re: Dbus scripts settings and proximity sensor
 
Ahaah hahaha ha ha!!

Quote:

the --debug flag is essential for looking at what's going on if you plan to write your own scripts. Run "dbus-scripts --debug" in a terminal and then perform whatever actions on the phone, to see all the events you can process using dbus-scripts. To see events on the session bus, make that "dbus-scripts --debug --session".

Code:

/sys/devices/platform/gpio-switch/proximity/state
Thanks, was looking for that!

vi_ 2011-02-25 10:18

Re: Dbus scripts settings and proximity sensor
 
After some thought it has occoured to me...perhaps I am barking up the wrong bush?

My proposed method involves switching proximity sensor polling on and off in order to run a script at the appropriate time to action a mouse button change. (obviously stopping polling when the system goes to sleep to stop it from not going to sleep).

As kitwalker pointed out above qwerty12(R.I.P.) there is already a /sys/ file that reacts to the proximity sensor (probably using a hardware interrupt).

The logical way is to use the /sys/ entry but in a way that does not use polling from a script (polling=bad).

What about inotify? Do you think it is possible to use a call like:

Code:

#!/bin/sh
      while inotifywait -e modify /sys/path/to/proximitysensor; do
        if sensor open; then
          xmodmap set right click
        else
          xmodmap sel left click
        fi
      done

?

(I am at work so will have to wait till later to test this!)


All times are GMT. The time now is 05:01.

vBulletin® Version 3.8.8