iw: update to 3.10, sync with nl80211.h changes in compat-wireless
[openwrt/svn-archive/archive.git] / package / network / utils / iw / patches / 120-antenna_gain.patch
1 --- a/phy.c
2 +++ b/phy.c
3 @@ -421,3 +421,31 @@ 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_cb *cb,
10 + struct nl_msg *msg,
11 + int argc, char **argv,
12 + enum id_input id)
13 +{
14 + char *endptr;
15 + int dbm;
16 +
17 + /* get the required args */
18 + if (argc != 1)
19 + return 1;
20 +
21 + dbm = strtol(argv[0], &endptr, 10);
22 + if (*endptr)
23 + return 2;
24 +
25 + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_GAIN, dbm);
26 +
27 + return 0;
28 +
29 + nla_put_failure:
30 + return -ENOBUFS;
31 +}
32 +COMMAND(set, antenna_gain, "<antenna gain in dBm>",
33 + NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_antenna_gain,
34 + "Specify antenna gain.");