mirror of
https://github.com/Mange/rtl8192eu-linux-driver
synced 2025-12-10 00:04:17 +00:00
Updated to v4.3.8_12406.20140929
This commit is contained in:
@@ -64,6 +64,9 @@ const char *android_wifi_cmd_str[ANDROID_WIFI_CMD_MAX] = {
|
||||
"P2P_GET_NOA",
|
||||
"P2P_SET_PS",
|
||||
"SET_AP_WPS_P2P_IE",
|
||||
|
||||
"MIRACAST",
|
||||
|
||||
#ifdef CONFIG_PNO_SUPPORT
|
||||
"PNOSSIDCLR",
|
||||
"PNOSETUP",
|
||||
@@ -135,17 +138,19 @@ char pno_in_example[] = {
|
||||
#endif /* PNO_SUPPORT */
|
||||
|
||||
typedef struct android_wifi_priv_cmd {
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
compat_uptr_t buf;
|
||||
#else
|
||||
char *buf;
|
||||
#endif
|
||||
|
||||
int used_len;
|
||||
int total_len;
|
||||
} android_wifi_priv_cmd;
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
typedef struct compat_android_wifi_priv_cmd {
|
||||
compat_uptr_t buf;
|
||||
int used_len;
|
||||
int total_len;
|
||||
} compat_android_wifi_priv_cmd;
|
||||
#endif /* CONFIG_COMPAT */
|
||||
|
||||
/**
|
||||
* Local (static) functions and variables
|
||||
*/
|
||||
@@ -438,6 +443,46 @@ int rtw_android_getband(struct net_device *net, char *command, int total_len)
|
||||
return bytes_written;
|
||||
}
|
||||
|
||||
enum {
|
||||
MIRACAST_DISABLED = 0,
|
||||
MIRACAST_SOURCE,
|
||||
MIRACAST_SINK,
|
||||
MIRACAST_INVALID,
|
||||
};
|
||||
|
||||
static const char *miracast_mode_str[] = {
|
||||
"DISABLED",
|
||||
"SOURCE",
|
||||
"SINK",
|
||||
"INVALID",
|
||||
};
|
||||
|
||||
static const char *get_miracast_mode_str(int mode)
|
||||
{
|
||||
if (mode < MIRACAST_DISABLED || mode >= MIRACAST_INVALID)
|
||||
mode = MIRACAST_INVALID;
|
||||
|
||||
return miracast_mode_str[mode];
|
||||
}
|
||||
|
||||
int rtw_android_set_miracast_mode(struct net_device *net, char *command, int total_len)
|
||||
{
|
||||
_adapter *adapter = (_adapter *)rtw_netdev_priv(net);
|
||||
char *arg = command + strlen(android_wifi_cmd_str[ANDROID_WIFI_CMD_MIRACAST]) + 1;
|
||||
u8 mode;
|
||||
int num;
|
||||
int ret = _FAIL;
|
||||
|
||||
num = sscanf(arg, "%hhu", &mode);
|
||||
|
||||
if (num >= 1) {
|
||||
DBG_871X("Miracast mode: %s(%u)\n", get_miracast_mode_str(mode), mode);
|
||||
ret = _SUCCESS;
|
||||
}
|
||||
|
||||
return (ret==_SUCCESS)?0:-1;
|
||||
}
|
||||
|
||||
int get_int_from_command( char* pcmd )
|
||||
{
|
||||
int i = 0;
|
||||
@@ -517,12 +562,27 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
|
||||
#ifdef CONFIG_WFD
|
||||
struct wifi_display_info *pwfd_info;
|
||||
#endif
|
||||
|
||||
rtw_lock_suspend();
|
||||
|
||||
if (!ifr->ifr_data) {
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
#ifdef CONFIG_COMPAT
|
||||
if (is_compat_task()) {
|
||||
/* 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;
|
||||
@@ -545,11 +605,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
|
||||
ret = -EFAULT;
|
||||
goto exit;
|
||||
}
|
||||
#ifdef CONFIG_COMPAT
|
||||
if (copy_from_user(command, compat_ptr(priv_cmd.buf), (unsigned long) priv_cmd.total_len)) {
|
||||
#else
|
||||
if (copy_from_user(command, (void *)priv_cmd.buf, priv_cmd.total_len)) {
|
||||
#endif
|
||||
ret = -EFAULT;
|
||||
goto exit;
|
||||
}
|
||||
@@ -652,7 +708,11 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
|
||||
case ANDROID_WIFI_CMD_GETBAND:
|
||||
bytes_written = rtw_android_getband(net, command, priv_cmd.total_len);
|
||||
break;
|
||||
|
||||
|
||||
case ANDROID_WIFI_CMD_MIRACAST:
|
||||
bytes_written = rtw_android_set_miracast_mode(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;
|
||||
@@ -728,12 +788,8 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
|
||||
pwfd_info = &padapter->wfd_info;
|
||||
if( padapter->wdinfo.driver_interface == DRIVER_CFG80211 )
|
||||
{
|
||||
#ifdef CONFIG_COMPAT
|
||||
pwfd_info->rtsp_ctrlport = ( u16 ) get_int_from_command( compat_ptr(priv_cmd.buf) );
|
||||
#else
|
||||
pwfd_info->rtsp_ctrlport = ( u16 ) get_int_from_command( priv_cmd.buf );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ANDROID_WIFI_CMD_WFD_SET_MAX_TPUT:
|
||||
@@ -748,12 +804,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
|
||||
pwfd_info = &padapter->wfd_info;
|
||||
if( padapter->wdinfo.driver_interface == DRIVER_CFG80211 )
|
||||
{
|
||||
#ifdef CONFIG_COMPAT
|
||||
pwfd_info->wfd_device_type = ( u8 ) get_int_from_command( compat_ptr(priv_cmd.buf) );
|
||||
#else
|
||||
pwfd_info->wfd_device_type = ( u8 ) get_int_from_command( priv_cmd.buf );
|
||||
#endif
|
||||
|
||||
pwfd_info->wfd_device_type &= WFD_DEVINFO_DUAL;
|
||||
}
|
||||
break;
|
||||
@@ -763,7 +814,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
|
||||
{
|
||||
#ifdef CONFIG_LPS
|
||||
u8 dtim;
|
||||
u8 *ptr = priv_cmd.buf;
|
||||
u8 *ptr =(u8 *) &priv_cmd.buf;
|
||||
|
||||
ptr += 9;//string command length of "SET_DTIM";
|
||||
|
||||
@@ -797,7 +848,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
|
||||
}
|
||||
#ifdef CONFIG_GTK_OL
|
||||
case ANDROID_WIFI_CMD_GTK_REKEY_OFFLOAD:
|
||||
rtw_gtk_offload(net, priv_cmd.buf);
|
||||
rtw_gtk_offload(net, (u8*)command);
|
||||
break;
|
||||
#endif //CONFIG_GTK_OL
|
||||
case ANDROID_WIFI_CMD_P2P_DISABLE:
|
||||
@@ -827,11 +878,7 @@ response:
|
||||
bytes_written++;
|
||||
}
|
||||
priv_cmd.used_len = bytes_written;
|
||||
#ifdef CONFIG_COMPAT
|
||||
if (copy_to_user(compat_ptr(priv_cmd.buf), command, bytes_written)) {
|
||||
#else
|
||||
if (copy_to_user((void *)priv_cmd.buf, command, bytes_written)) {
|
||||
#endif
|
||||
DBG_871X("%s: failed to copy data to user buffer\n", __FUNCTION__);
|
||||
ret = -EFAULT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user