Skip to content

Commit 7ff3838

Browse files
D-Trivenicarlescufi
authored andcommitted
modules: wfa-qt: Clean up linux-specific code in P2P and WPS handlers
Remove unused linux-specific logic in the WPS and P2P handlers and add necessary functions to support P2P functionality. Signed-off-by: Triveni Danda <[email protected]>
1 parent 96a19da commit 7ff3838

File tree

2 files changed

+4
-52
lines changed

2 files changed

+4
-52
lines changed

modules/wfa-qt/src/indigo_api_callback_dut.c

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,32 +2153,9 @@ static int send_sta_btm_query_handler(struct packet_wrapper *req, struct packet_
21532153
#ifdef CONFIG_P2P
21542154
static int start_up_p2p_handler(struct packet_wrapper *req, struct packet_wrapper *resp)
21552155
{
2156-
char *message = TLV_VALUE_WPA_S_START_UP_NOT_OK;
2157-
char buffer[S_BUFFER_LEN];
2158-
int len, status = TLV_VALUE_STATUS_NOT_OK, ret;
2159-
2160-
/* TODO: Add functionality to stop Supplicant */
2161-
2162-
/* Generate P2P config file */
2163-
CHECK_SNPRINTF(buffer, sizeof(buffer), ret,
2164-
"ctrl_interface=%s\n", WPAS_CTRL_PATH_DEFAULT);
2165-
/* Add Device name and Device type */
2166-
strcat(buffer, "device_name=WFA P2P Device\n");
2167-
strcat(buffer, "device_type=1-0050F204-1\n");
2168-
/* Add config methods */
2169-
strcat(buffer, "config_methods=keypad display push_button\n");
2170-
len = strlen(buffer);
2171-
2172-
if (len) {
2173-
write_file(get_wpas_conf_file(), buffer, len);
2174-
}
2175-
2176-
/* Start WPA supplicant */
2177-
/* TODO: Add functionality to start Supplicant */
2156+
char *message = TLV_VALUE_WPA_S_START_UP_OK;
2157+
int status = TLV_VALUE_STATUS_OK;
21782158

2179-
status = TLV_VALUE_STATUS_OK;
2180-
message = TLV_VALUE_WPA_S_START_UP_OK;
2181-
done:
21822159
fill_wrapper_message_hdr(resp, API_CMD_RESPONSE, req->hdr.seq);
21832160
fill_wrapper_tlv_byte(resp, TLV_STATUS, status);
21842161
fill_wrapper_tlv_bytes(resp, TLV_MESSAGE, strlen(message), message);
@@ -2901,30 +2878,6 @@ static int start_wps_ap_handler(struct packet_wrapper *req, struct packet_wrappe
29012878
memset(pin_code, 0, sizeof(pin_code));
29022879
memcpy(pin_code, tlv->value, sizeof(pin_code));
29032880

2904-
/* Please implement the wsc pin validation function to
2905-
* identify the invalid PIN code and DONOT start wps.
2906-
*/
2907-
#define WPS_PIN_VALIDATION_FILE "/tmp/pin_checksum.sh"
2908-
int len = 0;
2909-
char pipebuf[S_BUFFER_LEN];
2910-
static const char * const parameter[] = {"sh",
2911-
WPS_PIN_VALIDATION_FILE,
2912-
pin_code, NULL};
2913-
2914-
memset(pipebuf, 0, sizeof(pipebuf));
2915-
if (access(WPS_PIN_VALIDATION_FILE, F_OK) == 0) {
2916-
len = pipe_command(pipebuf, sizeof(pipebuf), "/bin/sh", parameter);
2917-
if (len && atoi(pipebuf)) {
2918-
indigo_logger(LOG_LEVEL_INFO, "Valid PIN Code: %s", pin_code);
2919-
} else {
2920-
indigo_logger(LOG_LEVEL_INFO, "Invalid PIN Code: %s", pin_code);
2921-
message = TLV_VALUE_AP_WSC_PIN_CODE_NOT_OK;
2922-
goto done;
2923-
}
2924-
}
2925-
/*
2926-
* End of wsc pin validation function
2927-
*/
29282881
CHECK_SNPRINTF(buffer, sizeof(buffer), ret, "WPS_PIN any %s", pin_code);
29292882
} else {
29302883
CHECK_SNPRINTF(buffer, sizeof(buffer), ret, "WPS_PBC");

modules/wfa-qt/src/vendor_specific_dut.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,13 @@ int get_p2p_mac_addr(char *mac_addr, size_t size)
6565
/* Get the name of P2P Group(GO or Client) interface */
6666
int get_p2p_group_if(char *if_name, size_t size)
6767
{
68-
/*TODO: Implement this for zephyr */
69-
68+
snprintf(if_name, size, "%s", get_wireless_interface());
7069
return 0;
7170
}
7271

7372
int get_p2p_dev_if(char *if_name, size_t size)
7473
{
75-
/*TODO: Implement this for zephyr */
74+
snprintf(if_name, size, "%s", get_wireless_interface());
7675

7776
return 0;
7877
}

0 commit comments

Comments
 (0)