rpcd: iwinfo plugin fixes
[openwrt/svn-archive/archive.git] / package / network / utils / iw / patches / 120-antenna_gain.patch
1 --- a/phy.c
2 +++ b/phy.c
3 @@ -524,3 +524,30 @@ COMMAND(set, antenna, "<bitmap> | all |
4 NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_antenna,
5 "Set a bitmap of allowed antennas to use for TX and RX.\n"
6 "The driver may reject antenna configurations it cannot support.");
7 +
8 +static int handle_antenna_gain(struct nl80211_state *state,
9 + struct nl_msg *msg,
10 + int argc, char **argv,
11 + enum id_input id)
12 +{
13 + char *endptr;
14 + int dbm;
15 +
16 + /* get the required args */
17 + if (argc != 1)
18 + return 1;
19 +
20 + dbm = strtol(argv[0], &endptr, 10);
21 + if (*endptr)
22 + return 2;
23 +
24 + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_GAIN, dbm);
25 +
26 + return 0;
27 +
28 + nla_put_failure:
29 + return -ENOBUFS;
30 +}
31 +COMMAND(set, antenna_gain, "<antenna gain in dBm>",
32 + NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_antenna_gain,
33 + "Specify antenna gain.");