Skip to content

Commit

Permalink
QuickTrack R2.1 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kntseng committed Dec 1, 2022
1 parent a1f2691 commit ef8229a
Show file tree
Hide file tree
Showing 8 changed files with 257 additions and 54 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ TYPE = laptop
# Role is dut or platform
ROLE = dut
# Package Version
APP_VERSION = "2.0.0"
VERSION = ""

OBJS = main.o eloop.o indigo_api.o indigo_packet.o utils.o wpa_ctrl.o
Expand Down
7 changes: 7 additions & 0 deletions indigo_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@ struct indigo_tlv indigo_tlv_list[] = {
{ TLV_WPS_INDEPENDENT, "WPS_INDEPENDENT" },
{ TLV_LOCAL_PWR_CONST, "LOCAL_PWR_CONST" },
{ TLV_SPECTRUM_MGMT_REQ, "SPECTRUM_MGMT_REQ" },
{ TLV_CAPTURE_FILE, "CAPTURE_FILE" },
{ TLV_CAPTURE_FILTER, "CAPTURE_FILTER" },
{ TLV_CAPTURE_INFILE, "CAPTURE_INFILE" },
{ TLV_CAPTURE_OUTFILE, "CAPTURE_OUTFILE" },
{ TLV_TP_IP_ADDRESS, "TP_IP_ADDRESS" },
{ TLV_WPS_ER_SUPPORT, "WPS_ER_SUPPORT" },
{ TLV_ADDITIONAL_TEST_PLATFORM_ID, "ADDITIONAL_TEST_PLATFORM_ID" },
};

/* Find the type of the API stucture by the ID from the list */
Expand Down
10 changes: 8 additions & 2 deletions indigo_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,13 @@ struct indigo_api {
#define TLV_WPS_INDEPENDENT 0x00d8
#define TLV_LOCAL_PWR_CONST 0x00d9
#define TLV_SPECTRUM_MGMT_REQ 0x00da
#define TLV_CAPTURE_FILE 0x00db
#define TLV_CAPTURE_FILTER 0x00dc
#define TLV_CAPTURE_INFILE 0x00dd
#define TLV_CAPTURE_OUTFILE 0x00de
#define TLV_TP_IP_ADDRESS 0x00df
#define TLV_WPS_ER_SUPPORT 0x00e0
#define TLV_ADDITIONAL_TEST_PLATFORM_ID 0x00e1

// class ResponseTLV
// List of TLV used in the QuickTrack API response and ACK messages from the DUT
Expand Down Expand Up @@ -304,8 +311,7 @@ struct indigo_api {
#define TLV_BAND_5GHZ "5GHz"
#define TLV_BAND_6GHZ "6GHz"

#define TLV_VALUE_APP_VERSION "v2.0"
#define TLV_VALUE_TEST_PLATFORM_APP_VERSION "v2.0"
#define TLV_VALUE_APP_VERSION "v2.1"
#define TLV_VALUE_OK "OK"
#define TLV_VALUE_NOT_OK "Failed"
#define TLV_VALUE_INSUFFICIENT_TLV "TLV is insufficient to run the command"
Expand Down
1 change: 0 additions & 1 deletion indigo_api_callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#define LOOPBACK_TIMEOUT 180


struct tlv_to_config_name {
unsigned short tlv_id;
char config_name[NAME_SIZE];
Expand Down
36 changes: 29 additions & 7 deletions indigo_api_callback_dut.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ void register_apis() {

static int get_control_app_handler(struct packet_wrapper *req, struct packet_wrapper *resp) {
char ipAddress[INET_ADDRSTRLEN];
char buffer[S_BUFFER_LEN];
#ifdef _VERSION_
snprintf(buffer, sizeof(buffer), "%s", _VERSION_);
#else
snprintf(buffer, sizeof(buffer), "%s", TLV_VALUE_APP_VERSION);
#endif
if (tool_addr) {
inet_ntop(AF_INET, &(tool_addr->sin_addr), ipAddress, INET_ADDRSTRLEN);
indigo_logger(LOG_LEVEL_DEBUG, "Tool Control IP address on DUT network path: %s", ipAddress);
Expand All @@ -100,7 +106,7 @@ static int get_control_app_handler(struct packet_wrapper *req, struct packet_wra
fill_wrapper_message_hdr(resp, API_CMD_RESPONSE, req->hdr.seq);
fill_wrapper_tlv_byte(resp, TLV_STATUS, TLV_VALUE_STATUS_OK);
fill_wrapper_tlv_bytes(resp, TLV_MESSAGE, strlen(TLV_VALUE_OK), TLV_VALUE_OK);
fill_wrapper_tlv_bytes(resp, TLV_CONTROL_APP_VERSION, strlen(TLV_VALUE_APP_VERSION), TLV_VALUE_APP_VERSION);
fill_wrapper_tlv_bytes(resp, TLV_CONTROL_APP_VERSION, strlen(buffer), buffer);
return 0;
}

Expand Down Expand Up @@ -449,6 +455,20 @@ static int generate_hostapd_config(char *output, int output_size, struct packet_
continue;
}

/* wps er support. upnp */
if (tlv->id == TLV_WPS_ER_SUPPORT) {
memset(cfg_item, 0, sizeof(cfg_item));
sprintf(cfg_item, "upnp_iface=%s\n", wlanp->ifname);
strcat(output, cfg_item);
memset(cfg_item, 0, sizeof(cfg_item));
sprintf(cfg_item, "friendly_name=WPS Access Point\n");
strcat(output, cfg_item);
memset(cfg_item, 0, sizeof(cfg_item));
sprintf(cfg_item, "model_description=Wireless Access Point\n");
strcat(output, cfg_item);
continue;
}

cfg = find_tlv_config(tlv->id);
if (!cfg) {
indigo_logger(LOG_LEVEL_ERROR, "Unknown AP configuration name: TLV ID 0x%04x", tlv->id);
Expand Down Expand Up @@ -639,6 +659,12 @@ static int generate_hostapd_config(char *output, int output_size, struct packet_
if (enable_ac == 0 && enable_ax == 0)
chwidth = 0;

/* Add country IE if there is no country config */
if (strlen(country) == 0) {
strcat(output, "ieee80211d=1\n");
strcat(output, "country_code=US\n");
}

if (is_6g_only) {
if (chwidthset == 0) {
sprintf(buffer, "he_oper_chwidth=%d\n", chwidth);
Expand All @@ -656,10 +682,8 @@ static int generate_hostapd_config(char *output, int output_size, struct packet_
} else {
strcat(output, "fils_discovery_max_interval=20\n");
}
/* Enable bss_color and country IE */
/* Enable bss_color IE */
strcat(output, "he_bss_color=19\n");
strcat(output, "ieee80211d=1\n");
strcat(output, "country_code=US\n");
} else if (strstr(band, "a")) {
if (is_ht40plus_chan(channel))
strcat(output, "ht_capab=[HT40+]\n");
Expand All @@ -671,9 +695,7 @@ static int generate_hostapd_config(char *output, int output_size, struct packet_
int center_freq = get_center_freq_index(channel, chwidth);
#ifndef _WTS_OPENWRT_
if (chwidth == 2) {
/* 160M: Need to enable 11h for DFS and enable 11d for 11h */
strcat(output, "ieee80211d=1\n");
strcat(output, "country_code=US\n");
/* 160M: Need to enable 11h for DFS */
strcat(output, "ieee80211h=1\n");
}
#endif
Expand Down
Loading

0 comments on commit ef8229a

Please sign in to comment.