Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manet Manager Service can't start Ad-Hoc mode? #5

Open
duhmojo opened this issue Feb 12, 2013 · 27 comments
Open

Manet Manager Service can't start Ad-Hoc mode? #5

duhmojo opened this issue Feb 12, 2013 · 27 comments
Labels

Comments

@duhmojo
Copy link

duhmojo commented Feb 12, 2013

Hi. I know you've probably had a fair bit of questions along these lines, but I'm going to ask anyways. I'm using a Samsung Tab 2 7.0 (GT-P3113). I've used Odin to enable root/SuperUser with CF-Root. I know SuperUser is working because the Manet Manager will prompt it for root permissions. However when I start Ad-Hoc mode, I see the starting... spinner and then a toast with "Ad-hoc mode is not running". The Show logs are empty, and I don't see a setting that might help. I did notice that with Wifi enabled, when Manet Manager is started and fails, Wifi is disabled. (like it tried to stop, do something then failed before it could start wifi again)

I captured debug logs from when I fired up MM until it failed to start in ad-hoc. However I think this is the most interesting part. The enqueueToast is probably the "Ad-hoc mode is not running" toast. And I don't know if "Cannot open /data/.cid.info: No such file or directory" is actually a show stopper or something that can be ignored.

If you have any suggestions on what the issue could be, please let me know! Thank you.

02-12 12:43:44.183: D/Tethering(192): sendTetherStateChangedBroadcast 0, 0, 0
02-12 12:43:44.183: D/com.android.internal.telephony.gsm.FastDormancyStateHelper(369): onReceive() action=android.net.conn.TETHER_STATE_CHANGED
02-12 12:43:44.183: E/MTPJNIInterface(1559): tethering status = false
02-12 12:43:44.191: W/NetworkStats(192): dropping UID delta from unknown iface: iface=wlan0 uid=0 set=DEFAULT tag=0x0 rxBytes=0 rxPackets=0 txBytes=308 txPackets=5 operations=0
...
02-12 12:43:44.480: I/WifiHW(192): ##################### set firmware type 0 #####################
02-12 12:43:44.558: W/Netd(92): No subsystem found in netlink event
02-12 12:43:44.558: D/Tethering(192): interfaceRemoved wlan0
02-12 12:43:44.558: E/Tethering(192): attempting to remove unknown iface (wlan0), ignoring
02-12 12:43:44.558: D/NetlinkEvent(92): Unexpected netlink message. type=0x11
02-12 12:43:45.324: D/STATUSBAR-NetworkController(273): onReceive() - RSSI_CHANGED_ACTION, WIFI_STATE, NETWORK_STATE
02-12 12:43:45.332: D/systemui/quicksetting/QuickSettingButton(273): Wifi state = 1
02-12 12:43:45.332: D/systemui/quicksetting/QuickSettingButton(273): setActivateStatus(2) - 1:on, 2:off, 3:dim
02-12 12:43:45.542: E/lights(192): write_int failed to open /sys/class/sec/sec_touchkey/brightness
02-12 12:43:45.542: W/PowerManagerService(192): Timer 0x7->0x3|0x0
02-12 12:43:45.542: I/PowerManagerService(192): Ulight 7->3|0
02-12 12:43:45.542: D/PowerManagerService(192): setLightBrightness : mButtonLight : 0
02-12 12:43:49.175: D/CoreTask(3165): Root command ==> /data/data/org.span/bin/adhoc start 1
02-12 12:43:49.308: E/WifiHW(4931): Cannot open "/data/.cid.info": No such file or directory
02-12 12:43:49.308: I/WifiHW(4931): ==========[WIFI] Station firmware load ===========
02-12 12:43:49.378: D/AndroidRuntime(4929): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
02-12 12:43:49.378: D/AndroidRuntime(4929): CheckJNI is OFF
02-12 12:43:49.378: D/AndroidRuntime(4929): setted country_code = USA
02-12 12:43:49.378: D/AndroidRuntime(4929): setted countryiso_code = US
02-12 12:43:49.386: D/AndroidRuntime(4929): setted sales_code = XAR
02-12 12:43:49.386: D/AndroidRuntime(4929): readGMSProperty: start
02-12 12:43:49.386: D/AndroidRuntime(4929): readGMSProperty: already setted!!
02-12 12:43:49.386: D/AndroidRuntime(4929): readGMSProperty: end
02-12 12:43:49.566: D/LibQmg_native(4929): register_android_app_LibQmg
02-12 12:43:49.589: D/AndroidRuntime(4929): Calling main entry com.android.commands.am.Am
02-12 12:43:49.613: D/AndroidRuntime(4929): Shutting down VM
02-12 12:43:49.613: D/STATUSBAR-NotificationService(192): enqueueToast()

@duhmojo
Copy link
Author

duhmojo commented Feb 12, 2013

Ok, I accessed shell as root on the Tab and tried the following. Maybe this will help. It looks like the adhoc binary can't find a number of pieces that seem required:

shell@android:/data/data/org.span/bin # ./adhoc start 1
./adhoc start 1
about to run: [/data/data/org.span/bin/iptables -t filter -F]
getsockopt for multiport failed strangely: No such file or directory
getsockopt for multiport failed strangely: No such file or directory
about to run: [/data/data/org.span/bin/iptables -t nat -F]
getsockopt for multiport failed strangely: No such file or directory
getsockopt for multiport failed strangely: No such file or directory
about to run: [echo 1 > /proc/sys/net/ipv4/ip_forward]
about to run: [/data/data/org.span/bin/iptables -A FORWARD -j ACCEPT]
getsockopt for multiport failed strangely: No such file or directory
getsockopt for multiport failed strangely: No such file or directory
about to run: [/data/data/org.span/bin/ifconfig eth0 192.168.1.100 netmask 255.255.255.0]
error: SIOCSIFADDR (No such device)
about to run: [/data/data/org.span/bin/iwconfig eth0 mode ad-hoc]
Error for wireless request "Set Mode" (8B06) :
SET failed on device eth0 ; No such device.
about to run: [/data/data/org.span/bin/iwconfig eth0 essid AndroidAdhoc]
Error for wireless request "Set ESSID" (8B1A) :
SET failed on device eth0 ; No such device.
about to run: [/data/data/org.span/bin/iwconfig eth0 channel 1]
Error for wireless request "Set Frequency" (8B04) :
SET failed on device eth0 ; No such device.
about to run: [/data/data/org.span/bin/iwconfig eth0 commit]
Error for wireless request "Commit changes" (8B00) :
SET failed on device eth0 ; No such device.
script result was []

@duhmojo
Copy link
Author

duhmojo commented Feb 12, 2013

I don't know if this also helps, but I seem to be missing wpa_cli. Could be my CF-Root kernel is missing some extra wifi stuff that needed, but its not easy determining this.

@jrobble
Copy link
Member

jrobble commented Feb 12, 2013

Hi duhmojo,

"Cannot open /data/.cid.info: No such file or directory" is probably unrelated.

The Show Log feature is just a stub and currently not being used.

Type the following command:

/data/data/org.span/bin/iwconfig

If your device doesn't have wireless extensions support (wext) in the kernel the output will say so.

Try to flip into ad-hoc mode by executing the following command (assuming your wireless interface is "wlan0"):

/data/data/org.span/bin/iwconfig wlan0 mode ad-hoc

Based on your more recent post, "SET failed on device eth0 ; No such device." seems to be your problem.

The Manet Manager may not be using the right wireless interface for your device. Take a look at "getDeviceType()" and "getWifiInterface()" in the DeviceConfig class:

https://github.com/ProjectSPAN/android-manet-manager/blob/master/AndroidManetManager/src/org/span/service/system/DeviceConfig.java

The app is probably identifying your device as DEVICE_GENERIC and therefore attempting to use the wrong wireless interface ("eth0"), when it should be using "wlan0".

If that's your problem, please update "getDeviceType()" and "getWifiInterface()" appropriately and commit your changes to the repo.

@duhmojo
Copy link
Author

duhmojo commented Feb 12, 2013

Thanks for the reply. I'm missing the kernel wireless extensions. I'm new to getting ad-hoc working.

shell@android:/data/data/org.span/bin # ./iwconfig
./iwconfig
lo no wireless extensions.

ifb0 no wireless extensions.

ifb1 no wireless extensions.

sit0 no wireless extensions.

ip6tnl0 no wireless extensions.

The CF-Auto kernel doesn't seem to have included these. I've had a really hard time trying to track down what's actually needed for ad-hoc MANET support. e.g. many custom roms will list "ad-hoc support" but it's not clear what that actually means. (kernel with wexts + the right tools like wpa_cli)

Your list of custom kernels (https://github.com/monk-dot/SPAN/tree/master/kernels) only includes the Galaxy Nexus, but the (https://play.google.com/store/apps/details?id=org.span) Play store description includes the Tab 10 (which I'm hoping might work or be close to the Tab 2 7.0)

Do you have any suggestions? Rooting is one thing, but trying to find a reliable path to ad-hoc has been difficult. (I've been on every corner of XDA but I'm not keen on grabbing just any wpa_supplicant attachment)

Thanks!

@jrobble
Copy link
Member

jrobble commented Feb 12, 2013

Hmm, none of those interfaces look like wireless interfaces to me. Try turning on wireless through the Android Settings app and running iwconfig again. Usually it's called ethX, wlanX, wlX, tiwlanX, or something similar.

I can tell you the exact line of code I had to modify in kernels of modern devices to get ad-hoc mode support if you want to try compiling your own kernel or looking at the source. Just let me know.

You can try executing the following command to force the wireless interface to come up (assume it's eth0):
/data/data/org.span/bin/ifconfig eth0 up

The Galaxy Tab 10 is supported, but it's older than the Galaxy Tab 2 7.0, so the latter might not have wext support; however, I just got the Galaxy S III International working, and it has wext support, which surprised me.

@duhmojo
Copy link
Author

duhmojo commented Feb 14, 2013

Right sorry. I must have tried it after MANET Manager, which seems to have disabled Wifi and I forgot to turn it back on. Here it is again with wlan0:

126|shell@android:/ # /data/data/org.span/bin/iwconfig
/data/data/org.span/bin/iwconfig
lo no wireless extensions.

ifb0 no wireless extensions.

ifb1 no wireless extensions.

sit0 no wireless extensions.

ip6tnl0 no wireless extensions.

wlan0 IEEE 802.11bgn ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=1496 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on

Here I tried to manually turn on ad-hoc using wlan0:

shell@android:/ # /data/data/org.span/bin/iwconfig wlan0 mode ad-hoc
/data/data/org.span/bin/iwconfig wlan0 mode ad-hoc
Error for wireless request "Set Mode" (8B06) :
SET failed on device wlan0 ; Operation not supported on transport endpoint.

Is this an indication that my wpa_supplicant is a problem? Thanks for the support!

@jrobble
Copy link
Member

jrobble commented Feb 14, 2013

I never had to mess with the wpa_supplicant to get SPAN working.

I've seen "SET failed on device wlan0 ; Operation not supported on transport endpoint" before and the problem is that the kernel does not support ad-hoc mode. Since your device is newer than the Tab 10 that's to be expected.

You'll have to compile a custom kernel with the appropriate modifications. The hard part is enabling wext support. Luckily your device already has it. The two modifications you need to make to your kernel are similar to what I had to do to the Samsung Galaxy S III GT-I9300 kernel:

KERNEL MODS

/drivers/net/wireless/bcmdhd/Makefile
Remove "-DPKT_FILTER_SUPPORT" from "DHDCFLAGS"

/drivers/net/wireless/bcmdhd/wl_cfg80211.c
Add NL80211_IFTYPE_ADHOC mode to list of supported interfaces:

static s32 wl_setup_wiphy(struct wireless_dev *wdev, struct device *sdiofunc_dev)
{
// ...
wdev->wiphy->interface_modes =
BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC)
#if !(defined(WLP2P) && defined(WL_ENABLE_P2P_IF))
| BIT(NL80211_IFTYPE_MONITOR)
#endif
| BIT(NL80211_IFTYPE_AP);
// ...
}

See if you can find your kernel source here:
http://opensource.samsung.com/

Here's a basic outline of how to compile a kernel:
https://groups.google.com/forum/#!topic/spandev/oCtyKHE1G3s

Let me know if you need any more help or run into problems.

@jrobble
Copy link
Member

jrobble commented Feb 14, 2013

In the wl_setup_wiphy() function I added the "| BIT(NL80211_IFTYPE_ADHOC)" bit.

@duhmojo
Copy link
Author

duhmojo commented Feb 14, 2013

I originally had ordered a a bunch of Lenovo A1s, but they cancelled my order 3 times without notice until I finally had a chat with the shipping manager and they finally agreed to ship them. They arrive next week. In the meantime I decided to give the Samsung Tabs I have on loan a try. If I need to build my own kernel, I'd like to spend the time with the A1s instead. The reason I settled on them is there's user evidence out there people have had success with ad-hoc. (http://forum.xda-developers.com/showthread.php?p=31034291 just an example)

Samsung has so many models that don't seem to be consistent in their support that it makes plunking down for a dozen of them risky. I'll wait until next week and see how it goes with them. I would love to learn more about building a custom Android kernel and contribute it back to the project, but I can't justify it yet. At the very least, if the A1 works out, you can add a new supported device to the list.

Thanks for the support and I'll post back my experience with the A1, good or bad. This issue thread won't go to waste. I'm sure someone else will ask about newer Tabs as well.

@duhmojo
Copy link
Author

duhmojo commented Feb 26, 2013

I'm back! Got my Lenovo A1s finally. I installed CWM then used A1_Rooter to get SuperUser installed.

With a rooted A1 (6244 ROM) MANET Manager can enable adhoc fine. No errors, but I've only setup 1 device so far. I have to fix a ROM downgrade issue on the other device. (the touch screen doesn't work!) Anyways, here's the adb.exe shell output from the same tests. You can see that eth0 is used, so no need for wlan0 support with the A1.

./iwconfig
lo no wireless extensions.

usb0 no wireless extensions.

sit0 no wireless extensions.

ip6tnl0 no wireless extensions.

eth0 IEEE 802.11-DS ESSID:"gettergo" Nickname:""
Mode:Managed Frequency:2.437 GHz Access Point: 02:1A:11:F5:2B:64
Bit Rate=65 Mb/s Tx-Power:32 dBm
Retry min limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Managementmode:All packets received
Link Quality=5/5 Signal level=-42 dBm Noise level=-93 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

/data/data/org.span/bin/iwconfig eth0 mode ad-hoc

/data/data/org.span/bin/iwconfig eth0 mode ad-hoc

Once I get the other devices rooted and working I'll test them in a manet and let you know how it goes. (for FYI on Lenovo A1 support at least) Thanks.

@jrobble
Copy link
Member

jrobble commented Feb 26, 2013

Sounds good. Keep us in the loop.

On Tue, Feb 26, 2013 at 4:01 PM, duhmojo notifications@github.com wrote:

I'm back! Got my Lenovo A1s finally. I installed CWM then used A1_Rooter
to get SuperUser installed.

With a rooted A1 (6244 ROM) MANET Manager can enable adhoc fine. No
errors, but I've only setup 1 device so far. I have to fix a ROM downgrade
issue on the other device. (the touch screen doesn't work!) Anyways, here's
the adb.exe shell output from the same tests. You can see that eth0 is
used, so no need for wlan0 support with the A1.

./iwconfig
lo no wireless extensions.

usb0 no wireless extensions.

sit0 no wireless extensions.

ip6tnl0 no wireless extensions.

eth0 IEEE 802.11-DS ESSID:"gettergo" Nickname:""
Mode:Managed Frequency:2.437 GHz Access Point: 02:1A:11:F5:2B:64
Bit Rate=65 Mb/s Tx-Power:32 dBm
Retry min limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Managementmode:All packets received
Link Quality=5/5 Signal level=-42 dBm Noise level=-93 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
/data/data/org.span/bin/iwconfig eth0 mode ad-hoc

/data/data/org.span/bin/iwconfig eth0 mode ad-hoc

Once I get the other devices rooted and working I'll test them in a manet
and let you know how it goes. (for FYI on Lenovo A1 support at least)
Thanks.


Reply to this email directly or view it on GitHubhttps://github.com//issues/5#issuecomment-14139384
.

@duhmojo
Copy link
Author

duhmojo commented Mar 15, 2013

I logged another issue regarding the Lenovo A1 and ICS, and thought I should update this one too. The A1 has been working fine with our Lenovo A1s with both the official GingerBread and IceCream Sandwich roms from Lenovo. There's some good information on the Lenovo support forums on how to root the A1.

The MANET with 4 devices seems to work fine. I've found that it's most reliable switching WIFI off, and letting MANET Manager enable ad-hoc.

NOTE to anyone with an A1 happens to read this post while researching MANET Manager: DON'T try downgrading if you're on Ginger Bread! Just do the CWM + A1_Rooter method. It'll work fine with the 2644 if you have it. I rooted 4 A1s this way, and screwed up another, which I spent a long day upgrading to ICS. I had downgraded from firmware 2644 to 2643 because 2643 was what all the rooting info was on and I ended up losing my touch screen. Lenovo doesn't make 2644 available because they want to move to ICS. There's a firmware patch on XDA that's supposed to fix the problem, it doesn't and it's entirely in Chinese. You can upgrade to their ICS firmware, but read the Lenovo support forums.

@Donny3000
Copy link

I'm working to get the MANET Manager to working on my Samsung Nexus S (crespo) as well. But, I running into a similar problem that duhmojo was having. The error I'm getting when I execute /data/data/org.span/bin/iwconfig eth0 mode ad-hoc, I get this error:

root@android:/data/data/org.span/bin # ./iwconfig wlan0 mode ad-hoc            
Error for wireless request "Set Mode" (8B06) :
    SET failed on device wlan0 ; Try again.
250|root@android:/data/data/org.span/bin #

And this is the output from iwconfig

root@android:/data/data/org.span/bin # ./iwconfig                              
lo        no wireless extensions.

rmnet0    no wireless extensions.

rmnet1    no wireless extensions.

rmnet2    no wireless extensions.

ifb0      no wireless extensions.

ifb1      no wireless extensions.

sit0      no wireless extensions.

ip6tnl0   no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on

root@android:/data/data/org.span/bin #

I'm running the CM-10.2 ROM with the CM linux kernel v3.0.89. The changes to the kernel that you suggested earlier have already been made by the CM team apparently, when I was looking through the source. So, that part is fine. I also modified the MANET manager source to use the wlan0 interface instead of the eth0 interface as you have mentioned earlier as well. But, I still get the "Ad-Hoc mode is not running" toast.

Do you know what might be going on? Might there be another firmware blob that I should use?

@duhmojo
Copy link
Author

duhmojo commented Oct 16, 2013

The current and last build of Manet Manager lets you select the wireless interface from Settings. Also, make sure your wifi is off before trying to start the manet. Finally, I've had situations where playing with the manet state kind of screws up Manet Manager and I need to restart the device. (not a shot at Manet Manager, I've just been messing around with the device)

@Donny3000
Copy link

Thank duhmojo for the reply. I'm actually using the latest code for the MANET manager and I've selected the appropriate interface (wlan0 in my case) and commited the changes. I was also using your suggestion of making sure WiFi is off before trying to start the MANET, but still to no avail. Still tells me that it can't start Ad-Hoc mode and iwconfig still fails to set the mode to ad-hoc.

What exactly did you have to do to your kernel to make sure the appropriate wireless extension were enabled? Maybe I missed something while configuring mine.

@duhmojo
Copy link
Author

duhmojo commented Oct 17, 2013

Sorry about the wait. I couldn't reply from my phone yesterday. For me I started with a Samsung Tab 7 2.0, and that's how this thread got started. We had a couple of Lenovo A1 7" tablets on order for our actual testing. The A1 was selected because there was evidence that the A1 was easily rootable, and that its kernel included the wireless extensions. Once I finally received the A1s, I rooted them and installed Manet Manager. Nothing else was needed. For the A1 the wirelss device was labeled as eth0, not wlan0. The kernel is straight from Lenovo. I merely installed ClockWorkMod, then the super user apk.

According to jrobble, the "SET failed on device..." error when trying to start ad-hoc mode is an indication your kernel doesn't support ad-hoc.

"I've seen "SET failed on device wlan0 ; Operation not supported on transport endpoint" before and the problem is that the kernel does not support ad-hoc mode. Since your device is newer than the Tab 10 that's to be expected."

I was never clear on whether that meant the kernel and/or wireless extensions, and/or wpa_supplicant are all at fault, but I believe all 3 pieces have to be put together to support ad-hoc. I dug around in /proc/net/ catting everything I could find, looking for some evidence that my A1 had the extensions, or that flag 8B06 was set, but I couldn't find anything.

Here's my A1 iwconfig:

./iwconfig

./iwconfig
lo no wireless extensions.

usb0 no wireless extensions.

sit0 no wireless extensions.

ip6tnl0 no wireless extensions.

eth0 IEEE 802.11-DS ESSID:"" Nickname:""
Mode:Managed Frequency:2.412 GHz Access Point: Not-Associated
Bit Rate:72 Mb/s Tx-Power:32 dBm
Retry min limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Managementmode:All packets received
Link Quality=5/5 Signal level=0 dBm Noise level=-92 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

Here's my iwconfig from the earlier Tab 2.0:

wlan0 IEEE 802.11bgn ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=1496 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on

It's possible the difference is the wireless driver. I'm not sure how to determine my A1's wireless device driver or manufacturer from shell. The kernel mod jrobble notes earlier is for a Broadcom wireless chip (bcmdhd/wl_cfg80211). Not all Android devices, kernels, etc... will have the same hardware or drivers. (just wait until we all have 802.11ac supporting devices, we're going to go through these headache all over again...)

@Donny3000
Copy link

No problems about the delay, but thanks again for the helpful response. Playing around some more with my device I was able to get the ./iwconfig wlan0 mode ad-hoc to work! All I had to do was turn on my WiFi to get the command to work (I thought I already had it on while performing the command, but never dawned on me to actually check it to make sure). So that part works.

Now, I just need to figure out why the MANET manager can't start ad-hoc mode. I've tried starting Ad-Hoc mode with and without WiFi enabled, but I still get the same response (Ad-Hoc mode is not running). I'm assuming there is something in the Java code that I need to change/modify. So, I'm trying to find out where in the code the manager is trying to enable/disable WiFi and perform the iwconfig/adhoc steps. Hopefully that might glean some understanding as to why the app can't start Ad-Hoc mode.

Have you had this issue or a similar issue?

@duhmojo
Copy link
Author

duhmojo commented Oct 17, 2013

Reboot your device and do exactly what you think should work to get adhoc mode running. As I mentioned, I've have Manet Manager in funky states where it would indicate it wasn't running, then when I enabled it, it would switch off again and toast that the manet was stopped. When this happens I have to reboot.

Also, you can screw Manet Manager up if you let the device switch to power saving mode. e.g. letting the screen dim then turn off, or touching the power button to turn the screen off. I end up having to reboot the device when this happens by accident. At least this is what I experience with my A1s. So I set the screen to never turn off, and if I accidently touch the power button, I reboot and try again.

For me wifi needs to be off before starting the manet. jrobble indicated this was generally true. I don't know what this might mean for you though.

@jrobble
Copy link
Member

jrobble commented Oct 17, 2013

@Donny3000 What output do you get when you execute the following command?

/data/data/org.span/bin/adhoc start 1

After you run it, what's the output of the following command?

/data/data/org.span/bin/iwconfig

@Donny3000
Copy link

With WiFi off, this is my output of the two commands:

root@android:/ # /data/data/org.span/bin/adhoc start 1
about to run: [/data/data/org.span/bin/iptables -t filter -F]
about to run: [/data/data/org.span/bin/iptables -t nat -F]
about to run: [echo 1 > /proc/sys/net/ipv4/ip_forward]
about to run: [/data/data/org.span/bin/iptables -A FORWARD -j ACCEPT]
script result was []
root@android:/ # 
root@android:/ # /data/data/org.span/bin/iwconfig
lo        no wireless extensions.

rmnet0    no wireless extensions.

rmnet1    no wireless extensions.

rmnet2    no wireless extensions.

ifb0      no wireless extensions.

ifb1      no wireless extensions.

sit0      no wireless extensions.

ip6tnl0   no wireless extensions.

wlan0     IEEE 802.11bg  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on

root@android:/ #

When I turn WiFi on, this is the output:

root@android:/ # /data/data/org.span/bin/adhoc start 1                         
about to run: [/data/data/org.span/bin/iptables -t filter -F]
about to run: [/data/data/org.span/bin/iptables -t nat -F]
about to run: [echo 1 > /proc/sys/net/ipv4/ip_forward]
about to run: [/data/data/org.span/bin/iptables -A FORWARD -j ACCEPT]
script result was []
root@android:/ #                                                               
root@android:/ # /data/data/org.span/bin/iwconfig                              
lo        no wireless extensions.

rmnet0    no wireless extensions.

rmnet1    no wireless extensions.

rmnet2    no wireless extensions.

ifb0      no wireless extensions.

ifb1      no wireless extensions.

sit0      no wireless extensions.

ip6tnl0   no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   Tx-Power=1496 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on

root@android:/ #

@jrobble
Copy link
Member

jrobble commented Oct 17, 2013

Always turn Wi-Fi off before using the Manet Manager. "Mode:Managed" is your problem. That should read "Mode:Ad-hoc" (or similar) if you're able to successfully flip the Wi-Fi chip into ad-hoc mode.

Actually, on closer inspection, I don't see anything related to setting ad-hoc mode in your "about to run:" output. This is most likely because your device is not supported. Supported devices have an entry in adhoc.edify:

https://github.com/ProjectSPAN/android-manet-manager/blob/master/AndroidManetManager/res/raw/adhoc_edify

… and would result in a line like the following being executed in the edify script:

log(run_program("/data/data/org.span/bin/iwconfig " + getcfg("wifi.interface") + " mode ad-hoc"), "Setting ad-hoc mode");

Your output seems to indicate that it's not even trying to do that.

Would output do you get when you run the following command:

cat /data/data/org.span/conf/manet.conf

Specifically, I'm curious what your "device.type" is set to.

@Donny3000
Copy link

Hmm, I know I can switch into ad-hoc mode, because if I execute the command ./iwconfig wlan0 mode ad-hoc followed by ./iwconfig, this is my output:

root@android:/ # 
root@android:/ # /data/data/org.span/bin/iwconfig wlan0 mode ad-hoc            
root@android:/ # /data/data/org.span/bin/iwconfig                              
lo        no wireless extensions.

rmnet0    no wireless extensions.

rmnet1    no wireless extensions.

rmnet2    no wireless extensions.

ifb0      no wireless extensions.

ifb1      no wireless extensions.

sit0      no wireless extensions.

ip6tnl0   no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:off/any  
          Mode:Ad-Hoc  Cell: Not-Associated   Tx-Power=1496 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on

root@android:/ 

But here is the output of cat /data/data/org.span/conf/manet.conf:

root@android:/ # cat /data/data/org.span/conf/manet.conf
adhoc.fix.persist=false
adhoc.fix.route=false
adhoc.mode=wifi
bluetooth.disable.wifi=false
bluetooth.kernel.support=true
bluetooth.make.discoverable=false
device.type=nexus_s
dns.server=208.67.222.222
gateway.interface=none
ip.address=192.168.1.100
ip.gateway=192.168.1.254
ip.netmask=255.255.255.0
ip.network=192.168.1.0
routing.ignore.list=[]
routing.protocol=Optimized Link State Routing
screen.on=false
userid=Anonymous
wifi.channel=1
wifi.driver=wext
wifi.encryption.algorithm=none
wifi.encryption.password=abcdefghijklm
wifi.encryption.setup=wpa_supplicant
wifi.essid=AndroidAdhoc
wifi.interface=wlan0
wifi.txpower=auto
root@android:/ #

I actually modified the code and added my device "nexus_s"

@jrobble
Copy link
Member

jrobble commented Oct 17, 2013

Right, but did you add an entry for the nexus_s device to the /res/raw/adhoc_edify file? Even though you can manually set ad-hoc mode, the Manet Manager (which executes adhoc.edify) is not programmed to do it for your device.

@Donny3000
Copy link

Thanks jrobble for the guidance. I found the adhoc_edify file and add my device, nexus_s, to the "generic" clause, but when I pushed the source to my device I had same "Ad-Hoc mode is not running" message. So, I found the adhoc.edfiy script in /data/data/org.span/conf, edited that and now I have "Ad-Hoc mode is running"! Thanks again for the assistance.

But when I edited the /res/raw/adhoc_edify script, shouldn't that have made the changes to /data/data/org.span/conf/adhoc.edify on the device when I pushed the APK?

@jrobble
Copy link
Member

jrobble commented Oct 17, 2013

For some reason Android projects in Eclipse don't let you put files with periods in them in /res/raw. Thus, I replace periods with underscores in the file names. When those files get copied to the device the underscores are replaced with periods.

Note that if you've already installed Manet Manger, reinstalling over it won't copy over the new /res/raw files. Thus, you should do a complete uninstall of the app before installing the new version on the device.

Also, you should completely clean and build Manet Manger beforehand to make sure the compiled apk contains the new /res/raw files. Sometimes I manually delete /bin and /gen before building just to be sure.

@Donny3000
Copy link

Thanks jrobble and dumojo for your help! I now have a MANET consisting of 3 Motorola Xooms and 2 Nexus S phones! I meant to post this yesterday, but I was busy setting up and managing my MANET!

@jrobble
Copy link
Member

jrobble commented Oct 19, 2013

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants