mirror of
https://github.com/lakinduakash/linux-wifi-hotspot.git
synced 2024-11-21 19:40:11 +00:00
Merge pull request #188 from sigmaSd/fallback
Always fallback if multiple channels are not supproted
This commit is contained in:
commit
77597638e4
@ -1573,32 +1573,38 @@ if [[ $NO_VIRT -eq 0 ]]; then
|
|||||||
echo "DONE"
|
echo "DONE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Find interface frequency and channel
|
||||||
|
WIFI_IFACE_FREQ=$(iw dev ${WIFI_IFACE} link | grep -i freq | awk '{print $2}')
|
||||||
|
WIFI_IFACE_CHANNEL=$(ieee80211_frequency_to_channel ${WIFI_IFACE_FREQ})
|
||||||
|
echo -n "${WIFI_IFACE} is already associated with channel ${WIFI_IFACE_CHANNEL} (${WIFI_IFACE_FREQ} MHz)"
|
||||||
|
|
||||||
|
|
||||||
|
# If the frequency is not explicitly set, set one automatically
|
||||||
if is_wifi_connected ${WIFI_IFACE} && [[ $FREQ_BAND_SET -eq 0 ]]; then
|
if is_wifi_connected ${WIFI_IFACE} && [[ $FREQ_BAND_SET -eq 0 ]]; then
|
||||||
WIFI_IFACE_FREQ=$(iw dev ${WIFI_IFACE} link | grep -i freq | awk '{print $2}')
|
|
||||||
WIFI_IFACE_CHANNEL=$(ieee80211_frequency_to_channel ${WIFI_IFACE_FREQ})
|
|
||||||
echo -n "${WIFI_IFACE} is already associated with channel ${WIFI_IFACE_CHANNEL} (${WIFI_IFACE_FREQ} MHz)"
|
|
||||||
if is_5ghz_frequency $WIFI_IFACE_FREQ; then
|
if is_5ghz_frequency $WIFI_IFACE_FREQ; then
|
||||||
FREQ_BAND=5
|
FREQ_BAND=5
|
||||||
else
|
else
|
||||||
FREQ_BAND=2.4
|
FREQ_BAND=2.4
|
||||||
fi
|
fi
|
||||||
if [[ $WIFI_IFACE_CHANNEL -ne $CHANNEL ]]; then
|
|
||||||
if ( get_adapter_info ${IFACE} | grep "#channels <= 2" -q )
|
|
||||||
then
|
|
||||||
echo -e "\nmultiple channels supported"
|
|
||||||
else
|
|
||||||
echo -e "\nmultiple channels not supported",
|
|
||||||
echo -e "\nfallback to channel ${WIFI_IFACE_CHANNEL}"
|
|
||||||
CHANNEL=$WIFI_IFACE_CHANNEL
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "channel------------------ ${CHANNEL}"
|
|
||||||
fi
|
|
||||||
elif is_wifi_connected ${WIFI_IFACE} && [[ $FREQ_BAND_SET -eq 1 ]]; then
|
elif is_wifi_connected ${WIFI_IFACE} && [[ $FREQ_BAND_SET -eq 1 ]]; then
|
||||||
echo "Custom frequency band set with ${FREQ_BAND}Mhz with channel ${CHANNEL}"
|
echo "Custom frequency band set with ${FREQ_BAND}Mhz with channel ${CHANNEL}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If the access point channel is the same as the interface channel, do:
|
||||||
|
# - Make sure that the adapter support multiple channels
|
||||||
|
# - Otherwise fallback to the same interface channel
|
||||||
|
if [[ $WIFI_IFACE_CHANNEL -ne $CHANNEL ]]; then
|
||||||
|
if ( get_adapter_info ${IFACE} | grep "#channels <= 2" -q )
|
||||||
|
then
|
||||||
|
echo -e "\nmultiple channels supported"
|
||||||
|
else
|
||||||
|
echo -e "\nmultiple channels not supported",
|
||||||
|
echo -e "\nfallback to channel ${WIFI_IFACE_CHANNEL}"
|
||||||
|
CHANNEL=$WIFI_IFACE_CHANNEL
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "channel------------------ ${CHANNEL}"
|
||||||
|
fi
|
||||||
|
|
||||||
VIRTDIEMSG="Maybe your WiFi adapter does not fully support virtual interfaces.
|
VIRTDIEMSG="Maybe your WiFi adapter does not fully support virtual interfaces.
|
||||||
Try again with --no-virt."
|
Try again with --no-virt."
|
||||||
|
Loading…
Reference in New Issue
Block a user