maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   Answering Calls with proximity sensor (https://talk.maemo.org/showthread.php?t=80095)

impeham 2011-11-18 08:56

Answering Calls with proximity sensor
 
1 Attachment(s)
i created a small script that allows you to answer calls by getting the device near your ear (using proximity sensor).
if the sensor is closed when the script is run (like if there's a call while the device is in the pocket) it will not answer but wait for an open state and only then it will answer on close state.

To use this feature you will have to set 2 dbus events invokes in "/etc/dbus-scripts.d/dbus-scripts-settings":

[scripts path]/incomingcall.sh * * com.nokia.mce.signal sig_call_state_ind ringing normal
[scripts path]/callend.sh * * com.nokia.mce.signal sig_call_state_ind none normal

Set the scripts to with execute permissions.

When a call comes, the incomingcall.sh is called, calling to the ProximityAnswerScan script.
When the call terminates, the callend.sh script is called which causes the ProximityAnswerScan to end.

After using it for some time now - it seems to be very comfortable way to answer calls - even when sometimes the device is not responsive when the call arrives.


Hope you'll like it too.

droll 2011-11-18 09:10

Re: Answering Calls with proximity sensor
 
how do you install these? by executing those 2 command lines above?

F2thaK 2011-11-18 09:42

Re: Answering Calls with proximity sensor
 
f__k thats COOL. needs to be made into an app IMHO

edit: and ported to the N9 :D

Alfred 2011-11-18 09:48

Re: Answering Calls with proximity sensor
 
Installed, now let's try...
EDIT:
something needs to be killed, cause i don't feel like rebooting...
EDIT2:
ok, it's still not working. Here is what i did
1) placed the folder ProximityAnswer with 3 files in it in /home/user/
2) created a file /etc/dbus-scripts.d/dbus-scripts-settings (i have dbus pakage installed, but i have only karam's dbus-scripts-settings-by-karam file, that's why i created a new one)
3) then i pasted these lines into that file:
Code:

/home/user/ProximityAnswer/incomingcall.sh * * com.nokia.mce.signal sig_call_state_ind ringing normal
/home/user/ProximityAnswer/callend.sh * * com.nokia.mce.signal sig_call_state_ind none normal

4) then run this
Code:

chmod 777 /home/user/ProximityAnswer/for-each-script
and for some reason also this
Code:

chmod +rwx /home/user/ProximityAnswer/for-each-script
5) rebooted
6) called myself, but when i put the phone near the ear, i can see the screen is black, but the ringtone is still playing, and the call isn't getting answered.
Please, can you please point where and what i did wrong

Alfred 2011-11-18 10:36

Re: Answering Calls with proximity sensor
 
Didn't quite get you...
Isn't "/etc/dbus-scripts.d/dbus-scripts-settings" a file? How can i have those scripts in there?
Sorry, i don't understand

F2thaK 2011-11-18 11:28

Re: Answering Calls with proximity sensor
 
hey sorry my instructions are wrong, try this:




1. extract files in attached zip into "/home/user/MyDocs/proxyanswer"
2. in file "/etc/dbus-scripts.d/dbus-scripts-settings"

add
Code:

/home/user/MyDocs/proxyanswer/incomingcall.sh * * com.nokia.mce.signal sig_call_state_ind ringing normal
/home/user/MyDocs/proxyanswer/callend.sh * * com.nokia.mce.signal sig_call_state_ind none normal


------------

BTW, anyone know if this would work on N9?
Im not sure if dbus-scripts/-settings etc installs...

lidow 2011-11-18 12:37

Re: Answering Calls with proximity sensor
 
1 Attachment(s)
Very nice idea. Was not working for me, so I touch it here and there in order to make it work.
All credits goes to impehan, thanks for the great tool.

create file: /etc/dbus-scripts.d/dbus-scripts-answer_on_proximity
Code:

/home/user/bin/ProximityAnswerScan * * com.nokia.mce.signal sig_call_state_ind ringing normal
put ProximityAnswerScan in /home/user/bin and make it executable:
Code:

chmod +x  /home/user/bin/ProximityAnswerScan
restart dbus-script
Code:

/etc/init.d/dbus-script restart
That is all.

impeham 2011-11-18 14:49

Re: Answering Calls with proximity sensor
 
a few remarks i forgot to add:
all scripts must be set to have execute permissions of course.
"ProximityAnswerScan" and "callend.sh" scripts are using the path:
"/home/user/smart/flags/" to create and delete a flag file "proximityanswerscan", so you need to create this folder with write permissions or set the scripts to point to some other location of your choosing.

Dr.Marcial 2011-11-18 21:50

Re: Answering Calls with proximity sensor
 
It works fine for me, thx impeham and lidow!

is there anyway to do the same with to answer a call with hard press camera button or double click power button or something like that? im wondering cause very often I get a call and the screen stays black for a long while and sometimes I even miss the call before the screen comes back from black.

thx both for a great idea

Hurrian 2011-11-19 04:45

Re: Answering Calls with proximity sensor
 
Why not put the temp flag file in /tmp?


All times are GMT. The time now is 00:25.

vBulletin® Version 3.8.8