aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils/iw/patches/120-antenna_gain.patch
blob: f8d537fe1ed8cd118a04a1cbd6c757b63466a581 (plain)
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
--- a/phy.c
+++ b/phy.c
@@ -855,3 +855,30 @@ static int handle_get_txq(struct nl80211
 COMMAND(get, txq, "",
 	NL80211_CMD_GET_WIPHY, 0, CIB_PHY, handle_get_txq,
 	"Get TXQ parameters.");
+
+static int handle_antenna_gain(struct nl80211_state *state,
+			       struct nl_msg *msg,
+			       int argc, char **argv,
+			       enum id_input id)
+{
+	char *endptr;
+	int dbm;
+
+	/* get the required args */
+	if (argc != 1)
+		return 1;
+
+	dbm = strtol(argv[0], &endptr, 10);
+	if (*endptr)
+		return 2;
+
+	NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_GAIN, dbm);
+
+	return 0;
+
+ nla_put_failure:
+	return -ENOBUFS;
+}
+COMMAND(set, antenna_gain, "<antenna gain in dBm>",
+	NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_antenna_gain,
+	"Specify antenna gain.");