software/drivers/sd8887/src/wlan/mapp/uaputl/uaputl.c
/**
 *  @brief Set/get cs_count configuration
 *  @param argc     Number of arguments
 *  @param argv     Pointer to the arguments
 *  @return         UAP_SUCCESS/UAP_FAILURE
 */
@brief Set/get cs_count configuration
@param argc     Number of arguments
@param argv     Pointer to the arguments
@return         UAP_SUCCESS/UAP_FAILURE
@brief Set / get cs_count configuration @param argc Number of arguments @param argv Pointer to the arguments @return UAP_SUCCESS / UAP_FAILURE
int
apcmd_cscount_cfg(int argc, char *argv[])
{
	int opt;
	cscount_cfg_t cscount_cfg;
	struct ifreq ifr;
	t_s32 sockfd;
	while ((opt = getopt_long(argc, argv, "+", cmd_options, NULL)) != -1) {
		switch (opt) {
		default:
			print_cscount_cfg_usage();
			return UAP_SUCCESS;
		}
	}
	argc -= optind;
	argv += optind;
	memset(&cscount_cfg, 0, sizeof(cscount_cfg));
	if (argc == 0) {
		cscount_cfg.action = ACTION_GET;
	} else if (argc == 1) {
		if ((t_u32)A2HEXDECIMAL(argv[0]) < 5
		    && (t_u32)A2HEXDECIMAL(argv[0]) > 20) {
			printf("ERR:Invalid Channel switch count value\n");
			return UAP_FAILURE;
		}
		cscount_cfg.action = ACTION_SET;
		cscount_cfg.cs_count = (t_u32)A2HEXDECIMAL(argv[0]);
	} else {
		print_cscount_cfg_usage();
		return UAP_FAILURE;
	}
	cscount_cfg.subcmd = UAP_CHAN_SWITCH_COUNT_CFG;
	if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
		printf("ERR:Cannot open socket\n");
		return UAP_FAILURE;
	}
	memset(&ifr, 0, sizeof(ifr));
	strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, IFNAMSIZ - 1);
	ifr.ifr_ifru.ifru_data = (void *)&cscount_cfg;
	errno = 0;
	if (ioctl(sockfd, UAP_IOCTL_CMD, &ifr)) {
		perror("");
		printf("ERR: Channel switch count configuration failed\n");
		close(sockfd);
		return UAP_FAILURE;
	}
	if (cscount_cfg.action == ACTION_GET) {
		printf("Channel Switch count = %d\n", cscount_cfg.cs_count);
	}
	close(sockfd);
	return UAP_SUCCESS;
}
int apcmd_cscount_cfg ( int argc , char * argv [ ] ) { int opt ; cscount_cfg_t cscount_cfg ; struct ifreq ifr ; t_s32 sockfd ; while ( ( opt = getopt_long ( argc , argv , " " , cmd_options , NULL ) ) != -1 ) { switch ( opt ) { default : print_cscount_cfg_usage ( ) ; return UAP_SUCCESS ; } } argc -= optind ; argv += optind ; memset ( & cscount_cfg , 0 , sizeof ( cscount_cfg ) ) ; if ( argc == 0 ) { cscount_cfg . action = ACTION_GET ; } else if ( argc == 1 ) { if ( ( t_u32 ) A2HEXDECIMAL ( argv [ 0 ] ) < 5 && ( t_u32 ) A2HEXDECIMAL ( argv [ 0 ] ) > 20 ) { printf ( " \n " ) ; return UAP_FAILURE ; } cscount_cfg . action = ACTION_SET ; cscount_cfg . cs_count = ( t_u32 ) A2HEXDECIMAL ( argv [ 0 ] ) ; } else { print_cscount_cfg_usage ( ) ; return UAP_FAILURE ; } cscount_cfg . subcmd = UAP_CHAN_SWITCH_COUNT_CFG ; if ( ( sockfd = socket ( AF_INET , SOCK_STREAM , 0 ) ) < 0 ) { printf ( " \n " ) ; return UAP_FAILURE ; } memset ( & ifr , 0 , sizeof ( ifr ) ) ; strncpy ( ifr . ifr_ifrn . ifrn_name , dev_name , IFNAMSIZ - 1 ) ; ifr . ifr_ifru . ifru_data = ( void * ) & cscount_cfg ; errno = 0 ; if ( ioctl ( sockfd , UAP_IOCTL_CMD , & ifr ) ) { perror ( " " ) ; printf ( " \n " ) ; close ( sockfd ) ; return UAP_FAILURE ; } if ( cscount_cfg . action == ACTION_GET ) { printf ( " \n " , cscount_cfg . cs_count ) ; } close ( sockfd ) ; return UAP_SUCCESS ; }
@brief Set/get cs_count configuration
  @param argc     Number of arguments
  @param argv     Pointer to the arguments
  @return         UAP_SUCCESS/UAP_FAILURE
@brief Set / get cs_count configuration @param argc Number of arguments @param argv Pointer to the arguments @return UAP_SUCCESS / UAP_FAILURE
/* Check arguments */ /* Open socket */ /* Initialize the ifr structure */ /* Perform ioctl */ /* Handle response */ /* Close socket */