开发者

How to set up an ad hoc network by using the shell on a rooted Android device?

开发者 https://www.devze.com 2023-01-26 19:10 出处:网络
In the moment I am working with some ad hoc routing protocols (namely OLSR and B.A.T.M.A.N.) on rooted Android devices running Cyanogenmod. My tests are working pretty well. However, there is one thin

In the moment I am working with some ad hoc routing protocols (namely OLSR and B.A.T.M.A.N.) on rooted Android devices running Cyanogenmod. My tests are working pretty well. However, there is one thing which really is annoying: I can only connect to an existing ad hoc network, but not create one manually using only the phones. Right now I am using my laptop to set up an ad hoc network and to run a small DHCP server.

Do you know how to create an ad hoc network manually by using the shell on Android? I have found some methods how this should work, but none did work for me. I tried using ifconfig, iwconfig, netcfg and even wpa_cli (which seemed to be the best choice for this). But after any try the system fell back into "no wifi connected" state - even if the phone stayed in ad hoc mode for a couple of seconds while searching for an IP.

I will be so gladful if I can finally get around this problem because then I might actually use my laptop for Internet access (and therefore searching for online开发者_StackOverflow help during the tests) instead of using it to set up an ad hoc network. :-)


I'm not really clear on the technical details, but android-wifi-tether requires you to have a custom kernel with NETFILTER support, which I don't know if Cyanogenmod has. You might try using another open source project as an example: Barnacle Tether. It doesn't require a custom kernel.

I've started looking at the source for Barnacle for my own project. It's pretty easy to compile, but I've only just begun playing with it so I don't know the exact answer to your question.


Correct me if I'm wrong, but didn't the old cyanogen tethering app (android 1.6, before tethering was officially offered) create an ad-hoc network for the tether clients? (I ended up using it not to tether, but just to set up a network so I could ssh into the phone from a laptop while I was playing around with USB host drivers and so couldn't use ADB.)

0

精彩评论

暂无评论...
验证码 换一张
取 消