In this post, I will explain and guide you on how to identify which wifi command is executed on your WICED device. This piece of information will be helpful when you observe a wifi command has failed on your WICED device.
I have seen many people who face the problem with Wifi command related issues on WICED devices such as Wifi command fails, does not return, etc.
Probably you can take this information and look around the code for that particular wifi command or you can take these data and ask help on Cypress community or Cypress WICED support team.
What are the differences between IOCTL or IOVAR wifi command on WICED:
Basically these are the commands sent from a host machine to the Cypress wifi controller with some information. Based on this information the wifi controller will process and execute accordingly.
An IOVAR command is identified by a string value.
And an IOCTL value is identified by an integer value.
Most importantly an IOVAR is sent as an IOCTL command with the command integer value as 262 (WLC_GET_VAR) or 263 (WLC_SET_VAR).
Following are two examples from WICED which use IOVAR and IOCTL wifi command:
The IOCTL integer value or the IOVAR string value is listed in the following header file on WICED SDK:
Wifi IOVAR command example on WICED:
wwd_sdpcm_get_iovar_buffer( &buffer, sizeof(wiced_mac_t), IOVAR_STR_CUR_ETHERADDR )
IOVAR_STR_CUR_ETHERADDR string value is “cur_etheraddr”
This is basically the get MAC address command for the wifi controller.
Wifi IOCTL command example on WICED:
wwd_sdpcm_send_ioctl( SDPCM_SET, WLC_SET_AUTH, buffer, 0, WWD_AP_INTERFACE )
WLC_SET_AUTH is the actual command whose integer value is set to 22.
How to print the wifi IOCTL command value on WICED:
wwd_sdpcm_send_ioctl is the function call where you have to add a print.
wwd_result_t wwd_sdpcm_send_ioctl( sdpcm_command_type_t type, uint32_t command, /*@[email protected]*/ wiced_buffer_t send_buffer_hnd, /*@[email protected]*/ /*@[email protected]*/ /*@[email protected]*/ wiced_buffer_t* response_buffer_hnd, wwd_interface_t interface ) /*@allocates *[email protected]*/ /*@defines **[email protected]*/
Go to the definition of wwd_sdpcm_send_ioctl function which is defined in WICED/WWD/internal/wwd_sdpcm.c file, and add a printf call to print the uint32_t command argument.
printf ("IOCTL Command %u", command);
You will not be able to get any info if this is an IOVAR command.
To get the IOVAR string info, you have to add a print at a different place. Read on.
How to print the wifi IOVAR command string on WICED:
For an IOVAR command, you will get the command value as either 262 or 263 but you will not get the exact command string information.
To print the exact IOVAR command string you need to add a print inside the wwd_sdpcm_get_iovar_buffer function call.
/*@[email protected]*/ /*@[email protected]*/ void* wwd_sdpcm_get_iovar_buffer( /*@[email protected]*/ /*@[email protected]*/ wiced_buffer_t* buffer, uint16_t data_length, const char* name ) /*@allocates *[email protected]*/ /*@defines **[email protected]*/
Add a printf statement inside the above function definition to print the const char* name argument.
something like this:
printf ("IOVAR Command %s", name);