forked from qca/sigma-dut
-
Notifications
You must be signed in to change notification settings - Fork 0
/
powerswitch.c
52 lines (42 loc) · 1.24 KB
/
powerswitch.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Sigma Control API DUT (station/AP)
* Copyright (c) 2010, Atheros Communications, Inc.
* Copyright (c) 2019, The Linux Foundation
* All Rights Reserved.
* Licensed under the Clear BSD license. See README for more details.
*/
#include "sigma_dut.h"
static enum sigma_cmd_result cmd_power_switch_ctrl(struct sigma_dut *dut,
struct sigma_conn *conn,
struct sigma_cmd *cmd)
{
return SUCCESS_SEND_STATUS;
}
static enum sigma_cmd_result cmd_power_switch_reset(struct sigma_dut *dut,
struct sigma_conn *conn,
struct sigma_cmd *cmd)
{
if (system("killall hostapd") == 0) {
int i;
/* Wait some time to allow hostapd to complete cleanup before
* starting a new process */
for (i = 0; i < 10; i++) {
usleep(500000);
if (system("pidof hostapd") != 0)
break;
}
}
return SUCCESS_SEND_STATUS;
}
static enum sigma_cmd_result cmd_powerswitch(struct sigma_dut *dut,
struct sigma_conn *conn,
struct sigma_cmd *cmd)
{
return SUCCESS_SEND_STATUS;
}
void powerswitch_register_cmds(void)
{
sigma_dut_reg_cmd("power_switch_ctrl", NULL, cmd_power_switch_ctrl);
sigma_dut_reg_cmd("power_switch_reset", NULL, cmd_power_switch_reset);
sigma_dut_reg_cmd("PowerSwitch", NULL, cmd_powerswitch);
}