software/drivers/sd8887/src/wlan/mlinux/moal_ioctl.c
/**
 * @brief  Set scan period function
 *
 * @param priv      A pointer to moal_private structure
 * @param buf       A pointer to scan command buf
 * @param length    buf length
 *
 * @return          MLAN_STATUS_SUCCESS -- success, otherwise fail
 */
@brief  Set scan period function
@param priv      A pointer to moal_private structure
@param buf       A pointer to scan command buf
@param length    buf length

@return          MLAN_STATUS_SUCCESS -- success, otherwise fail
@brief Set scan period function @param priv A pointer to moal_private structure @param buf A pointer to scan command buf @param length buf length @return MLAN_STATUS_SUCCESS -- success otherwise fail
int
woal_set_scan_cfg(moal_private *priv, char *buf, int length)
{
	mlan_status ret = MLAN_STATUS_SUCCESS;
	t_u8 *ptr = buf + NL80211_SCANCFG_HEADER_SIZE;
	int buf_left = length - NL80211_SCANCFG_HEADER_SIZE;
	t_u16 active_scan_time = 0;
	t_u16 passive_scan_time = 0;
	t_u16 specific_scan_time = 0;
	ENTER();
	while (buf_left >= 2) {
		switch (*ptr) {
		case NL80211_SCANCFG_ACTV_DWELL_SECTION:
			if (buf_left < 3) {
				PRINTM(MERROR,
				       "Invalid ACTV_DWELL_SECTION, buf_left=%d\n",
				       buf_left);
				buf_left = 0;
				break;
			}
			active_scan_time = ptr[2] << 8 | ptr[1];
			ptr += 3;
			buf_left -= 3;
			break;
		case NL80211_SCANCFG_PASV_DWELL_SECTION:
			if (buf_left < 3) {
				PRINTM(MERROR,
				       "Invalid PASV_DWELL_SECTION, buf_left=%d\n",
				       buf_left);
				buf_left = 0;
				break;
			}
			passive_scan_time = ptr[2] << 8 | ptr[1];
			ptr += 3;
			buf_left -= 3;
			break;
		case NL80211_SCANCFG_SPCF_DWELL_SECTION:
			if (buf_left < 3) {
				PRINTM(MERROR,
				       "Invalid SPCF_DWELL_SECTION, buf_left=%d\n",
				       buf_left);
				buf_left = 0;
				break;
			}
			specific_scan_time = ptr[2] << 8 | ptr[1];
			ptr += 3;
			buf_left -= 3;
			break;
		default:
			buf_left = 0;
			break;
		}
	}
	if (active_scan_time || passive_scan_time || specific_scan_time) {
		PRINTM(MIOCTL,
		       "Set active_scan_time= %d passive_scan_time=%d specific_scan_time=%d\n",
		       active_scan_time, passive_scan_time, specific_scan_time);
		if (MLAN_STATUS_FAILURE ==
		    woal_set_scan_time(priv, active_scan_time,
				       passive_scan_time, specific_scan_time)) {
			ret = -EFAULT;
		}
	}
	LEAVE();
	return ret;
}
int woal_set_scan_cfg ( moal_private * priv , char * buf , int length ) { mlan_status ret = MLAN_STATUS_SUCCESS ; t_u8 * ptr = buf + NL80211_SCANCFG_HEADER_SIZE ; int buf_left = length - NL80211_SCANCFG_HEADER_SIZE ; t_u16 active_scan_time = 0 ; t_u16 passive_scan_time = 0 ; t_u16 specific_scan_time = 0 ; ENTER ( ) ; while ( buf_left >= 2 ) { switch ( * ptr ) { case NL80211_SCANCFG_ACTV_DWELL_SECTION : if ( buf_left < 3 ) { PRINTM ( MERROR , " \n " , buf_left ) ; buf_left = 0 ; break ; } active_scan_time = ptr [ 2 ] << 8 | ptr [ 1 ] ; ptr += 3 ; buf_left -= 3 ; break ; case NL80211_SCANCFG_PASV_DWELL_SECTION : if ( buf_left < 3 ) { PRINTM ( MERROR , " \n " , buf_left ) ; buf_left = 0 ; break ; } passive_scan_time = ptr [ 2 ] << 8 | ptr [ 1 ] ; ptr += 3 ; buf_left -= 3 ; break ; case NL80211_SCANCFG_SPCF_DWELL_SECTION : if ( buf_left < 3 ) { PRINTM ( MERROR , " \n " , buf_left ) ; buf_left = 0 ; break ; } specific_scan_time = ptr [ 2 ] << 8 | ptr [ 1 ] ; ptr += 3 ; buf_left -= 3 ; break ; default : buf_left = 0 ; break ; } } if ( active_scan_time || passive_scan_time || specific_scan_time ) { PRINTM ( MIOCTL , " \n " , active_scan_time , passive_scan_time , specific_scan_time ) ; if ( MLAN_STATUS_FAILURE == woal_set_scan_time ( priv , active_scan_time , passive_scan_time , specific_scan_time ) ) { ret = - EFAULT ; } } LEAVE ( ) ; return ret ; }
@brief  Set scan period function
 @param priv      A pointer to moal_private structure
 @param buf       A pointer to scan command buf
 @param length    buf length
@brief Set scan period function @param priv A pointer to moal_private structure @param buf A pointer to scan command buf @param length buf length