问题
Is it possible to write an app in Android using the wifi API which will act like a hotspot (so granting network access to wifi clients) while still allowing the local wifi device to connect to another wifi network ?
The one I've tested are disabling local Wifi connection in order to create a hotspot.
回答1:
I post here after a few months so people that would like to implement this on an Android device might be helped.
There is a way to have one wireless chip working in hybrid mode, with both station mode (STA) and access point mode (AP) enabled.
To do this, I replaced the wireless driver of my chip with a multi-role
wireless driver. Luckily enough, my chip was supporting this mode, it is however not the case for every wireless chips. My chip being a TI based chip (wl1271), multi role was supported, though it was not available with the previous driver.
Once I got this new driver, I had to recompile it along with my kernel in order to have the .ko
of the wireless driver and the related mac80211
and cfg80211
modules (providing the APIs needed by the new driver) generated. The last step was to upgrade wpa_supplicant
and hostapd
with a custom patched version provided by TI.
Again, for people interested in wl1271
only here are the corresponding drivers/tools I used and reported working on Android 4.0.4 ICS :
https://github.com/TI-OpenLink/hostap/tree/ol_R5.SP3.01
https://github.com/TI-OpenLink/iw/tree/ol_R5.SP3.01
https://github.com/TI-OpenLink/ti-utils/tree/ol_R5.SP3.01
https://github.com/TI-OpenLink/wl12xx_target_scripts/tree/ol_R5.SP3.01/sta
https://github.com/TI-OpenLink/compat/tree/ol_R5.SP3.01/
https://github.com/TI-OpenLink/compat-wireless/tree/ol_R5.SP3.01/
If there is a multi role driver for your wireless chip, it might be worth it finding out what version or patches of wpa_supplicant and hostapd you shall use, and compile/try them.
At the end of the process, I had access to two network interfaces (wlan0 and wlan1), and could launch wpa_supplicant on wlan0 and hostapd on wlan1.
回答2:
What you are describing is called WDS (Wireless Distribution System). I think that this functionality is not implemented in Android wifi API. It is used in wireless APs to enable a wireless link upstream.
来源:https://stackoverflow.com/questions/12499456/multiplexed-hotspot-in-android