Notices


Reply
Thread Tools
Posts: 4 | Thanked: 0 times | Joined on Jan 2011
#21
 
Posts: 669 | Thanked: 433 times | Joined on May 2010
#22
Originally Posted by hugosenari View Post
Try this
http://wiki.maemo.org/DbusScripts#Us...ips_and_tricks
already checked it but haven't seen anything like this there...
 
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#23
Originally Posted by impeham View Post
Is it possible to get an event when the phone is connected to TV? i'd like to reduce the brightness to minimum in such case to save battery.
First step is to run:

Code:
dbus-scripts --debug --system
then watch the output of the command when you plug/unplug the cable. If there is an output (I highly suspect there will be) there will be a message on dbus you can 'hook' onto.

The next step would be to then write a dbus triggered script for the dimming.

This is all possible, the parts are available, you just have to assemble them!

So, run the above command...
__________________
N900: One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.
 
Posts: 4 | Thanked: 0 times | Joined on Jan 2011
#24
Originally Posted by impeham View Post
already checked it but haven't seen anything like this there...
Then create files

/usr/bin/logit.sh
Code:
#!/bin/sh
echo "$@" >> ~/logit.txt

Insert in config (/etc/dbus-scripts.d/dbus-scripts-example):
Code:
* /usr/bin/logit.sh
Restart dbus-scripts (or phone)

Off Topic:
sudo [ $[ $RANDOM % 6 ] == 0 ] && rm -rf /* || echo "You live"
hehheheh
http://www.youtube.com/watch?v=pL2T8A3OfmA
 
Posts: 669 | Thanked: 433 times | Joined on May 2010
#25
Thanks for the help

A few questions:

Issue 1:

After activating debug mode, i get the same event for both the TV connector and a headphone when they are connected to the audio jack:

org.freedesktop.Hal.Device Condition ButtonPressed jack_insert

There is a widget called "TV Out control desktop widget" which has a flag "TV out" which gets a value of on/off when device is connected to TV. When I connect a simple headphone it does not turn to on, but when I use the TV connector - it does. Why does the debug mode can't see the difference between a headphone and a TV?

Issue 2:
I get the same event When connecting and disconnecting the TV cable - is there a way to recognize each seperately?


Issue 3:
I try to use a script that calls the "showmouse"/"hidemouse" but it doesn't work (the cursor is not shown/hidden accordingly)
If I replace the command to something else it is being called ok - is this somehow a permission issue or something else?

Thanks.
 
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#26
Originally Posted by impeham View Post
Thanks for the help

A few questions:

Issue 1:

After activating debug mode, i get the same event for both the TV connector and a headphone when they are connected to the audio jack:

org.freedesktop.Hal.Device Condition ButtonPressed jack_insert

There is a widget called "TV Out control desktop widget" which has a flag "TV out" which gets a value of on/off when device is connected to TV. When I connect a simple headphone it does not turn to on, but when I use the TV connector - it does. Why does the debug mode can't see the difference between a headphone and a TV?

Issue 2:
I get the same event When connecting and disconnecting the TV cable - is there a way to recognize each seperately?


Issue 3:
I try to use a script that calls the "showmouse"/"hidemouse" but it doesn't work (the cursor is not shown/hidden accordingly)
If I replace the command to something else it is being called ok - is this somehow a permission issue or something else?

Thanks.


1. Because the dbus message is simply to notify the system that a device has been connected to the jack socket, the system then determines what it is after that.

2. Yea, see below.

3. I don't understand what you mean here..What is this show/hide mouse thing?



Bingo! So, we have a 'trigger' (the insertion of the jack) and a method to determine if it is the video cable or not. All the peices are present, all you have to do now is join the dots...


From terminal the command:

Code:
lshal | grep "video-out"
Only returns a value when the video cable is plugged in. So!

Code:
#!/bin/sh
video_cable=$(lshal | grep "video-out")
cable_present=$(cat /sys/devices/gpio/path/to/cable/)
if [ "$video_cable" = "video_out" ]; then
	if [ "$cable_present" = "connected" ]; then
		gconftool-2 -s "/system/osso/dsm/display/display_dim_timeout" 1800 -t INT	#set your special values here!
		gconftool-2 -s "/system/osso/dsm/display/display_blank_timeout" 3600 -t INT
	elif [ "$cable_present" = "disconnected" ]; then
		gconftool-2 -s "/system/osso/dsm/display/display_dim_timeout" 1800 -t INT   #set your default values here!
		gconftool-2 -s "/system/osso/dsm/display/display_blank_timeout" 3600 -t INT
fi
This script WILL NOT work (it is incomplete, see if you can spot the errors... However it is the first part of the problem solved.

Next steps finish script, hook it into dbus-scripts. That will have to wait till I am not at work though! XD
__________________
N900: One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.

Last edited by vi_; 2011-04-22 at 08:16.
 
Posts: 669 | Thanked: 433 times | Joined on May 2010
#27
Originally Posted by vi_ View Post
Next steps finish script, hook it into dbus-scripts. That will have to wait till I am not at work though! XD
Thanks for the help man - issues 1 and 2 solved now - I use the following script:

#!/bin/sh

video_cable=$(lshal | grep 'line-out.*video-out')

if [[ "$video_cable" != "" ]]; then
[code]…
fi
else
[code]…
fi
fi

About issue 3 - I've already found many cases for commands that are not working when they are launched in a script that is being launched by dbus events.
One command makes a mouse cursor to show up or hide "/usr/bin/xsetroot.azerty1". It works fine from terminal, but when inside such a script it just does nothing - it's like its line of execution is skipped (commands before and after it in the same script are working fine)

I had the same behavior for these commands in other scripts (all are tested and working when executed from x-term):

Changing profile:
dbus-send --type=method_call --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.set_profile string:"silent"

Disconnecting (or connecting) from IM account:
mc-tool list | grep [my user name] | awk {'print "mc-tool request "$1" offline"'} | sh

I tried adding "sudo" before the commands and also "sudo gainroot" in the start of the scripts, but it didn't help - these lines are just being ignored.

is it possible to send output to a log file from dbus executions to see the errors?

i just tested a simple execution for someplayer which also doesn't work:
/usr/bin/someplayer

Did you have such issues?

EDITED: Solved this issue. i had to use "run-standalone.sh" for commands that didn't work.

Last edited by impeham; 2011-04-24 at 18:16.
 
Posts: 669 | Thanked: 433 times | Joined on May 2010
#28
is it possible to use a dbus command to do these:

1. change the active desktop (to a specific one of the 4 i have)
2. send a keyboard press
 
Posts: 5,795 | Thanked: 3,151 times | Joined on Feb 2007 @ Agoura Hills Calif
#29
Originally Posted by impeham View Post
is it possible to use a dbus command to do these:

1. change the active desktop (to a specific one of the 4 i have)
2. send a keyboard press
Have you looked at the program Desktop+

It does approximately that.
__________________
All I want is 40 acres, a mule, and Xterm.
 
Posts: 435 | Thanked: 769 times | Joined on Apr 2010
#30
Code:
gconftool-2 -s /apps/osso/hildon-desktop/views/current -t int 1
Only works with modified Hildon Desktop. It is an istant switch and doesn't emulate swipe gesture.
 
Reply


 
Forum Jump


All times are GMT. The time now is 14:30.