blob: bda0845ae05aba75f4cd49f0e0f3ad9aa765aa80 [file] [log] [blame]
developerfd40db22021-04-29 10:08:25 +08001/* Copyright (C) 2021 Mediatek Inc. */
2#define _GNU_SOURCE
3
developerfd40db22021-04-29 10:08:25 +08004#include <net/if.h>
5
6#include "mt76-vendor.h"
7
developerfd40db22021-04-29 10:08:25 +08008static const char *progname;
developer175704f2021-06-22 17:33:53 +08009struct unl unl;
developerfd40db22021-04-29 10:08:25 +080010
11void usage(void)
12{
13 static const char *const commands[] = {
developerdbc43572021-06-23 17:20:30 +080014 "set csi ctrl=<opt1>,<opt2>,<opt3>,<opt4> (macaddr=<macaddr>)",
15 "set csi interval=<interval (us)>",
16 "dump csi <packet num> <filename>",
developerfd40db22021-04-29 10:08:25 +080017 };
18 int i;
19
20 fprintf(stderr, "Usage:\n");
21 for (i = 0; i < ARRAY_SIZE(commands); i++)
22 printf(" %s wlanX %s\n", progname, commands[i]);
23
24 exit(1);
25}
26
developerfd40db22021-04-29 10:08:25 +080027int main(int argc, char **argv)
28{
developer175704f2021-06-22 17:33:53 +080029 const char *cmd, *subcmd;
30 int if_idx, ret = 0;
developerfd40db22021-04-29 10:08:25 +080031
32 progname = argv[0];
developer175704f2021-06-22 17:33:53 +080033 if (argc < 4)
developerfd40db22021-04-29 10:08:25 +080034 usage();
35
developer175704f2021-06-22 17:33:53 +080036 if_idx = if_nametoindex(argv[1]);
37 if (!if_idx) {
developerfd40db22021-04-29 10:08:25 +080038 fprintf(stderr, "%s\n", strerror(errno));
39 return 2;
40 }
41
42 cmd = argv[2];
developer175704f2021-06-22 17:33:53 +080043 subcmd = argv[3];
44 argv += 4;
45 argc -= 4;
developerfd40db22021-04-29 10:08:25 +080046
developer175704f2021-06-22 17:33:53 +080047 if (!strncmp(cmd, "dump", 4)) {
48 if (!strncmp(subcmd, "csi", 3))
49 ret = mt76_csi_dump(if_idx, argc, argv);
50 } else if (!strncmp(cmd, "set", 3)) {
51 if (!strncmp(subcmd, "csi", 3))
52 ret = mt76_csi_set(if_idx, argc, argv);
53 } else {
developerfd40db22021-04-29 10:08:25 +080054 usage();
developer175704f2021-06-22 17:33:53 +080055 }
developerfd40db22021-04-29 10:08:25 +080056
57 return ret;
58}