![]() |
wiki page about dbus-scripts a great toy to play with dbus
dbus-scripts
I've recently played with dbus-scripts and it's really a great toy/tool. It's a kind of swiss chainsaw for dbus :). It's a daemon that allow you to wait on choosed dbus events to run external command. You don't need to code your own python daemon each time, you can use dbus-scripts to launch shell or perl scripts. Yes I know you can find some informations about dbus-scripts in some threads but there's no thread about it and I think it deserves it. Just few examples of things you can wait for :
I've created a wiki page with complete examples and links to other ones like :
Thanks to Graham Cobb for dbus-scripts, really a great toy for hardcore users :) |
Re: wiki page about dbus-scripts a great toy to play with dbus
One of my jobs for tonight was to create a dbus-scripts wiki page!!! Brilliant timing.
|
Re: wiki page about dbus-scripts a great toy to play with dbus
Lovely just what i was looking for, lets make this wiki real good!
|
Re: wiki page about dbus-scripts a great toy to play with dbus
this sounds very interesting! perhaps this can help with a sms blacklist app, similar to what mcleaner does for s60!
|
Re: wiki page about dbus-scripts a great toy to play with dbus
Some information which might be useful in the wiki:
dbus-scripts does not reread edited configuration automatically. After editing (or creating/removing) a configuration file, you need to restart it. On N900 it can easily be done with killall dbus-scripts, since it is then restarted by upstart. On 770/N800/N810, use /etc/init.d/dbus-scripts restart. The package dbus-scripts-settings contains a script logit.sh which simply logs its parameters to the file /media/mmc1/logit.log. If you want to find out if some event generates dbus events, and what configuration line to use for it, create a file in /etc/dbus-scripts.d/ containing: Code:
/usr/bin/logit.sh * |
Re: wiki page about dbus-scripts a great toy to play with dbus
Good idea, I will add this to the wiki. Thank you.
|
Re: wiki page about dbus-scripts a great toy to play with dbus
Nice. Could you also add Command to Turn Screen On & Off
http://talk.maemo.org/showthread.php...ghlight=x11vnc |
Re: wiki page about dbus-scripts a great toy to play with dbus
I hope you don't mind but I just linked to your dbus-scripts page from the Phone Control wiki page.
|
Re: wiki page about dbus-scripts a great toy to play with dbus
Quote:
Code:
/usr/bin/logit.sh '*'Code:
echo * |
Re: wiki page about dbus-scripts a great toy to play with dbus
No he means what he wrote. That splat is parsed by dbus-scripts against dbus message parameters - it is not passed to the shell to be globbed. (I've not tested it, but I expect that putting quotes there wont break anything - just wont do anything useful.)
|
Re: wiki page about dbus-scripts a great toy to play with dbus
Quote:
|
Re: wiki page about dbus-scripts a great toy to play with dbus
Hi,
Quote:
By the way, I will a link from DbusScripts to the dbus command list of Jebba. It could give idea of what we can do with dbus. |
Re: wiki page about dbus-scripts a great toy to play with dbus
Just be careful to leave some CPU cycles available for your phone to answer calls (private joke :-)
|
Re: wiki page about dbus-scripts a great toy to play with dbus
:))
It happens again just 5 minutes ago, I cannot reply because my phone was busy logging too much things :) |
Re: wiki page about dbus-scripts a great toy to play with dbus
ooh this gives me an idea for a cool script.
something like an app I saw awhile ago. when an sms is recieved and the body contains text of a specified kind so say a password "12345" then the script will start an alarm. the question then is. Can I have another script that will detect the phone being unlocked, so that if can then send out an sms to the send of the orignal. so I find the code and start an alarm. The user activates the phone and an sms is send back with the gps location of the phone. could be cool for find your lost phone :-) |
Re: wiki page about dbus-scripts a great toy to play with dbus
Hmm send "123gps" and get back a coordinate... go visit the police...
|
Re: wiki page about dbus-scripts a great toy to play with dbus
Quote:
Graham |
Re: wiki page about dbus-scripts a great toy to play with dbus
Hi, thanks.
I play with this to warn my ubuntu when: I receive sms; Connection started; Connection stopped My "new sms" screenshot: http://img406.imageshack.us/img406/8701/newsmscut.png Requirements: Maemo: dbus-scripts; ssh-client Desktop: ssh-server, notify-send Steps: Install softwares and packages Configure ssh with default user and shared key to not require login Export dbus (http://ubuntuforums.org/archive/inde...t-1059023.html) Create a script that calls Desktop ssh ssh [your_pc_ip] [command_in_pc] configure dbus-scripts to execute it My script files: http://www.4shared.com/file/8fobAHQp...criptstar.html note: it use my relative path and hosts names: "~/sh" and host "pc" |
Re: wiki page about dbus-scripts a great toy to play with dbus
wow, i wish i had found this all sooner.
matan/graham/nbc - thanks for all the tools and documentation. the level of user customization this allows for is why i love my n900 over the competition. |
Re: wiki page about dbus-scripts a great toy to play with dbus
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.
|
Re: wiki page about dbus-scripts a great toy to play with dbus
|
Re: wiki page about dbus-scripts a great toy to play with dbus
Quote:
|
Re: wiki page about dbus-scripts a great toy to play with dbus
Quote:
Code:
dbus-scripts --debug --systemThe 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... |
Re: wiki page about dbus-scripts a great toy to play with dbus
Quote:
/usr/bin/logit.sh Code:
#!/bin/shInsert in config (/etc/dbus-scripts.d/dbus-scripts-example): Code:
* /usr/bin/logit.shOff Topic: Quote:
http://www.youtube.com/watch?v=pL2T8A3OfmA |
Re: wiki page about dbus-scripts a great toy to play with dbus
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. |
Re: wiki page about dbus-scripts a great toy to play with dbus
Quote:
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"Code:
#!/bin/shNext steps finish script, hook it into dbus-scripts. That will have to wait till I am not at work though! XD |
Re: wiki page about dbus-scripts a great toy to play with dbus
Quote:
#!/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. |
Re: wiki page about dbus-scripts a great toy to play with dbus
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 |
Re: wiki page about dbus-scripts a great toy to play with dbus
Quote:
It does approximately that. |
Re: wiki page about dbus-scripts a great toy to play with dbus
Code:
gconftool-2 -s /apps/osso/hildon-desktop/views/current -t int 1 |
Re: wiki page about dbus-scripts a great toy to play with dbus
Quote:
i still need a way to send keyboard presses from command line - do you know anything about this? |
Re: wiki page about dbus-scripts a great toy to play with dbus
Been playing around with dbus-scripts got some cool features. Got most of what I need to work bar this one thing. I want espeak to say "welcome home" when I connect to my home network.
I've just put a very simple script together:- Code:
#!/bin/shCode:
sh ~./welcome.sh |
Re: wiki page about dbus-scripts a great toy to play with dbus
Quote:
Code:
sh ~/welcome.sh |
Re: wiki page about dbus-scripts a great toy to play with dbus
Quote:
Code:
/etc/dbus-scripts.d/ |
Re: wiki page about dbus-scripts a great toy to play with dbus
Hello,
I need help please. I try to make a dbus script that whenever to connect to a wifi called Home it will automatically add some routes that are written in a file called work inside /bin/ directory. when i use app dbus-scripts-settings it generate this command: /bin/work * * com.nokia.icd * xxxxx-xxxx-xxx-xxx-xxxxxxxxx * CONNECTED the script work contains: route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.2.1 if I execute work in the terminal it works.. but I want it to work automatically when i connect to Home and it is not working this way.. can someone help please.. thanks |
Re: wiki page about dbus-scripts a great toy to play with dbus
Opera Mobile burns battery power even when not in use. How would I get Maemo to close it after 10 mins of N900 inactivity?
|
Re: wiki page about dbus-scripts a great toy to play with dbus
The difficulty is probably how to figure out that Opera is "idle". One solution might be to use autodisconnect to kill network connection when idle, then modify /opt/autodisconnect/autodisconnect-post-network-check to kill opera.
|
Re: wiki page about dbus-scripts a great toy to play with dbus
Quote:
|
Re: wiki page about dbus-scripts a great toy to play with dbus
Quote:
Pages that don't burn battery when inactive are rare. My guess is that they are ones which use little or no Javascript. I'll disable opera:config#Extensions|EcmaScriptJIT and see if it 'helps'. |
Re: wiki page about dbus-scripts a great toy to play with dbus
Anyone know if dbus-scripts would work on Harmattan? I'll grab the source for N900 but figured I'd ask just in case somebody has experience.
|
| All times are GMT. The time now is 12:39. |
vBulletin® Version 3.8.8