Logo Search packages:      
Sourcecode: uaputl version File versions  Download package

void apcmd_sys_config ( int  argc,
char *  argv[] 
)

Creates a sys_config request and sends to the driver.

Usage: "Usage : sys_config [CONFIG_FILE]"

Parameters:
argcNumber of arguments
argvPointer to the arguments
Returns:
UAP_SUCCESS or UAP_FAILURE

Query AP's setting

Definition at line 3744 of file uaputl.c.

References apcmd_cfg_80211d(), APCMD_RESP_CHECK, apcmd_sys_config_profile(), APCMD_SYS_CONFIGURE, BUF_HEADER_SIZE, cmd_options, CMD_SUCCESS, MRVDRV_SIZE_OF_CMD_BUFFER, print_sys_config_usage(), print_tlv(), send_power_mode_ioctl(), UAP_FAILURE, uap_ioctl(), and UAP_SUCCESS.

{
    APCMDBUF_SYS_CONFIGURE *cmd_buf = NULL;
    u8 *buf = NULL;
    u16 cmd_len;
    u16 buf_len;
    int ret = UAP_FAILURE;
    int opt;
    char **argv_dummy;
    ps_mgmt pm;

    while ((opt = getopt_long(argc, argv, "+", cmd_options, NULL)) != -1) {
        switch (opt) {
        default:
            print_sys_config_usage();
            return;
        }
    }
    argc -= optind;
    argv += optind;

    /* Check arguments */
    if (argc > 1) {
        printf("ERR:Too many arguments.\n");
        print_sys_config_usage();
        return;
    }
    if (argc == 1) {
        /* Read profile and send command to firmware */
        apcmd_sys_config_profile(argc, argv);
        return;
    }

        /** Query AP's setting */
    buf_len = MRVDRV_SIZE_OF_CMD_BUFFER;

    /* alloc buf for command */
    buf = (u8 *) malloc(buf_len);

    if (!buf) {
        printf("ERR:Cannot allocate buffer from command!\n");
        return;
    }
    bzero((char *) buf, buf_len);

    /* Locate headers */
    cmd_len = sizeof(APCMDBUF_SYS_CONFIGURE);
    cmd_buf = (APCMDBUF_SYS_CONFIGURE *) buf;

    /* Fill the command buffer */
    cmd_buf->CmdCode = APCMD_SYS_CONFIGURE;
    cmd_buf->Size = cmd_len - BUF_HEADER_SIZE;
    cmd_buf->SeqNum = 0;
    cmd_buf->Result = 0;

    /* Send the command */
    ret = uap_ioctl((u8 *) cmd_buf, &cmd_len, buf_len);

    /* Process response */
    if (ret == UAP_SUCCESS) {
        /* Verify response */
        if (cmd_buf->CmdCode != (APCMD_SYS_CONFIGURE | APCMD_RESP_CHECK)) {
            printf("ERR:Corrupted response!\n");
            free(buf);
            return;
        }
        /* Print response */
        if (cmd_buf->Result == CMD_SUCCESS) {
            printf("AP settings:\n");
            print_tlv(buf + sizeof(APCMDBUF_SYS_CONFIGURE),
                      cmd_buf->Size - sizeof(APCMDBUF_SYS_CONFIGURE) +
                      BUF_HEADER_SIZE);
            printf("\n802.11D setting:\n");
            apcmd_cfg_80211d(1, argv_dummy);
        } else {
            printf("ERR:Could not retrieve system configure\n");
        }
    } else {
        printf("ERR:Command sending failed!\n");
    }
    free(buf);
    memset(&pm, 0, sizeof(ps_mgmt));
    send_power_mode_ioctl(&pm);
    return;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index