mirror of
https://github.com/aircrack-ng/rtl8812au.git
synced 2025-01-03 21:04:05 +00:00
Trying another channel switching code
This commit is contained in:
parent
54710f5403
commit
aaef1baf31
@ -3939,12 +3939,12 @@ int value;
|
|||||||
value = dbm;
|
value = dbm;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (value < 0)
|
if (value < 0) {
|
||||||
value = 0;
|
value = 0;
|
||||||
|
}
|
||||||
if (value > 40)
|
if (value > 40) {
|
||||||
value = 40;
|
value = 40;
|
||||||
|
}
|
||||||
if (type == NL80211_TX_POWER_FIXED) {
|
if (type == NL80211_TX_POWER_FIXED) {
|
||||||
pHalData->CurrentTxPwrIdx = value;
|
pHalData->CurrentTxPwrIdx = value;
|
||||||
rtw_hal_set_tx_power_level(padapter, pHalData->current_channel);
|
rtw_hal_set_tx_power_level(padapter, pHalData->current_channel);
|
||||||
@ -5710,104 +5710,48 @@ static int cfg80211_rtw_set_channel(struct wiphy *wiphy
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
|
/* TODO: 160 MHz bandwidth */
|
||||||
, struct cfg80211_chan_def *chandef
|
static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy, struct cfg80211_chan_def *chandef)
|
||||||
#else
|
|
||||||
, struct ieee80211_channel *chan
|
|
||||||
, enum nl80211_channel_type channel_type
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
|
int chan_target = (u8) ieee80211_frequency_to_channel(chandef->chan->center_freq);
|
||||||
struct ieee80211_channel *chan = chandef->chan;
|
int chan_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
||||||
#endif
|
int chan_width = CHANNEL_WIDTH_20;
|
||||||
|
|
||||||
_adapter *padapter = wiphy_to_adapter(wiphy);
|
_adapter *padapter = wiphy_to_adapter(wiphy);
|
||||||
int target_channal = chan->hw_value;
|
|
||||||
int target_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
|
||||||
int target_width = CHANNEL_WIDTH_20;
|
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
|
|
||||||
#ifdef CONFIG_DEBUG_CFG80211
|
|
||||||
RTW_INFO("center_freq %u Mhz ch %u width %u freq1 %u freq2 %u\n"
|
|
||||||
, chan->center_freq
|
|
||||||
, chan->hw_value
|
|
||||||
, chandef->width
|
|
||||||
, chandef->center_freq1
|
|
||||||
, chandef->center_freq2);
|
|
||||||
#endif /* CONFIG_DEBUG_CFG80211 */
|
|
||||||
|
|
||||||
switch (chandef->width) {
|
switch (chandef->width) {
|
||||||
case NL80211_CHAN_WIDTH_20_NOHT:
|
case NL80211_CHAN_WIDTH_20_NOHT:
|
||||||
case NL80211_CHAN_WIDTH_20:
|
case NL80211_CHAN_WIDTH_20:
|
||||||
target_width = CHANNEL_WIDTH_20;
|
chan_width = CHANNEL_WIDTH_20;
|
||||||
target_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
chan_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
||||||
break;
|
break;
|
||||||
case NL80211_CHAN_WIDTH_40:
|
case NL80211_CHAN_WIDTH_40:
|
||||||
target_width = CHANNEL_WIDTH_40;
|
chan_width = CHANNEL_WIDTH_40;
|
||||||
if (chandef->center_freq1 > chan->center_freq)
|
if (chandef->center_freq1 > chandef->chan->center_freq)
|
||||||
target_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
|
chan_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
|
||||||
else
|
else
|
||||||
target_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
|
chan_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
|
||||||
break;
|
break;
|
||||||
case NL80211_CHAN_WIDTH_80:
|
case NL80211_CHAN_WIDTH_80:
|
||||||
target_width = CHANNEL_WIDTH_80;
|
chan_width = CHANNEL_WIDTH_80;
|
||||||
target_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
if (chandef->center_freq1 > chandef->chan->center_freq)
|
||||||
break;
|
chan_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
|
||||||
case NL80211_CHAN_WIDTH_80P80:
|
else
|
||||||
target_width = CHANNEL_WIDTH_80_80;
|
chan_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
|
||||||
target_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
|
||||||
break;
|
|
||||||
case NL80211_CHAN_WIDTH_160:
|
|
||||||
target_width = CHANNEL_WIDTH_160;
|
|
||||||
target_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0))
|
|
||||||
case NL80211_CHAN_WIDTH_5:
|
|
||||||
case NL80211_CHAN_WIDTH_10:
|
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
target_width = CHANNEL_WIDTH_20;
|
|
||||||
target_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#ifdef CONFIG_DEBUG_CFG80211
|
|
||||||
RTW_INFO("center_freq %u Mhz ch %u channel_type %u\n"
|
|
||||||
, chan->center_freq
|
|
||||||
, chan->hw_value
|
|
||||||
, channel_type);
|
|
||||||
#endif /* CONFIG_DEBUG_CFG80211 */
|
|
||||||
|
|
||||||
switch (channel_type) {
|
|
||||||
case NL80211_CHAN_NO_HT:
|
|
||||||
case NL80211_CHAN_HT20:
|
|
||||||
target_width = CHANNEL_WIDTH_20;
|
|
||||||
target_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
|
||||||
break;
|
|
||||||
case NL80211_CHAN_HT40MINUS:
|
|
||||||
target_width = CHANNEL_WIDTH_40;
|
|
||||||
target_offset = HAL_PRIME_CHNL_OFFSET_UPPER;
|
|
||||||
break;
|
|
||||||
case NL80211_CHAN_HT40PLUS:
|
|
||||||
target_width = CHANNEL_WIDTH_40;
|
|
||||||
target_offset = HAL_PRIME_CHNL_OFFSET_LOWER;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
target_width = CHANNEL_WIDTH_20;
|
chan_width = CHANNEL_WIDTH_20;
|
||||||
target_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
chan_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
RTW_INFO(FUNC_ADPT_FMT" ch:%d bw:%d, offset:%d\n"
|
|
||||||
, FUNC_ADPT_ARG(padapter), target_channal, target_width, target_offset);
|
|
||||||
|
|
||||||
rtw_set_chbw_cmd(padapter, target_channal, target_width, target_offset, RTW_CMDF_WAIT_ACK);
|
|
||||||
|
|
||||||
|
set_channel_bwmode(padapter, chan_target, chan_offset, chan_width);
|
||||||
|
RTW_INFO("%s : %d %d %d\n", __func__, chan_target, chan_offset, chan_width);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int cfg80211_rtw_auth(struct wiphy *wiphy, struct net_device *ndev,
|
static int cfg80211_rtw_auth(struct wiphy *wiphy, struct net_device *ndev,
|
||||||
struct cfg80211_auth_request *req)
|
struct cfg80211_auth_request *req)
|
||||||
@ -9514,6 +9458,9 @@ static struct cfg80211_ops rtw_cfg80211_ops = {
|
|||||||
.set_pmksa = cfg80211_rtw_set_pmksa,
|
.set_pmksa = cfg80211_rtw_set_pmksa,
|
||||||
.del_pmksa = cfg80211_rtw_del_pmksa,
|
.del_pmksa = cfg80211_rtw_del_pmksa,
|
||||||
.flush_pmksa = cfg80211_rtw_flush_pmksa,
|
.flush_pmksa = cfg80211_rtw_flush_pmksa,
|
||||||
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
|
||||||
|
.set_monitor_channel = cfg80211_rtw_set_monitor_channel,
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_AP_MODE
|
#ifdef CONFIG_AP_MODE
|
||||||
.add_virtual_intf = cfg80211_rtw_add_virtual_intf,
|
.add_virtual_intf = cfg80211_rtw_add_virtual_intf,
|
||||||
|
Loading…
Reference in New Issue
Block a user