mirror of
https://github.com/aircrack-ng/rtl8812au.git
synced 2024-12-27 08:28:36 +00:00
Fixed WiFi Direct in driver
This commit is contained in:
parent
548498f1d0
commit
619d992fe4
@ -171,7 +171,7 @@ void rtw_add_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *d
|
||||
u8 bmatch = _FALSE;
|
||||
u8 *pie = pnetwork->IEs;
|
||||
u8 *p = NULL, *dst_ie = NULL, *premainder_ie = NULL, *pbackup_remainder_ie = NULL;
|
||||
u32 i, offset, ielen, ie_offset, remainder_ielen = 0;
|
||||
u32 i, offset, ielen = 0, ie_offset, remainder_ielen = 0;
|
||||
|
||||
for (i = sizeof(NDIS_802_11_FIXED_IEs); i < pnetwork->IELength;) {
|
||||
pIE = (PNDIS_802_11_VARIABLE_IEs)(pnetwork->IEs + i);
|
||||
|
@ -4131,7 +4131,8 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l
|
||||
u8 action = P2P_PUB_ACTION_ACTION;
|
||||
u32 p2poui = cpu_to_be32(P2POUI);
|
||||
u8 oui_subtype = P2P_GO_NEGO_RESP;
|
||||
u8 wpsie[255] = { 0x00 }, p2pie[255] = { 0x00 };
|
||||
u8 *wpsie;
|
||||
u8 p2pie[ 255 ] = { 0x00 };
|
||||
u8 p2pielen = 0;
|
||||
uint wpsielen = 0;
|
||||
u16 wps_devicepassword_id = 0x0000;
|
||||
@ -4155,6 +4156,8 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l
|
||||
if (pmgntframe == NULL)
|
||||
return;
|
||||
|
||||
wpsie = rtw_zmalloc(256);
|
||||
|
||||
RTW_INFO("[%s] In, result = %d\n", __FUNCTION__, result);
|
||||
/* update attribute */
|
||||
pattrib = &pmgntframe->attrib;
|
||||
@ -4537,6 +4540,8 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l
|
||||
|
||||
dump_mgntframe(padapter, pmgntframe);
|
||||
|
||||
kfree(wpsie);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
@ -4597,8 +4602,6 @@ void issue_p2p_GO_confirm(_adapter *padapter, u8 *raddr, u8 result)
|
||||
pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen));
|
||||
pframe = rtw_set_fixed_ie(pframe, 1, &(pwdinfo->negotiation_dialog_token), &(pattrib->pktlen));
|
||||
|
||||
|
||||
|
||||
/* P2P IE Section. */
|
||||
|
||||
/* P2P OUI */
|
||||
|
@ -10578,3 +10578,4 @@ void rtw_cfg80211_dev_res_unregister(struct dvobj_priv *dvobj)
|
||||
}
|
||||
|
||||
#endif /* CONFIG_IOCTL_CFG80211 */
|
||||
|
||||
|
@ -11482,6 +11482,271 @@ static iw_handler rtw_handlers[] = {
|
||||
NULL, /*---hole---*/
|
||||
};
|
||||
|
||||
|
||||
static const struct iw_priv_args rtw_private_args[] = {
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x0,
|
||||
IW_PRIV_TYPE_CHAR | 0x7FF, 0, "write"
|
||||
},
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x1,
|
||||
IW_PRIV_TYPE_CHAR | 0x7FF,
|
||||
IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "read"
|
||||
},
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x2, 0, 0, "driver_ext"
|
||||
},
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x3, 0, 0, "mp_ioctl"
|
||||
},
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x4,
|
||||
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "apinfo"
|
||||
},
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x5,
|
||||
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "setpid"
|
||||
},
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x6,
|
||||
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wps_start"
|
||||
},
|
||||
/* for PLATFORM_MT53XX */
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x7,
|
||||
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "get_sensitivity"
|
||||
},
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x8,
|
||||
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wps_prob_req_ie"
|
||||
},
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x9,
|
||||
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wps_assoc_req_ie"
|
||||
},
|
||||
|
||||
/* for RTK_DMP_PLATFORM */
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0xA,
|
||||
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "channel_plan"
|
||||
},
|
||||
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0xB,
|
||||
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "dbg"
|
||||
},
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0xC,
|
||||
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0, "rfw"
|
||||
},
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0xD,
|
||||
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "rfr"
|
||||
},
|
||||
#if 0
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0xE, 0, 0, "wowlan_ctrl"
|
||||
},
|
||||
#endif
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x10,
|
||||
IW_PRIV_TYPE_CHAR | 1024, 0, "p2p_set"
|
||||
},
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x11,
|
||||
IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK , "p2p_get"
|
||||
},
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x12, 0, 0, "NULL"
|
||||
},
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x13,
|
||||
IW_PRIV_TYPE_CHAR | 64, IW_PRIV_TYPE_CHAR | 64 , "p2p_get2"
|
||||
},
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x14,
|
||||
IW_PRIV_TYPE_CHAR | 64, 0, "tdls"
|
||||
},
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x15,
|
||||
IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | 1024 , "tdls_get"
|
||||
},
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x16,
|
||||
IW_PRIV_TYPE_CHAR | 64, 0, "pm_set"
|
||||
},
|
||||
#ifdef CONFIG_RTW_80211K
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x17,
|
||||
IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | 1024 , "rrm"
|
||||
},
|
||||
#endif
|
||||
{SIOCIWFIRSTPRIV + 0x18, IW_PRIV_TYPE_CHAR | IFNAMSIZ , 0 , "rereg_nd_name"},
|
||||
#ifdef CONFIG_MP_INCLUDED
|
||||
{SIOCIWFIRSTPRIV + 0x1A, IW_PRIV_TYPE_CHAR | 1024, 0, "NULL"},
|
||||
{SIOCIWFIRSTPRIV + 0x1B, IW_PRIV_TYPE_CHAR | 128, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "NULL"},
|
||||
#else
|
||||
{SIOCIWFIRSTPRIV + 0x1A, IW_PRIV_TYPE_CHAR | 1024, 0, "NULL"},
|
||||
{SIOCIWFIRSTPRIV + 0x1B, IW_PRIV_TYPE_CHAR | 128, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "efuse_get"},
|
||||
#endif
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x1D,
|
||||
IW_PRIV_TYPE_CHAR | 40, IW_PRIV_TYPE_CHAR | 0x7FF, "test"
|
||||
},
|
||||
|
||||
#ifdef CONFIG_INTEL_WIDI
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x1E,
|
||||
IW_PRIV_TYPE_CHAR | 1024, 0, "widi_set"
|
||||
},
|
||||
{
|
||||
SIOCIWFIRSTPRIV + 0x1F,
|
||||
IW_PRIV_TYPE_CHAR | 128, 0, "widi_prob_req"
|
||||
},
|
||||
#endif /* CONFIG_INTEL_WIDI */
|
||||
|
||||
{ SIOCIWFIRSTPRIV + 0x0E, IW_PRIV_TYPE_CHAR | 1024, 0 , ""}, /* set */
|
||||
{ SIOCIWFIRSTPRIV + 0x0F, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK , ""},/* get
|
||||
* --- sub-ioctls definitions --- */
|
||||
|
||||
#ifdef CONFIG_APPEND_VENDOR_IE_ENABLE
|
||||
{ VENDOR_IE_SET, IW_PRIV_TYPE_CHAR | 1024 , 0 , "vendor_ie_set" },
|
||||
{ VENDOR_IE_GET, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "vendor_ie_get" },
|
||||
#endif
|
||||
#if defined(CONFIG_RTL8723B)
|
||||
{ MP_SetBT, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_setbt" },
|
||||
{ MP_DISABLE_BT_COEXIST, IW_PRIV_TYPE_CHAR | 1024, 0, "mp_disa_btcoex"},
|
||||
#endif
|
||||
#ifdef CONFIG_WOWLAN
|
||||
{ MP_WOW_ENABLE , IW_PRIV_TYPE_CHAR | 1024, 0, "wow_mode" },
|
||||
{ MP_WOW_SET_PATTERN , IW_PRIV_TYPE_CHAR | 1024, 0, "wow_set_pattern" },
|
||||
#endif
|
||||
#ifdef CONFIG_AP_WOWLAN
|
||||
{ MP_AP_WOW_ENABLE , IW_PRIV_TYPE_CHAR | 1024, 0, "ap_wow_mode" }, /* set */
|
||||
#endif
|
||||
#ifdef CONFIG_SDIO_INDIRECT_ACCESS
|
||||
{ MP_SD_IREAD, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "sd_iread" },
|
||||
{ MP_SD_IWRITE, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "sd_iwrite" },
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
static const struct iw_priv_args rtw_mp_private_args[] = {
|
||||
/* --- sub-ioctls definitions --- */
|
||||
#ifdef CONFIG_MP_INCLUDED
|
||||
{ MP_START , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_start" },
|
||||
{ MP_PHYPARA, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_phypara" },
|
||||
{ MP_STOP , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_stop" },
|
||||
{ MP_CHANNEL , IW_PRIV_TYPE_CHAR | 1024 , IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_channel" },
|
||||
{ MP_CHL_OFFSET , IW_PRIV_TYPE_CHAR | 1024 , IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_ch_offset" },
|
||||
{ MP_BANDWIDTH , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_bandwidth"},
|
||||
{ MP_RATE , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_rate" },
|
||||
{ MP_RESET_STATS , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_reset_stats"},
|
||||
{ MP_QUERY , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK , "mp_query"},
|
||||
{ READ_REG , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "read_reg" },
|
||||
{ MP_RATE , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_rate" },
|
||||
{ READ_RF , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "read_rf" },
|
||||
{ MP_PSD , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_psd"},
|
||||
{ MP_DUMP, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_dump" },
|
||||
{ MP_TXPOWER , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_txpower"},
|
||||
{ MP_ANT_TX , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_ant_tx"},
|
||||
{ MP_ANT_RX , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_ant_rx"},
|
||||
{ WRITE_REG , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "write_reg" },
|
||||
{ WRITE_RF , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "write_rf" },
|
||||
{ MP_CTX , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_ctx"},
|
||||
{ MP_ARX , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_arx"},
|
||||
{ MP_THER , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_ther"},
|
||||
{ EFUSE_SET, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "efuse_set" },
|
||||
{ EFUSE_GET, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "efuse_get" },
|
||||
{ MP_PWRTRK , IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_pwrtrk"},
|
||||
{ MP_QueryDrvStats, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_drvquery" },
|
||||
{ MP_IOCTL, IW_PRIV_TYPE_CHAR | 1024, 0, "mp_ioctl"},
|
||||
{ MP_SetRFPathSwh, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_setrfpath" },
|
||||
{ MP_PwrCtlDM, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_pwrctldm" },
|
||||
{ MP_GET_TXPOWER_INX, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_get_txpower" },
|
||||
{ MP_GETVER, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_priv_ver" },
|
||||
{ MP_MON, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_mon" },
|
||||
{ EFUSE_MASK, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "efuse_mask" },
|
||||
{ EFUSE_FILE, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "efuse_file" },
|
||||
{ MP_TX, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_tx" },
|
||||
{ MP_RX, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_rx" },
|
||||
{ MP_HW_TX_MODE, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_hxtx" },
|
||||
{ MP_PWRLMT, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_pwrlmt" },
|
||||
{ MP_PWRBYRATE, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_pwrbyrate" },
|
||||
{ CTA_TEST, IW_PRIV_TYPE_CHAR | 1024, 0, "cta_test"},
|
||||
{ MP_IQK, IW_PRIV_TYPE_CHAR | 1024, 0, "mp_iqk"},
|
||||
{ MP_LCK, IW_PRIV_TYPE_CHAR | 1024, 0, "mp_lck"},
|
||||
{ BT_EFUSE_FILE, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "bt_efuse_file" },
|
||||
{ MP_SWRFPath, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_swrfpath" },
|
||||
#ifdef CONFIG_RTW_CUSTOMER_STR
|
||||
{ MP_CUSTOMER_STR, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "customer_str" },
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_MP_INCLUDED */
|
||||
};
|
||||
|
||||
static iw_handler rtw_private_handler[] = {
|
||||
rtw_wx_write32, /* 0x00 */
|
||||
rtw_wx_read32, /* 0x01 */
|
||||
NULL, /* 0x02 */
|
||||
#ifdef MP_IOCTL_HDL
|
||||
rtw_mp_ioctl_hdl, /* 0x03 */
|
||||
#else
|
||||
rtw_wx_priv_null,
|
||||
#endif
|
||||
/* for MM DTV platform */
|
||||
rtw_get_ap_info, /* 0x04 */
|
||||
|
||||
rtw_set_pid, /* 0x05 */
|
||||
rtw_wps_start, /* 0x06 */
|
||||
|
||||
/* for PLATFORM_MT53XX */
|
||||
rtw_wx_get_sensitivity, /* 0x07 */
|
||||
rtw_wx_set_mtk_wps_probe_ie, /* 0x08 */
|
||||
rtw_wx_set_mtk_wps_ie, /* 0x09 */
|
||||
|
||||
/* for RTK_DMP_PLATFORM
|
||||
* Set Channel depend on the country code */
|
||||
rtw_wx_set_channel_plan, /* 0x0A */
|
||||
|
||||
rtw_dbg_port, /* 0x0B */
|
||||
rtw_wx_write_rf, /* 0x0C */
|
||||
rtw_wx_read_rf, /* 0x0D */
|
||||
|
||||
//rtw_priv_set, /*0x0E*/
|
||||
//rtw_priv_get, /*0x0F*/
|
||||
|
||||
rtw_p2p_set, /* 0x10 */
|
||||
rtw_p2p_get, /* 0x11 */
|
||||
NULL, /* 0x12 */
|
||||
rtw_p2p_get2, /* 0x13 */
|
||||
|
||||
rtw_tdls, /* 0x14 */
|
||||
rtw_tdls_get, /* 0x15 */
|
||||
|
||||
rtw_pm_set, /* 0x16 */
|
||||
#ifdef CONFIG_RTW_80211K
|
||||
rtw_wx_priv_rrm, /* 0x17 */
|
||||
#else
|
||||
rtw_wx_priv_null, /* 0x17 */
|
||||
#endif
|
||||
rtw_rereg_nd_name, /* 0x18 */
|
||||
rtw_wx_priv_null, /* 0x19 */
|
||||
#ifdef CONFIG_MP_INCLUDED
|
||||
rtw_wx_priv_null, /* 0x1A */
|
||||
rtw_wx_priv_null, /* 0x1B */
|
||||
#else
|
||||
rtw_wx_priv_null, /* 0x1A */
|
||||
rtw_mp_efuse_get, /* 0x1B */
|
||||
#endif
|
||||
NULL, /* 0x1C is reserved for hostapd */
|
||||
rtw_test, /* 0x1D */
|
||||
#ifdef CONFIG_INTEL_WIDI
|
||||
rtw_widi_set, /* 0x1E */
|
||||
rtw_widi_set_probe_request, /* 0x1F */
|
||||
#endif /* CONFIG_INTEL_WIDI */
|
||||
};
|
||||
|
||||
#if WIRELESS_EXT >= 17
|
||||
static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev)
|
||||
{
|
||||
@ -11542,12 +11807,453 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev)
|
||||
struct iw_handler_def rtw_handlers_def = {
|
||||
.standard = rtw_handlers,
|
||||
.num_standard = sizeof(rtw_handlers) / sizeof(iw_handler),
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)) || defined(CONFIG_WEXT_PRIV)
|
||||
.private = rtw_private_handler,
|
||||
.private_args = (struct iw_priv_args *)rtw_private_args,
|
||||
.num_private = sizeof(rtw_private_handler) / sizeof(iw_handler),
|
||||
.num_private_args = sizeof(rtw_private_args) / sizeof(struct iw_priv_args),
|
||||
#endif
|
||||
#if WIRELESS_EXT >= 17
|
||||
.get_wireless_stats = rtw_get_wireless_stats,
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
/* copy from net/wireless/wext.c start
|
||||
* ----------------------------------------------------------------
|
||||
*
|
||||
* Calculate size of private arguments
|
||||
*/
|
||||
static const char iw_priv_type_size[] = {
|
||||
0, /* IW_PRIV_TYPE_NONE */
|
||||
1, /* IW_PRIV_TYPE_BYTE */
|
||||
1, /* IW_PRIV_TYPE_CHAR */
|
||||
0, /* Not defined */
|
||||
sizeof(__u32), /* IW_PRIV_TYPE_INT */
|
||||
sizeof(struct iw_freq), /* IW_PRIV_TYPE_FLOAT */
|
||||
sizeof(struct sockaddr), /* IW_PRIV_TYPE_ADDR */
|
||||
0, /* Not defined */
|
||||
};
|
||||
|
||||
static int get_priv_size(__u16 args)
|
||||
{
|
||||
int num = args & IW_PRIV_SIZE_MASK;
|
||||
int type = (args & IW_PRIV_TYPE_MASK) >> 12;
|
||||
|
||||
return num * iw_priv_type_size[type];
|
||||
}
|
||||
/* copy from net/wireless/wext.c end */
|
||||
|
||||
|
||||
static int _rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_data)
|
||||
{
|
||||
int err = 0;
|
||||
u8 *input = NULL;
|
||||
u32 input_len = 0;
|
||||
const char delim[] = " ";
|
||||
u8 *output = NULL;
|
||||
u32 output_len = 0;
|
||||
u32 count = 0;
|
||||
u8 *buffer = NULL;
|
||||
u32 buffer_len = 0;
|
||||
char *ptr = NULL;
|
||||
u8 cmdname[17] = {0}; /* IFNAMSIZ+1 */
|
||||
u32 cmdlen;
|
||||
s32 len;
|
||||
u8 *extra = NULL;
|
||||
u32 extra_size = 0;
|
||||
|
||||
s32 k;
|
||||
const iw_handler *priv; /* Private ioctl */
|
||||
const struct iw_priv_args *priv_args; /* Private ioctl description */
|
||||
const struct iw_priv_args *mp_priv_args; /*MP Private ioctl description */
|
||||
const struct iw_priv_args *sel_priv_args; /*Selected Private ioctl description */
|
||||
u32 num_priv; /* Number of ioctl */
|
||||
u32 num_priv_args; /* Number of descriptions */
|
||||
u32 num_mp_priv_args; /*Number of MP descriptions */
|
||||
u32 num_sel_priv_args; /*Number of Selected descriptions */
|
||||
iw_handler handler;
|
||||
int temp;
|
||||
int subcmd = 0; /* sub-ioctl index */
|
||||
int offset = 0; /* Space for sub-ioctl index */
|
||||
|
||||
union iwreq_data wdata;
|
||||
|
||||
_rtw_memcpy(&wdata, wrq_data, sizeof(wdata));
|
||||
|
||||
input_len = wdata.data.length;
|
||||
if (!input_len)
|
||||
return -EINVAL;
|
||||
input = rtw_zmalloc(input_len);
|
||||
if (NULL == input)
|
||||
return -ENOMEM;
|
||||
if (copy_from_user(input, wdata.data.pointer, input_len)) {
|
||||
err = -EFAULT;
|
||||
goto exit;
|
||||
}
|
||||
input[input_len - 1] = '\0';
|
||||
ptr = input;
|
||||
len = input_len;
|
||||
|
||||
if (ptr == NULL) {
|
||||
err = -EOPNOTSUPP;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
sscanf(ptr, "%16s", cmdname);
|
||||
cmdlen = strlen(cmdname);
|
||||
RTW_INFO("%s: cmd=%s\n", __func__, cmdname);
|
||||
|
||||
/* skip command string */
|
||||
if (cmdlen > 0)
|
||||
cmdlen += 1; /* skip one space */
|
||||
ptr += cmdlen;
|
||||
len -= cmdlen;
|
||||
RTW_INFO("%s: parameters=%s\n", __func__, ptr);
|
||||
|
||||
priv = rtw_private_handler;
|
||||
priv_args = rtw_private_args;
|
||||
mp_priv_args = rtw_mp_private_args;
|
||||
num_priv = sizeof(rtw_private_handler) / sizeof(iw_handler);
|
||||
num_priv_args = sizeof(rtw_private_args) / sizeof(struct iw_priv_args);
|
||||
num_mp_priv_args = sizeof(rtw_mp_private_args) / sizeof(struct iw_priv_args);
|
||||
|
||||
if (num_priv_args == 0) {
|
||||
err = -EOPNOTSUPP;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Search the correct ioctl */
|
||||
k = -1;
|
||||
sel_priv_args = priv_args;
|
||||
num_sel_priv_args = num_priv_args;
|
||||
while
|
||||
((++k < num_sel_priv_args) && strcmp(sel_priv_args[k].name, cmdname))
|
||||
;
|
||||
|
||||
/* If not found... */
|
||||
if (k == num_sel_priv_args) {
|
||||
k = -1;
|
||||
sel_priv_args = mp_priv_args;
|
||||
num_sel_priv_args = num_mp_priv_args;
|
||||
while
|
||||
((++k < num_sel_priv_args) && strcmp(sel_priv_args[k].name, cmdname))
|
||||
;
|
||||
|
||||
if (k == num_sel_priv_args) {
|
||||
err = -EOPNOTSUPP;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
/* Watch out for sub-ioctls ! */
|
||||
if (sel_priv_args[k].cmd < SIOCDEVPRIVATE) {
|
||||
int j = -1;
|
||||
|
||||
/* Find the matching *real* ioctl */
|
||||
while ((++j < num_priv_args) && ((priv_args[j].name[0] != '\0') ||
|
||||
(priv_args[j].set_args != sel_priv_args[k].set_args) ||
|
||||
(priv_args[j].get_args != sel_priv_args[k].get_args)))
|
||||
;
|
||||
|
||||
/* If not found... */
|
||||
if (j == num_priv_args) {
|
||||
err = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Save sub-ioctl number */
|
||||
subcmd = sel_priv_args[k].cmd;
|
||||
/* Reserve one int (simplify alignment issues) */
|
||||
offset = sizeof(__u32);
|
||||
/* Use real ioctl definition from now on */
|
||||
k = j;
|
||||
}
|
||||
|
||||
buffer = rtw_zmalloc(4096);
|
||||
if (NULL == buffer) {
|
||||
err = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (k >= num_priv_args) {
|
||||
err = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* If we have to set some data */
|
||||
if ((priv_args[k].set_args & IW_PRIV_TYPE_MASK) &&
|
||||
(priv_args[k].set_args & IW_PRIV_SIZE_MASK)) {
|
||||
u8 *str;
|
||||
|
||||
switch (priv_args[k].set_args & IW_PRIV_TYPE_MASK) {
|
||||
case IW_PRIV_TYPE_BYTE:
|
||||
/* Fetch args */
|
||||
count = 0;
|
||||
do {
|
||||
str = strsep(&ptr, delim);
|
||||
if (NULL == str)
|
||||
break;
|
||||
sscanf(str, "%i", &temp);
|
||||
buffer[count++] = (u8)temp;
|
||||
} while (1);
|
||||
buffer_len = count;
|
||||
|
||||
/* Number of args to fetch */
|
||||
wdata.data.length = count;
|
||||
if (wdata.data.length > (priv_args[k].set_args & IW_PRIV_SIZE_MASK))
|
||||
wdata.data.length = priv_args[k].set_args & IW_PRIV_SIZE_MASK;
|
||||
|
||||
break;
|
||||
|
||||
case IW_PRIV_TYPE_INT:
|
||||
/* Fetch args */
|
||||
count = 0;
|
||||
do {
|
||||
str = strsep(&ptr, delim);
|
||||
if (NULL == str)
|
||||
break;
|
||||
sscanf(str, "%i", &temp);
|
||||
((s32 *)buffer)[count++] = (s32)temp;
|
||||
} while (1);
|
||||
buffer_len = count * sizeof(s32);
|
||||
|
||||
/* Number of args to fetch */
|
||||
wdata.data.length = count;
|
||||
if (wdata.data.length > (priv_args[k].set_args & IW_PRIV_SIZE_MASK))
|
||||
wdata.data.length = priv_args[k].set_args & IW_PRIV_SIZE_MASK;
|
||||
|
||||
break;
|
||||
|
||||
case IW_PRIV_TYPE_CHAR:
|
||||
if (len > 0) {
|
||||
/* Size of the string to fetch */
|
||||
wdata.data.length = len;
|
||||
if (wdata.data.length > (priv_args[k].set_args & IW_PRIV_SIZE_MASK))
|
||||
wdata.data.length = priv_args[k].set_args & IW_PRIV_SIZE_MASK;
|
||||
|
||||
/* Fetch string */
|
||||
_rtw_memcpy(buffer, ptr, wdata.data.length);
|
||||
} else {
|
||||
wdata.data.length = 1;
|
||||
buffer[0] = '\0';
|
||||
}
|
||||
buffer_len = wdata.data.length;
|
||||
break;
|
||||
|
||||
default:
|
||||
RTW_INFO("%s: Not yet implemented...\n", __func__);
|
||||
err = -1;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if ((priv_args[k].set_args & IW_PRIV_SIZE_FIXED) &&
|
||||
(wdata.data.length != (priv_args[k].set_args & IW_PRIV_SIZE_MASK))) {
|
||||
RTW_INFO("%s: The command %s needs exactly %d argument(s)...\n",
|
||||
__func__, cmdname, priv_args[k].set_args & IW_PRIV_SIZE_MASK);
|
||||
err = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
} /* if args to set */
|
||||
else
|
||||
wdata.data.length = 0L;
|
||||
|
||||
/* Those two tests are important. They define how the driver
|
||||
* will have to handle the data */
|
||||
if ((priv_args[k].set_args & IW_PRIV_SIZE_FIXED) &&
|
||||
((get_priv_size(priv_args[k].set_args) + offset) <= IFNAMSIZ)) {
|
||||
/* First case : all SET args fit within wrq */
|
||||
if (offset)
|
||||
wdata.mode = subcmd;
|
||||
_rtw_memcpy(wdata.name + offset, buffer, IFNAMSIZ - offset);
|
||||
} else {
|
||||
if ((priv_args[k].set_args == 0) &&
|
||||
(priv_args[k].get_args & IW_PRIV_SIZE_FIXED) &&
|
||||
(get_priv_size(priv_args[k].get_args) <= IFNAMSIZ)) {
|
||||
/* Second case : no SET args, GET args fit within wrq */
|
||||
if (offset)
|
||||
wdata.mode = subcmd;
|
||||
} else {
|
||||
/* Third case : args won't fit in wrq, or variable number of args */
|
||||
if (copy_to_user(wdata.data.pointer, buffer, buffer_len)) {
|
||||
err = -EFAULT;
|
||||
goto exit;
|
||||
}
|
||||
wdata.data.flags = subcmd;
|
||||
}
|
||||
}
|
||||
|
||||
rtw_mfree(input, input_len);
|
||||
input = NULL;
|
||||
|
||||
extra_size = 0;
|
||||
if (IW_IS_SET(priv_args[k].cmd)) {
|
||||
/* Size of set arguments */
|
||||
extra_size = get_priv_size(priv_args[k].set_args);
|
||||
|
||||
/* Does it fits in iwr ? */
|
||||
if ((priv_args[k].set_args & IW_PRIV_SIZE_FIXED) &&
|
||||
((extra_size + offset) <= IFNAMSIZ))
|
||||
extra_size = 0;
|
||||
} else {
|
||||
/* Size of get arguments */
|
||||
extra_size = get_priv_size(priv_args[k].get_args);
|
||||
|
||||
/* Does it fits in iwr ? */
|
||||
if ((priv_args[k].get_args & IW_PRIV_SIZE_FIXED) &&
|
||||
(extra_size <= IFNAMSIZ))
|
||||
extra_size = 0;
|
||||
}
|
||||
|
||||
if (extra_size == 0) {
|
||||
extra = (u8 *)&wdata;
|
||||
rtw_mfree(buffer, 4096);
|
||||
buffer = NULL;
|
||||
} else
|
||||
extra = buffer;
|
||||
|
||||
handler = priv[priv_args[k].cmd - SIOCIWFIRSTPRIV];
|
||||
err = handler(dev, NULL, &wdata, extra);
|
||||
|
||||
/* If we have to get some data */
|
||||
if ((priv_args[k].get_args & IW_PRIV_TYPE_MASK) &&
|
||||
(priv_args[k].get_args & IW_PRIV_SIZE_MASK)) {
|
||||
int j;
|
||||
int n = 0; /* number of args */
|
||||
u8 str[20] = {0};
|
||||
|
||||
/* Check where is the returned data */
|
||||
if ((priv_args[k].get_args & IW_PRIV_SIZE_FIXED) &&
|
||||
(get_priv_size(priv_args[k].get_args) <= IFNAMSIZ))
|
||||
n = priv_args[k].get_args & IW_PRIV_SIZE_MASK;
|
||||
else
|
||||
n = wdata.data.length;
|
||||
|
||||
output = rtw_zmalloc(4096);
|
||||
if (NULL == output) {
|
||||
err = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
switch (priv_args[k].get_args & IW_PRIV_TYPE_MASK) {
|
||||
case IW_PRIV_TYPE_BYTE:
|
||||
/* Display args */
|
||||
for (j = 0; j < n; j++) {
|
||||
sprintf(str, "%d ", extra[j]);
|
||||
len = strlen(str);
|
||||
output_len = strlen(output);
|
||||
if ((output_len + len + 1) > 4096) {
|
||||
err = -E2BIG;
|
||||
goto exit;
|
||||
}
|
||||
_rtw_memcpy(output + output_len, str, len);
|
||||
}
|
||||
break;
|
||||
|
||||
case IW_PRIV_TYPE_INT:
|
||||
/* Display args */
|
||||
for (j = 0; j < n; j++) {
|
||||
sprintf(str, "%d ", ((__s32 *)extra)[j]);
|
||||
len = strlen(str);
|
||||
output_len = strlen(output);
|
||||
if ((output_len + len + 1) > 4096) {
|
||||
err = -E2BIG;
|
||||
goto exit;
|
||||
}
|
||||
_rtw_memcpy(output + output_len, str, len);
|
||||
}
|
||||
break;
|
||||
|
||||
case IW_PRIV_TYPE_CHAR:
|
||||
/* Display args */
|
||||
_rtw_memcpy(output, extra, n);
|
||||
break;
|
||||
|
||||
default:
|
||||
RTW_INFO("%s: Not yet implemented...\n", __func__);
|
||||
err = -1;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
output_len = strlen(output) + 1;
|
||||
wrq_data->data.length = output_len;
|
||||
if (copy_to_user(wrq_data->data.pointer, output, output_len)) {
|
||||
err = -EFAULT;
|
||||
goto exit;
|
||||
}
|
||||
} /* if args to set */
|
||||
else
|
||||
wrq_data->data.length = 0;
|
||||
|
||||
exit:
|
||||
if (input)
|
||||
rtw_mfree(input, input_len);
|
||||
if (buffer)
|
||||
rtw_mfree(buffer, 4096);
|
||||
if (output)
|
||||
rtw_mfree(output, 4096);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
static int rtw_ioctl_compat_wext_private(struct net_device *dev, struct ifreq *rq)
|
||||
{
|
||||
struct compat_iw_point iwp_compat;
|
||||
union iwreq_data wrq_data;
|
||||
int err = 0;
|
||||
RTW_INFO("%s:...\n", __func__);
|
||||
if (copy_from_user(&iwp_compat, rq->ifr_ifru.ifru_data, sizeof(struct compat_iw_point)))
|
||||
return -EFAULT;
|
||||
|
||||
wrq_data.data.pointer = compat_ptr(iwp_compat.pointer);
|
||||
wrq_data.data.length = iwp_compat.length;
|
||||
wrq_data.data.flags = iwp_compat.flags;
|
||||
|
||||
err = _rtw_ioctl_wext_private(dev, &wrq_data);
|
||||
|
||||
iwp_compat.pointer = ptr_to_compat(wrq_data.data.pointer);
|
||||
iwp_compat.length = wrq_data.data.length;
|
||||
iwp_compat.flags = wrq_data.data.flags;
|
||||
if (copy_to_user(rq->ifr_ifru.ifru_data, &iwp_compat, sizeof(struct compat_iw_point)))
|
||||
return -EFAULT;
|
||||
|
||||
return err;
|
||||
}
|
||||
#endif /* CONFIG_COMPAT */
|
||||
|
||||
static int rtw_ioctl_standard_wext_private(struct net_device *dev, struct ifreq *rq)
|
||||
{
|
||||
struct iw_point *iwp;
|
||||
union iwreq_data wrq_data;
|
||||
int err = 0;
|
||||
iwp = &wrq_data.data;
|
||||
RTW_INFO("%s:...\n", __func__);
|
||||
if (copy_from_user(iwp, rq->ifr_ifru.ifru_data, sizeof(struct iw_point)))
|
||||
return -EFAULT;
|
||||
|
||||
err = _rtw_ioctl_wext_private(dev, &wrq_data);
|
||||
|
||||
if (copy_to_user(rq->ifr_ifru.ifru_data, iwp, sizeof(struct iw_point)))
|
||||
return -EFAULT;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int rtw_ioctl_wext_private(struct net_device *dev, struct ifreq *rq)
|
||||
{
|
||||
#ifdef CONFIG_COMPAT
|
||||
#if (KERNEL_VERSION(4, 6, 0) > LINUX_VERSION_CODE)
|
||||
if (is_compat_task())
|
||||
#else
|
||||
if (in_compat_syscall())
|
||||
#endif
|
||||
return rtw_ioctl_compat_wext_private(dev, rq);
|
||||
else
|
||||
#endif /* CONFIG_COMPAT */
|
||||
return rtw_ioctl_standard_wext_private(dev, rq);
|
||||
}
|
||||
|
||||
int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
{
|
||||
struct iwreq *wrq = (struct iwreq *)rq;
|
||||
@ -11567,6 +12273,12 @@ int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
break;
|
||||
#endif
|
||||
#endif /* CONFIG_AP_MODE */
|
||||
case SIOCDEVPRIVATE:
|
||||
ret = rtw_ioctl_wext_private(dev, rq);
|
||||
break;
|
||||
case (SIOCDEVPRIVATE+1):
|
||||
ret = rtw_android_priv_cmd(dev, rq, cmd);
|
||||
break;
|
||||
default:
|
||||
ret = -EOPNOTSUPP;
|
||||
break;
|
||||
|
12268
os_dep/linux/ioctl_linux.c.orig
Normal file
12268
os_dep/linux/ioctl_linux.c.orig
Normal file
File diff suppressed because it is too large
Load Diff
@ -596,6 +596,389 @@ exit:
|
||||
}
|
||||
#endif /* CONFIG_RTW_MESH_AEK */
|
||||
|
||||
int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
|
||||
{
|
||||
#define PRIVATE_COMMAND_MAX_LEN 8192
|
||||
int ret = 0;
|
||||
char *command = NULL;
|
||||
int cmd_num;
|
||||
int bytes_written = 0;
|
||||
#ifdef CONFIG_PNO_SUPPORT
|
||||
uint cmdlen = 0;
|
||||
uint pno_enable = 0;
|
||||
#endif
|
||||
android_wifi_priv_cmd priv_cmd;
|
||||
_adapter *padapter = (_adapter *) rtw_netdev_priv(net);
|
||||
#ifdef CONFIG_WFD
|
||||
struct wifi_display_info *pwfd_info;
|
||||
#endif
|
||||
|
||||
rtw_lock_suspend();
|
||||
|
||||
if (!ifr->ifr_data) {
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
if (padapter->registrypriv.mp_mode == 1) {
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
#ifdef CONFIG_COMPAT
|
||||
#if (KERNEL_VERSION(4, 6, 0) > LINUX_VERSION_CODE)
|
||||
if (is_compat_task()) {
|
||||
#else
|
||||
if (in_compat_syscall()) {
|
||||
#endif
|
||||
/* User space is 32-bit, use compat ioctl */
|
||||
compat_android_wifi_priv_cmd compat_priv_cmd;
|
||||
|
||||
if (copy_from_user(&compat_priv_cmd, ifr->ifr_data, sizeof(compat_android_wifi_priv_cmd))) {
|
||||
ret = -EFAULT;
|
||||
goto exit;
|
||||
}
|
||||
priv_cmd.buf = compat_ptr(compat_priv_cmd.buf);
|
||||
priv_cmd.used_len = compat_priv_cmd.used_len;
|
||||
priv_cmd.total_len = compat_priv_cmd.total_len;
|
||||
} else
|
||||
#endif /* CONFIG_COMPAT */
|
||||
if (copy_from_user(&priv_cmd, ifr->ifr_data, sizeof(android_wifi_priv_cmd))) {
|
||||
ret = -EFAULT;
|
||||
goto exit;
|
||||
}
|
||||
if (padapter->registrypriv.mp_mode == 1) {
|
||||
ret = -EFAULT;
|
||||
goto exit;
|
||||
}
|
||||
/*RTW_INFO("%s priv_cmd.buf=%p priv_cmd.total_len=%d priv_cmd.used_len=%d\n",__func__,priv_cmd.buf,priv_cmd.total_len,priv_cmd.used_len);*/
|
||||
if (priv_cmd.total_len > PRIVATE_COMMAND_MAX_LEN || priv_cmd.total_len < 0) {
|
||||
RTW_WARN("%s: invalid private command (%d)\n", __FUNCTION__,
|
||||
priv_cmd.total_len);
|
||||
ret = -EFAULT;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
command = rtw_zmalloc(priv_cmd.total_len+1);
|
||||
if (!command) {
|
||||
RTW_INFO("%s: failed to allocate memory\n", __FUNCTION__);
|
||||
ret = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0))
|
||||
if (!access_ok(priv_cmd.buf, priv_cmd.total_len)) {
|
||||
#else
|
||||
if (!access_ok(VERIFY_READ, priv_cmd.buf, priv_cmd.total_len)) {
|
||||
#endif
|
||||
RTW_INFO("%s: failed to access memory\n", __FUNCTION__);
|
||||
ret = -EFAULT;
|
||||
goto exit;
|
||||
}
|
||||
if (copy_from_user(command, (void *)priv_cmd.buf, priv_cmd.total_len)) {
|
||||
ret = -EFAULT;
|
||||
goto exit;
|
||||
}
|
||||
command[priv_cmd.total_len] = '\0';
|
||||
RTW_INFO("%s: Android private cmd \"%s\" on %s\n"
|
||||
, __FUNCTION__, command, ifr->ifr_name);
|
||||
|
||||
cmd_num = rtw_android_cmdstr_to_num(command);
|
||||
|
||||
switch (cmd_num) {
|
||||
case ANDROID_WIFI_CMD_START:
|
||||
/* bytes_written = wl_android_wifi_on(net); */
|
||||
goto response;
|
||||
case ANDROID_WIFI_CMD_SETFWPATH:
|
||||
goto response;
|
||||
}
|
||||
|
||||
if (!g_wifi_on) {
|
||||
RTW_INFO("%s: Ignore private cmd \"%s\" - iface %s is down\n"
|
||||
, __FUNCTION__, command, ifr->ifr_name);
|
||||
ret = 0;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!hal_chk_wl_func(padapter, WL_FUNC_MIRACAST)) {
|
||||
switch (cmd_num) {
|
||||
case ANDROID_WIFI_CMD_WFD_ENABLE:
|
||||
case ANDROID_WIFI_CMD_WFD_DISABLE:
|
||||
case ANDROID_WIFI_CMD_WFD_SET_TCPPORT:
|
||||
case ANDROID_WIFI_CMD_WFD_SET_MAX_TPUT:
|
||||
case ANDROID_WIFI_CMD_WFD_SET_DEVTYPE:
|
||||
goto response;
|
||||
}
|
||||
}
|
||||
|
||||
switch (cmd_num) {
|
||||
|
||||
case ANDROID_WIFI_CMD_STOP:
|
||||
/* bytes_written = wl_android_wifi_off(net); */
|
||||
break;
|
||||
|
||||
case ANDROID_WIFI_CMD_SCAN_ACTIVE:
|
||||
/* rtw_set_scan_mode((_adapter *)rtw_netdev_priv(net), SCAN_ACTIVE); */
|
||||
#ifdef CONFIG_PLATFORM_MSTAR
|
||||
#ifdef CONFIG_IOCTL_CFG80211
|
||||
adapter_wdev_data((_adapter *)rtw_netdev_priv(net))->bandroid_scan = _TRUE;
|
||||
#endif /* CONFIG_IOCTL_CFG80211 */
|
||||
#endif /* CONFIG_PLATFORM_MSTAR */
|
||||
break;
|
||||
case ANDROID_WIFI_CMD_SCAN_PASSIVE:
|
||||
/* rtw_set_scan_mode((_adapter *)rtw_netdev_priv(net), SCAN_PASSIVE); */
|
||||
break;
|
||||
|
||||
case ANDROID_WIFI_CMD_RSSI:
|
||||
bytes_written = rtw_android_get_rssi(net, command, priv_cmd.total_len);
|
||||
break;
|
||||
case ANDROID_WIFI_CMD_LINKSPEED:
|
||||
bytes_written = rtw_android_get_link_speed(net, command, priv_cmd.total_len);
|
||||
break;
|
||||
|
||||
case ANDROID_WIFI_CMD_MACADDR:
|
||||
bytes_written = rtw_android_get_macaddr(net, command, priv_cmd.total_len);
|
||||
break;
|
||||
|
||||
case ANDROID_WIFI_CMD_BLOCK_SCAN:
|
||||
bytes_written = rtw_android_set_block_scan(net, command, priv_cmd.total_len);
|
||||
break;
|
||||
|
||||
case ANDROID_WIFI_CMD_BLOCK:
|
||||
bytes_written = rtw_android_set_block(net, command, priv_cmd.total_len);
|
||||
break;
|
||||
|
||||
case ANDROID_WIFI_CMD_RXFILTER_START:
|
||||
/* bytes_written = net_os_set_packet_filter(net, 1); */
|
||||
break;
|
||||
case ANDROID_WIFI_CMD_RXFILTER_STOP:
|
||||
/* bytes_written = net_os_set_packet_filter(net, 0); */
|
||||
break;
|
||||
case ANDROID_WIFI_CMD_RXFILTER_ADD:
|
||||
/* int filter_num = *(command + strlen(CMD_RXFILTER_ADD) + 1) - '0'; */
|
||||
/* bytes_written = net_os_rxfilter_add_remove(net, TRUE, filter_num); */
|
||||
break;
|
||||
case ANDROID_WIFI_CMD_RXFILTER_REMOVE:
|
||||
/* int filter_num = *(command + strlen(CMD_RXFILTER_REMOVE) + 1) - '0'; */
|
||||
/* bytes_written = net_os_rxfilter_add_remove(net, FALSE, filter_num); */
|
||||
break;
|
||||
|
||||
case ANDROID_WIFI_CMD_BTCOEXSCAN_START:
|
||||
/* TBD: BTCOEXSCAN-START */
|
||||
break;
|
||||
case ANDROID_WIFI_CMD_BTCOEXSCAN_STOP:
|
||||
/* TBD: BTCOEXSCAN-STOP */
|
||||
break;
|
||||
case ANDROID_WIFI_CMD_BTCOEXMODE:
|
||||
#if 0
|
||||
uint mode = *(command + strlen(CMD_BTCOEXMODE) + 1) - '0';
|
||||
if (mode == 1)
|
||||
net_os_set_packet_filter(net, 0); /* DHCP starts */
|
||||
else
|
||||
net_os_set_packet_filter(net, 1); /* DHCP ends */
|
||||
#ifdef WL_CFG80211
|
||||
bytes_written = wl_cfg80211_set_btcoex_dhcp(net, command);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
|
||||
case ANDROID_WIFI_CMD_SETSUSPENDMODE:
|
||||
break;
|
||||
|
||||
case ANDROID_WIFI_CMD_SETSUSPENDOPT:
|
||||
/* bytes_written = wl_android_set_suspendopt(net, command, priv_cmd.total_len); */
|
||||
break;
|
||||
|
||||
case ANDROID_WIFI_CMD_SETBAND:
|
||||
bytes_written = rtw_android_setband(net, command, priv_cmd.total_len);
|
||||
break;
|
||||
|
||||
case ANDROID_WIFI_CMD_GETBAND:
|
||||
bytes_written = rtw_android_getband(net, command, priv_cmd.total_len);
|
||||
break;
|
||||
|
||||
case ANDROID_WIFI_CMD_COUNTRY:
|
||||
bytes_written = rtw_android_set_country(net, command, priv_cmd.total_len);
|
||||
break;
|
||||
|
||||
#ifdef CONFIG_PNO_SUPPORT
|
||||
case ANDROID_WIFI_CMD_PNOSSIDCLR_SET:
|
||||
/* bytes_written = dhd_dev_pno_reset(net); */
|
||||
break;
|
||||
case ANDROID_WIFI_CMD_PNOSETUP_SET:
|
||||
bytes_written = rtw_android_pno_setup(net, command, priv_cmd.total_len);
|
||||
break;
|
||||
case ANDROID_WIFI_CMD_PNOENABLE_SET:
|
||||
cmdlen = strlen(android_wifi_cmd_str[ANDROID_WIFI_CMD_PNOENABLE_SET]);
|
||||
pno_enable = *(command + cmdlen + 1) - '0';
|
||||
bytes_written = rtw_android_pno_enable(net, pno_enable);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ANDROID_WIFI_CMD_P2P_DEV_ADDR:
|
||||
bytes_written = rtw_android_get_p2p_dev_addr(net, command, priv_cmd.total_len);
|
||||
break;
|
||||
case ANDROID_WIFI_CMD_P2P_SET_NOA:
|
||||
/* int skip = strlen(CMD_P2P_SET_NOA) + 1; */
|
||||
/* bytes_written = wl_cfg80211_set_p2p_noa(net, command + skip, priv_cmd.total_len - skip); */
|
||||
break;
|
||||
case ANDROID_WIFI_CMD_P2P_GET_NOA:
|
||||
/* bytes_written = wl_cfg80211_get_p2p_noa(net, command, priv_cmd.total_len); */
|
||||
break;
|
||||
case ANDROID_WIFI_CMD_P2P_SET_PS:
|
||||
/* int skip = strlen(CMD_P2P_SET_PS) + 1; */
|
||||
/* bytes_written = wl_cfg80211_set_p2p_ps(net, command + skip, priv_cmd.total_len - skip); */
|
||||
break;
|
||||
|
||||
#ifdef CONFIG_IOCTL_CFG80211
|
||||
case ANDROID_WIFI_CMD_SET_AP_WPS_P2P_IE: {
|
||||
int skip = strlen(android_wifi_cmd_str[ANDROID_WIFI_CMD_SET_AP_WPS_P2P_IE]) + 3;
|
||||
bytes_written = rtw_cfg80211_set_mgnt_wpsp2pie(net, command + skip, priv_cmd.total_len - skip, *(command + skip - 2) - '0');
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_IOCTL_CFG80211 */
|
||||
|
||||
#ifdef CONFIG_WFD
|
||||
|
||||
case ANDROID_WIFI_CMD_MIRACAST:
|
||||
bytes_written = rtw_android_set_miracast_mode(net, command, priv_cmd.total_len);
|
||||
break;
|
||||
|
||||
case ANDROID_WIFI_CMD_WFD_ENABLE: {
|
||||
/* Commented by Albert 2012/07/24 */
|
||||
/* We can enable the WFD function by using the following command: */
|
||||
/* wpa_cli driver wfd-enable */
|
||||
|
||||
if (padapter->wdinfo.driver_interface == DRIVER_CFG80211)
|
||||
rtw_wfd_enable(padapter, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
case ANDROID_WIFI_CMD_WFD_DISABLE: {
|
||||
/* Commented by Albert 2012/07/24 */
|
||||
/* We can disable the WFD function by using the following command: */
|
||||
/* wpa_cli driver wfd-disable */
|
||||
|
||||
if (padapter->wdinfo.driver_interface == DRIVER_CFG80211)
|
||||
rtw_wfd_enable(padapter, 0);
|
||||
break;
|
||||
}
|
||||
case ANDROID_WIFI_CMD_WFD_SET_TCPPORT: {
|
||||
/* Commented by Albert 2012/07/24 */
|
||||
/* We can set the tcp port number by using the following command: */
|
||||
/* wpa_cli driver wfd-set-tcpport = 554 */
|
||||
|
||||
if (padapter->wdinfo.driver_interface == DRIVER_CFG80211)
|
||||
rtw_wfd_set_ctrl_port(padapter, (u16)get_int_from_command(command));
|
||||
break;
|
||||
}
|
||||
case ANDROID_WIFI_CMD_WFD_SET_MAX_TPUT: {
|
||||
break;
|
||||
}
|
||||
case ANDROID_WIFI_CMD_WFD_SET_DEVTYPE: {
|
||||
/* Commented by Albert 2012/08/28 */
|
||||
/* Specify the WFD device type ( WFD source/primary sink ) */
|
||||
|
||||
pwfd_info = &padapter->wfd_info;
|
||||
if (padapter->wdinfo.driver_interface == DRIVER_CFG80211) {
|
||||
pwfd_info->wfd_device_type = (u8) get_int_from_command(command);
|
||||
pwfd_info->wfd_device_type &= WFD_DEVINFO_DUAL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case ANDROID_WIFI_CMD_CHANGE_DTIM: {
|
||||
#ifdef CONFIG_LPS
|
||||
u8 dtim;
|
||||
u8 *ptr = (u8 *) command;
|
||||
|
||||
ptr += 9;/* string command length of "SET_DTIM"; */
|
||||
|
||||
dtim = rtw_atoi(ptr);
|
||||
|
||||
RTW_INFO("DTIM=%d\n", dtim);
|
||||
|
||||
rtw_lps_change_dtim_cmd(padapter, dtim);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
#if CONFIG_RTW_MACADDR_ACL
|
||||
case ANDROID_WIFI_CMD_HOSTAPD_SET_MACADDR_ACL: {
|
||||
rtw_set_macaddr_acl(padapter, RTW_ACL_PERIOD_BSS, get_int_from_command(command));
|
||||
break;
|
||||
}
|
||||
case ANDROID_WIFI_CMD_HOSTAPD_ACL_ADD_STA: {
|
||||
u8 addr[ETH_ALEN] = {0x00};
|
||||
macstr2num(addr, command + strlen("HOSTAPD_ACL_ADD_STA") + 3); /* 3 is space bar + "=" + space bar these 3 chars */
|
||||
rtw_acl_add_sta(padapter, RTW_ACL_PERIOD_BSS, addr);
|
||||
break;
|
||||
}
|
||||
case ANDROID_WIFI_CMD_HOSTAPD_ACL_REMOVE_STA: {
|
||||
u8 addr[ETH_ALEN] = {0x00};
|
||||
macstr2num(addr, command + strlen("HOSTAPD_ACL_REMOVE_STA") + 3); /* 3 is space bar + "=" + space bar these 3 chars */
|
||||
rtw_acl_remove_sta(padapter, RTW_ACL_PERIOD_BSS, addr);
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_RTW_MACADDR_ACL */
|
||||
#if defined(CONFIG_GTK_OL) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0))
|
||||
case ANDROID_WIFI_CMD_GTK_REKEY_OFFLOAD:
|
||||
rtw_gtk_offload(net, (u8 *)command);
|
||||
break;
|
||||
#endif /* CONFIG_GTK_OL */
|
||||
case ANDROID_WIFI_CMD_P2P_DISABLE: {
|
||||
#ifdef CONFIG_P2P
|
||||
rtw_p2p_enable(padapter, P2P_ROLE_DISABLE);
|
||||
#endif /* CONFIG_P2P */
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RTW_MESH_AEK
|
||||
case ANDROID_WIFI_CMD_SET_AEK:
|
||||
bytes_written = rtw_android_set_aek(net, command, priv_cmd.total_len);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ANDROID_WIFI_CMD_EXT_AUTH_STATUS: {
|
||||
rtw_set_external_auth_status(padapter,
|
||||
command + strlen("EXT_AUTH_STATUS "),
|
||||
priv_cmd.total_len - strlen("EXT_AUTH_STATUS "));
|
||||
break;
|
||||
}
|
||||
case ANDROID_WIFI_CMD_DRIVERVERSION: {
|
||||
bytes_written = strlen(DRIVERVERSION);
|
||||
snprintf(command, bytes_written + 1, DRIVERVERSION);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
RTW_INFO("Unknown PRIVATE command %s - ignored\n", command);
|
||||
snprintf(command, 3, "OK");
|
||||
bytes_written = strlen("OK");
|
||||
}
|
||||
|
||||
response:
|
||||
if (bytes_written >= 0) {
|
||||
if ((bytes_written == 0) && (priv_cmd.total_len > 0))
|
||||
command[0] = '\0';
|
||||
if (bytes_written >= priv_cmd.total_len) {
|
||||
RTW_INFO("%s: bytes_written = %d\n", __FUNCTION__, bytes_written);
|
||||
bytes_written = priv_cmd.total_len;
|
||||
} else
|
||||
bytes_written++;
|
||||
priv_cmd.used_len = bytes_written;
|
||||
if (copy_to_user((void *)priv_cmd.buf, command, bytes_written)) {
|
||||
RTW_INFO("%s: failed to copy data to user buffer\n", __FUNCTION__);
|
||||
ret = -EFAULT;
|
||||
}
|
||||
} else
|
||||
ret = bytes_written;
|
||||
|
||||
exit:
|
||||
rtw_unlock_suspend();
|
||||
if (command)
|
||||
rtw_mfree(command, priv_cmd.total_len);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Functions for Android WiFi card detection
|
||||
*/
|
||||
|
0
tools/WiFi_Direct_User_Interface/install.sh
Normal file → Executable file
0
tools/WiFi_Direct_User_Interface/install.sh
Normal file → Executable file
Loading…
Reference in New Issue
Block a user