Active Topics

 


Reply
Thread Tools
Guest | Posts: n/a | Thanked: 0 times | Joined on
#1
Hi guys.

Was wondering what the convention for basic timed events is on the n900. I've seen a lot of varying information about alarm, cron, etc but haven't managed to find a definitive.

If you had to set up some very basic timed events, eg. running a simple script every 30 minutes, how would you do it?

As a note, it needs to be easily modifiable (changing those 30 minutes to 5 minutes or 12 hours, and so on).


Thanks!
 

The Following 2 Users Say Thank You to For This Useful Post:
Posts: 631 | Thanked: 837 times | Joined on May 2007 @ Milton, Ontario, Canada
#2
Originally Posted by code177 View Post
Hi guys.

Was wondering what the convention for basic timed events is on the n900. I've seen a lot of varying information about alarm, cron, etc but haven't managed to find a definitive.

If you had to set up some very basic timed events, eg. running a simple script every 30 minutes, how would you do it?

As a note, it needs to be easily modifiable (changing those 30 minutes to 5 minutes or 12 hours, and so on).


Thanks!
Use the alarmD interface; that's what it's there for. It has been vastly updated for Maemo5 to make updating times/intervals etc very easy...
Also has nice hardware level control incase you need to wake the device/etc...
 

The Following 3 Users Say Thank You to jolouis For This Useful Post:
Guest | Posts: n/a | Thanked: 0 times | Joined on
#3
Perfect, thank you!
 
Guest | Posts: n/a | Thanked: 0 times | Joined on
#4
Additionally - where is the reference manual for this, and how would one use it with python?
Thanks
 
Posts: 631 | Thanked: 837 times | Joined on May 2007 @ Milton, Ontario, Canada
#5
Sorry I meant to include the link to the API page before, I had it open in a tab yesterday as I've been using it for the past few days but just forgot.

Basically anything you ever needed to know about Maemo 5 API's is here:
http://wiki.maemo.org/Documentation/...eveloper_Guide

The alarm-specific page is here:
http://wiki.maemo.org/Documentation/...larm_Framework

And the actual API reference that lists the available methods and properties/etc is here:
http://maemo.org/api_refs/5.0/5.0-final/libalarm/

The documentation isn't quite as clear as it could be on some things, so if you need a hand feel free to drop me a PM as I've been working with the alarm stuff for a while now...

As for Python bindings it looks like they've been implemented in the python-alarm package from the pyMaemo guys:
http://pymaemo.garage.maemo.org/index.html

Unfortunately there doesn't seem to be any documentation/details about it yet, so might be worth poking around in the source code to see what you can figure out:
http://maemo.org/packages/source/vie...m/0.1-0maemo1/.. specifically, the tar.gz source tarball has some working python-alarm examples in it:
http://repository.maemo.org/extras-d...0maemo1.tar.gz

Thanks!
 

The Following 11 Users Say Thank You to jolouis For This Useful Post:
Guest | Posts: n/a | Thanked: 0 times | Joined on
#6
Thanks! I'll look into this
 
eiffel's Avatar
Posts: 600 | Thanked: 742 times | Joined on Sep 2008 @ England
#7
Originally Posted by code177 View Post
If you had to set up some very basic timed events, eg. running a simple script every 30 minutes, how would you do it?
A "quick-and-easy" solution is to use a shell script. Put this into a plain text file on your device, chmod 744, and execute it:
Code:
#!/bin/ash  #'ash' is the command interpreter on the N900
while true; do
echo "foo"  #replace this with your command
sleep 1800  #do nothing for 30 minutes
done
Press control-C when you want to stop the script.

Regards,
Roger

PS: Is the N900 the first phone to have a control key?
 
Posts: 22 | Thanked: 1 time | Joined on Apr 2008
#8
Thank you so much, eiffel for that piece of code that you posted.

I like running Kismet on my N810 for when I'm playing around with security testing.

Also, it always amazes my friends and people I know, how something like Kismet can actually be put on a small portable device, that most people think you would just be texting or something. Portable devices actually are quite scary, because unlike a laptop which people would obviously think you are hacking them, they usually completely overlook a portable device.

Anyway, I was going crazy trying to figure out how to setup alarmd and install either cron or at, so that it can restart kismet_server every 20 minutes.

For whatever reason, the N810 drivers can cause Kismet to no longer function after at least 20 minutes, so this is why I must have it constantly restarting.

I don't understand the N810 wireless drivers, Kismet can go for 23 minutes on time, 2 hours another time, 3 hours another, and once 12 hrs+. It's like dragorn of Kismet said, the drivers are completely unreliable.
 
Fargus's Avatar
Posts: 1,217 | Thanked: 446 times | Joined on Oct 2009 @ Bedfordshire, UK
#9
Originally Posted by eiffel View Post
...

PS: Is the N900 the first phone to have a control key?

Nope S60 got there some time ago - my aging E61 had a Ctrl key and Ctrl+C et al worked fine.

Last edited by Fargus; 2009-12-07 at 11:51. Reason: Remove irrlevant section of quote.
 

The Following User Says Thank You to Fargus For This Useful Post:
Posts: 486 | Thanked: 154 times | Joined on Sep 2009 @ New York City
#10
This is cool - I started looking into the python code for setting alarms, but the example code is confusing - I don't want to set alarms which the user has to deal with - I just want to set an alarm which runs ever 5 minutes and on alarm runs some process or bit of code. no snoozing or anything.
 
Reply


 
Forum Jump


All times are GMT. The time now is 15:49.