blob: 2e6b45126db820382a6088ceb62adf0dbd691e8a [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[] = {
developer175704f2021-06-22 17:33:53 +080014 "set csi ctrl=",
developerfd40db22021-04-29 10:08:25 +080015 "dump <packet num> <filename>",
16 };
17 int i;
18
19 fprintf(stderr, "Usage:\n");
20 for (i = 0; i < ARRAY_SIZE(commands); i++)
21 printf(" %s wlanX %s\n", progname, commands[i]);
22
23 exit(1);
24}
25
developerfd40db22021-04-29 10:08:25 +080026int main(int argc, char **argv)
27{
developer175704f2021-06-22 17:33:53 +080028 const char *cmd, *subcmd;
29 int if_idx, ret = 0;
developerfd40db22021-04-29 10:08:25 +080030
31 progname = argv[0];
developer175704f2021-06-22 17:33:53 +080032 if (argc < 4)
developerfd40db22021-04-29 10:08:25 +080033 usage();
34
developer175704f2021-06-22 17:33:53 +080035 if_idx = if_nametoindex(argv[1]);
36 if (!if_idx) {
developerfd40db22021-04-29 10:08:25 +080037 fprintf(stderr, "%s\n", strerror(errno));
38 return 2;
39 }
40
41 cmd = argv[2];
developer175704f2021-06-22 17:33:53 +080042 subcmd = argv[3];
43 argv += 4;
44 argc -= 4;
developerfd40db22021-04-29 10:08:25 +080045
developer175704f2021-06-22 17:33:53 +080046 if (!strncmp(cmd, "dump", 4)) {
47 if (!strncmp(subcmd, "csi", 3))
48 ret = mt76_csi_dump(if_idx, argc, argv);
49 } else if (!strncmp(cmd, "set", 3)) {
50 if (!strncmp(subcmd, "csi", 3))
51 ret = mt76_csi_set(if_idx, argc, argv);
52 } else {
developerfd40db22021-04-29 10:08:25 +080053 usage();
developer175704f2021-06-22 17:33:53 +080054 }
developerfd40db22021-04-29 10:08:25 +080055
56 return ret;
57}