batman client for Android

308 views
Skip to first unread message

Steve Song

unread,
Feb 17, 2010, 6:57:58 AM2/17/10
to village-...@googlegroups.com
Hi all,

Just planting a seed. At some point in the not-too-distant future it
would be great to allow wifi-enabled mobile phones onto a Village
Telco mesh. In Belgium, a mobile virtual network operator called
Cherry offers seamless WiFi/GSM service with a little client you can
download onto their phone which first tries to pick up a WiFi network
and route calls over it and uses GSM as a fallback.

A batman client would make a very cool Android/Meego/Symbian app.

-Steve

--
Steve Song
Telecommunications Fellow, Shuttleworth Foundation

email: steve...@shuttleworthfoundation.org
work: +27 21 970 1220
mobile: +27 83 482 2088
skype: steve_l_song
blog: http://manypossibilities.net
twitter: stevesong

Akshay Mishra

unread,
Feb 17, 2010, 8:19:06 AM2/17/10
to village-...@googlegroups.com
On 17 February 2010 17:27, Steve Song

<steve...@shuttleworthfoundation.org> wrote:
> Hi all,
>
> Just planting a seed.  At some point in the not-too-distant future it
> would be great to allow wifi-enabled mobile phones onto a Village
> Telco mesh.  In Belgium, a mobile virtual network operator called
> Cherry offers seamless WiFi/GSM service with a little client you can
> download onto their phone which first tries to pick up a WiFi network
> and route calls over it and uses GSM as a fallback.


I could get the MP to ring my cell phone. However, could not get voice
through. This could be (as was pointed out here as well) due to the
codecs not supported on my phone. However, this would definitely be a
cool thing.

I got trapped with the MQTH again for awhile, however, would also like
to provide support for the MP through gtalk.

-Akshay

>
> A batman client would make a very cool Android/Meego/Symbian app.
>
> -Steve
>
> --
> Steve Song
> Telecommunications Fellow, Shuttleworth Foundation
>
> email:   steve...@shuttleworthfoundation.org
> work:    +27 21 970 1220
> mobile:  +27 83 482 2088
> skype:   steve_l_song
> blog:    http://manypossibilities.net
> twitter: stevesong
>

> --
> You received this message because you are subscribed to the Google Groups "village-telco-dev" group.
> To post to this group, send email to village-...@googlegroups.com.
> To unsubscribe from this group, send email to village-telco-...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/village-telco-dev?hl=en.
>
>

Lew Pitcher

unread,
Feb 17, 2010, 11:52:58 AM2/17/10
to village-...@googlegroups.com
On February 17, 2010 06:57:58 Steve Song wrote:
> Hi all,
>
> Just planting a seed. At some point in the not-too-distant future it
> would be great to allow wifi-enabled mobile phones onto a Village
> Telco mesh.
[snip]

> A batman client would make a very cool Android/Meego/Symbian app.

The B.A.T.M.A.N. working group has an ongoing project to migrate batman into
the Linux kernel. They've made good progress; their kernel changes have been
moved to the Linux mainline "staging" libraries, and a version of the routing
protocol should be part of one of the next Linux kernel releases.

Having said that, we may not /need/ to look for a batman client app for
Andriod or WebOs or any other Linux-derived smartphone or netbook; soon, it
will come as part of the system. We /may/ need an app to enable it, though.

It looks like wifi telephony is just about to "come of age".

:-)

--
Lew Pitcher
Master Codewright & JOAT-in-training | Registered Linux User #112576
Me: http://pitcher.digitalfreehold.ca/ | Just Linux: http://justlinux.ca/
---------- Slackware - Because I know what I'm doing. ------


signature.asc

Muhammed Ismail

unread,
Feb 17, 2010, 12:01:15 PM2/17/10
to village-...@googlegroups.com
there is SIPgateway to gtalk called gtalk2voip.com

Regards,
Muhammed Ismail
+1 860 910 4859

Mats Karlsson

unread,
Feb 17, 2010, 1:11:29 PM2/17/10
to village-...@googlegroups.com
Gtalk (jingle) is a channel in asterisk so no need for gtalk2voip!

Kind regards
Mats

Antoine van Gelder

unread,
Feb 20, 2010, 6:02:52 PM2/20/10
to village-...@googlegroups.com

On 17 Feb 2010, at 13:57 , Steve Song wrote:

> Hi all,
>
> Just planting a seed. At some point in the not-too-distant future it
> would be great to allow wifi-enabled mobile phones onto a Village
> Telco mesh. In Belgium, a mobile virtual network operator called
> Cherry offers seamless WiFi/GSM service with a little client you can
> download onto their phone which first tries to pick up a WiFi network
> and route calls over it and uses GSM as a fallback.
>
> A batman client would make a very cool Android/Meego/Symbian app.


The easy part:

http://www.7degrees.co.za/~antoine/batman-android.jpg

Writing an Android App to cleanly&reliably&easily:

* manage network & batmand configuration settings

* taking the phone in/out of adhoc mode

* managing batmand startup/shutdown

* displaying connection status

* extra credit: somehow mediating exchange of SIP info between VillageTelco & http://sipdroid.org/

The Android wifi tether project is an excellent reference point if anyone wanted to tackle this:

http://code.google.com/p/android-wifi-tether/

- antoine


Will Tatam

unread,
Feb 22, 2010, 4:52:01 AM2/22/10
to village-...@googlegroups.com

Someone built a copy of olsr for Android, but it's just the binary that needs to be run from a console on a phone with root access

will

On Feb 20, 2010 11:03 PM, "Antoine van Gelder" <ant...@7degrees.co.za> wrote:

On 17 Feb 2010, at 13:57 , Steve Song wrote: > Hi all, > > Just planting a seed. At some point i...

The easy part:

 http://www.7degrees.co.za/~antoine/batman-android.jpg

Writing an Android App to cleanly&reliably&easily:

 * manage network & batmand configuration settings

 * taking the phone in/out of adhoc mode

 * managing batmand startup/shutdown

 * displaying connection status

 * extra credit: somehow mediating exchange of SIP info between VillageTelco & http://sipdroid.org/

The Android wifi tether project is an excellent reference point if anyone wanted to tackle this:

 http://code.google.com/p/android-wifi-tether/

 - antoine

-- You received this message because you are subscribed to the Google Groups "village-telco-d...

elektra

unread,
Feb 22, 2010, 8:54:38 AM2/22/10
to village-...@googlegroups.com
Hello Antoine -


way cool, of course :-)

Was it hard to get it going? Is it difficult to get a root shell on Android?
How is the stability of the phones WiFi driver in ad-hoc mode?

Cheers,
Elektra

Joel Stanley

unread,
Feb 22, 2010, 9:05:14 AM2/22/10
to village-...@googlegroups.com
On Sun, Feb 21, 2010 at 09:32, Antoine van Gelder
<ant...@7degrees.co.za> wrote:
> The easy part:
>
>  http://www.7degrees.co.za/~antoine/batman-android.jpg

Cool!

Can you give us a brief HOWTO outlining the steps required, assuming
we have root on our android device (in my case a HTC Dream)?

Joel

Antoine van Gelder

unread,
Feb 22, 2010, 12:28:42 PM2/22/10
to village-...@googlegroups.com

On 22 Feb 2010, at 15:54 , elektra wrote:

> Hello Antoine -
>
> way cool, of course :-)
>
> Was it hard to get it going?


Surprisingly easy!

Google provide a toolchain so getting a compiler was easy:

http://developer.android.com/sdk/ndk/1.6_r1/index.html

Only needed minor modifications to the Makefile & sources to get it to compile against the Android headers&libs.

Next weekend I'll do some cleanup & submit a patch to the B.A.T.M.A.N. list. :-)


> Is it difficult to get a root shell on Android?


It depends on the particular firmware revision for the bootloader - my phone is quite new so I had to do some jumping through hoops involving writing hardware unlock codes into the first few bytes of my SD card before I could gain access to reflash the phone with a rooted image.

Though I see folk are getting it down to a fine art:

http://blog.makezine.com/archive/2009/08/root_an_android_phone_the_easy_way.html


> How is the stability of the phones WiFi driver in ad-hoc mode?


Persuading the phone into ad-hoc mode was the hardest part of the exercise but once set it seemed to be pretty stable.

I had it running for about five hours before I finally rebooted the phone and during that time BSSID stayed put and the phone responsive to pings.

This was under very low load and on HTC's stock Android 1.5 image running the 2.6.27 kernel so real-world mileage will probably vary.

- antoine

Antoine van Gelder

unread,
Feb 22, 2010, 12:28:50 PM2/22/10
to village-...@googlegroups.com


Step 0: Download & Install the Android SDK from:

http://developer.android.com/


Step 1: Get the batmand binary from:

http://afrimesh.googlecode.com/files/batmand-rv1543_armv6l


Step 2: Install batmand binary on phone

adb shell mkdir /data/data/net.open-mesh.batman
adb push batmand-rv1543_armv6l \
/data/data/net.open-mesh.batman/batmand

(It's quite important to use the path specified as batmand is
hardcoded to look for batmand.socket there)


Step 3: Configure phone for AdHoc -> Try:

http://modmygphone.com/forums/showthread.php?t=22681
http://hydtechblog.com/2009/09/14/how-to-connect-to-ad-hoc-networks-using-tmobile-g1-android/
http://blog.joint.net/2009/07/connecting-android-phone-through-adhoc.html

The OLSR folk also have a nice tutorial for adhoc mode on the Samsung
Galaxy at:

http://www.olsr.org/?q=olsr_on_android

My phone didn't have wpa_cli though so I went with the first approach.


Step 4: Run batmand

adb shell
cd /data/data/net.open-mesh.batman
./batmand tiwlan0


Good luck!

- antoine

Dan

unread,
Mar 2, 2010, 9:41:36 PM3/2/10
to village-telco-dev

On Feb 22, 12:28 pm, Antoine van Gelder <anto...@7degrees.co.za>
wrote:

> Google provide a toolchain so getting a compiler was easy:
>
>  http://developer.android.com/sdk/ndk/1.6_r1/index.html
>
> Only needed minor modifications to the Makefile & sources to get it to compile against the Android headers&libs.
>
> Next weekend I'll do some cleanup & submit a patch to the B.A.T.M.A.N. list. :-)
>

Hi Antoine,

I have to admit I'm a bit jealous! I've been trying to build
B.A.T.M.A.N. for Android myself but without success.

I've checked the open-mesh archives (https://lists.open-mesh.org/
pipermail/b.a.t.m.a.n/) but I guess you haven't posted the patch yet
(or are you referring to another list?).

Any idea when you'll be posting it? Also, would it be possible to get
the Makefile you used, or maybe instructions on what you had to change/
run to get a successful build? I would love any more information you
can give on how to go about building B.A.T.M.A.N. for Android from
source.

I'm working with a group that's looking at creating an Android app
with at least some of the features you mentioned so we're looking at
adding to the B.A.T.M.A.N. daemon's source to simplify communications
with the app. I'd be happy to post our results if we ever get it
working.

Thanks for any help ,
Dan

Antoine van Gelder

unread,
Mar 3, 2010, 2:41:47 AM3/3/10
to village-...@googlegroups.com

On 03 Mar 2010, at 04:41 , Dan wrote:
> I have to admit I'm a bit jealous! I've been trying to build
> B.A.T.M.A.N. for Android myself but without success.
>
> I've checked the open-mesh archives (https://lists.open-mesh.org/
> pipermail/b.a.t.m.a.n/) but I guess you haven't posted the patch yet
> (or are you referring to another list?).


I haven't had a chance yet to clean everything up into a nice patch no :-)


> Any idea when you'll be posting it? Also, would it be possible to get
> the Makefile you used, or maybe instructions on what you had to change/
> run to get a successful build? I would love any more information you
> can give on how to go about building B.A.T.M.A.N. for Android from
> source.


Sure, what I've done is to tar up my working directory for you
and attached it to this reply.

If google groups ate the attachment you can also find it at:

http://afrimesh.googlecode.com/files/batmand-rv1543_android-sources.tar.bz2


Basically, you should be able to get away with just editing the top
three lines of the Makefile:

SDK_ROOT is the path to the Android SDK

NDK_ROOT is the path to the Android NDK
(http://developer.android.com/sdk/ndk/1.6_r1/index.html)

DEVICE is the id of your phone as reported by the command:
"adb devices"

By default it will install the binary on the phone in:

/data/data/net.open-mesh.batman

If you edit the Makefile & jni/batman.h you can set that to your own
location.

The sources in the tarball are a recent checkout from the B.A.T.M.A.N.
source repository and my changes diff down to:


diff -uwarp /Volumes/afrimesh-dev/ext-sources/batman.svn/batman/batman.h jni/batman.h
--- /Volumes/afrimesh-dev/ext-sources/batman.svn/batman/batman.h 2009-10-29 10:31:34.000000000 +0200
+++ jni/batman.h 2010-02-22 19:07:22.000000000 +0200
@@ -24,6 +24,9 @@
#ifndef _BATMAN_BATMAN_H
#define _BATMAN_BATMAN_H

+#ifdef ANDROID
+ #include <sys/select.h>
+#endif
#include <sys/types.h>
#include <netinet/in.h>
#include <pthread.h>
@@ -44,7 +47,7 @@
#define ADDR_STR_LEN 16
#define TQ_MAX_VALUE 255

-#define UNIX_PATH "/var/run/batmand.socket"
+#define UNIX_PATH "/data/data/net.open-mesh.batman/batmand.socket"



--- /Volumes/afrimesh-dev/ext-sources/batman.svn/batman/linux/tun.c 2009-10-29 10:31:34.000000000 +0200
+++ jni/linux/tun.c 2010-02-20 21:02:53.000000000 +0200
@@ -48,7 +48,7 @@


int run_cmd(char *cmd) {
- int error, pipes[2], stderr = -1, ret = 0;
+ int error, pipes[2], _stderr = -1, ret = 0;
char error_log[256];

if (pipe(pipes) < 0) {
@@ -59,7 +59,7 @@ int run_cmd(char *cmd) {
memset(error_log, 0, 256);

/* save stderr */
- stderr = dup(STDERR_FILENO);
+ _stderr = dup(STDERR_FILENO);

/* connect the commands output with the pipe for later logging */
dup2(pipes[1], STDERR_FILENO);
@@ -68,8 +68,8 @@ int run_cmd(char *cmd) {
error = system(cmd);

/* copy stderr back */
- dup2(stderr, STDERR_FILENO);
- close(stderr);
+ dup2(_stderr, STDERR_FILENO);
+ close(_stderr);

if ((error < 0) || (WEXITSTATUS(error) != 0)) {
ret = read(pipes[0], error_log, sizeof(error_log));

> I'm working with a group that's looking at creating an Android app
> with at least some of the features you mentioned so we're looking at
> adding to the B.A.T.M.A.N. daemon's source to simplify communications
> with the app. I'd be happy to post our results if we ever get it
> working.


It would be a huge help if you could share that work! Thank you Dan!

- antoine

batmand-rv1543_android-sources.tar.bz2

Dan

unread,
Mar 3, 2010, 12:22:13 PM3/3/10
to village-telco-dev
Antoine,

Thanks so much for the info and sources, it's truly appreciated!

I can't say exactly what direction this project's going in at the
moment but I'll be more than happy to share the results should
anything come of it. I'll keep you posted.

Thank you again!
Dan

On Mar 3, 2:41 am, Antoine van Gelder <anto...@7degrees.co.za> wrote:
> On 03 Mar 2010, at 04:41 , Dan wrote:
>
> > I have to admit I'm a bit jealous! I've been trying to build
> > B.A.T.M.A.N. for Android myself but without success.
>
> > I've checked the open-mesh archives (https://lists.open-mesh.org/
> > pipermail/b.a.t.m.a.n/) but I guess you haven't posted the patch yet
> > (or are you referring to another list?).
>
> I haven't had a chance yet to clean everything up into a nice patch no :-)
>
> > Any idea when you'll be posting it?  Also, would it be possible to get
> > the Makefile you used, or maybe instructions on what you had to change/
> > run to get a successful build?  I would love any more information you
> > can give on how to go about building B.A.T.M.A.N. for Android from
> > source.
>
> Sure, what I've done is to tar up my working directory for you
> and attached it to this reply.
>
> If google groups ate the attachment you can also find it at:
>

>  http://afrimesh.googlecode.com/files/batmand-rv1543_android-sources.t...

>  batmand-rv1543_android-sources.tar.bz2
> 85KViewDownload

Reply all
Reply to author
Forward
0 new messages