A closer look at the wext implementation in the kernel shows that the iwconfig ap setting configures the network BSSID.
Your problem is known as "cell splitting".
After some testing I determined that:
- The "iwconfig wlan0 ap" command works if I run it as part of the adhoc.edify script when the wireless interface is first configured and brought up.
- Setting the cell id to the same value on both devices did not work. They were not able to communicate.
- Setting the cell id to "any" resulted in "Cell: Not-Associated", which did work. The devices were able to communicate.
- Setting the cell id to "off" resulted in the same behavior as setting the cell id to "any".
Refer to the following file:
Refer to the code snippet below. Add the "ap any" line to your adhoc_edify file. Let me know how it turns out for you.
# ASUS Nexus 7
getcfg("device.type") == "nexus7" && (
# Load driver via load_wifi(), later unload driver via rmmod("dhd")
log(load_wifi(), "Loading WiFi driver");
log(run_program("/data/data/org.span/bin/ifconfig " + getcfg("wifi.interface") + " " + getcfg("ip.address") + " netmask " + getcfg("ip.netmask")) &&
run_program("/data/data/org.span/bin/ifconfig " + getcfg("wifi.interface") + " up"), "Activating WiFi interface");
log(run_program("/data/data/org.span/bin/iwconfig " + getcfg("wifi.interface") + " mode ad-hoc"), "Setting ad-hoc mode");
log(run_program("/data/data/org.span/bin/iwconfig " + getcfg("wifi.interface") + " essid " + getcfg("wifi.essid")), "Setting essid");
log(run_program("/data/data/org.span/bin/iwconfig " + getcfg("wifi.interface") + " ap any"), "Setting cell id");
log(run_program("/data/data/org.span/bin/iwconfig " + getcfg("wifi.interface") + " channel " + getcfg("wifi.channel")), "Setting channel");
log(run_program("/data/data/org.span/bin/iwconfig " + getcfg("wifi.interface") + " power all"), "Setting power management");
getcfg("wifi.txpower") != "auto" && (
log(run_program("/data/data/org.span/bin/iwconfig " + getcfg("wifi.interface") + " txpower " + getcfg("wifi.txpower")), "Setting transmit power");
);
);
- stoker