blob: 99366dd1f9d4a450f3626e67ff392802ec605520 [file] [log] [blame]
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001/*
2 * Sigma Control API DUT (station/AP)
3 * Copyright (c) 2010, Atheros Communications, Inc.
4 * All Rights Reserved.
5 * Licensed under the Clear BSD license. See README for more details.
6 */
7
8#include "sigma_dut.h"
9
10
11static int cmd_power_switch_ctrl(struct sigma_dut *dut,
12 struct sigma_conn *conn,
13 struct sigma_cmd *cmd)
14{
15 return 1;
16}
17
18
19static int cmd_power_switch_reset(struct sigma_dut *dut,
20 struct sigma_conn *conn,
21 struct sigma_cmd *cmd)
22{
23 if (system("killall hostapd") == 0) {
24 int i;
25
26 /* Wait some time to allow hostapd to complete cleanup before
27 * starting a new process */
28 for (i = 0; i < 10; i++) {
29 usleep(500000);
30 if (system("pidof hostapd") != 0)
31 break;
32 }
33 }
34 return 1;
35}
36
37
38static int cmd_powerswitch(struct sigma_dut *dut, struct sigma_conn *conn,
39 struct sigma_cmd *cmd)
40{
41 return 1;
42}
43
44
45void powerswitch_register_cmds(void)
46{
47 sigma_dut_reg_cmd("power_switch_ctrl", NULL, cmd_power_switch_ctrl);
48 sigma_dut_reg_cmd("power_switch_reset", NULL, cmd_power_switch_reset);
49 sigma_dut_reg_cmd("PowerSwitch", NULL, cmd_powerswitch);
50}