1 iw: Add antenna configuration commands
3 From: Bruno Randolf <br1@einfach.org>
5 Add command to set the antenna configuration (iw phyX set antenna ...) and
6 include antenna setting in wiphy information (iw phyX info).
8 iw phyX set antenna all | <bitmap> | <tx bitmap> <rx bitmap>
10 Signed-off-by: Bruno Randolf <br1@einfach.org>
12 v8: Simplfied option parser as requested.
15 phy.c | 39 +++++++++++++++++++++++++++++++++++++++
16 2 files changed, 46 insertions(+), 0 deletions(-)
20 @@ -168,6 +168,13 @@ static int print_phy_handler(struct nl_m
21 printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage);
24 + if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_TX] &&
25 + tb_msg[NL80211_ATTR_WIPHY_ANTENNA_RX]) {
26 + printf("\tAntenna: TX %#x RX %#x\n",
27 + nla_get_u32(tb_msg[NL80211_ATTR_WIPHY_ANTENNA_TX]),
28 + nla_get_u32(tb_msg[NL80211_ATTR_WIPHY_ANTENNA_RX]));
31 if (tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES]) {
32 printf("\tSupported interface modes:\n");
33 nla_for_each_nested(nl_mode, tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES], rem_mode)
36 @@ -307,3 +307,51 @@ COMMAND(set, txpower, "<auto|fixed|limit
37 COMMAND(set, txpower, "<auto|fixed|limit> [<tx power in mBm>]",
38 NL80211_CMD_SET_WIPHY, 0, CIB_NETDEV, handle_txpower,
39 "Specify transmit power level and setting type.");
41 +static int handle_antenna(struct nl80211_state *state,
44 + int argc, char **argv)
47 + uint32_t tx_ant = 0, rx_ant = 0;
50 + if (strcmp(argv[0], "all") == 0)
51 + tx_ant = rx_ant = 0xffffffff;
53 + tx_ant = rx_ant = strtoul(argv[0], &end, 0);
58 + else if (argc == 2) {
59 + if (strcmp(argv[0], "all") == 0)
60 + tx_ant = 0xffffffff;
62 + tx_ant = strtoul(argv[0], &end, 0);
66 + if (strcmp(argv[1], "all") == 0)
67 + rx_ant = 0xffffffff;
69 + rx_ant = strtoul(argv[1], &end, 0);
76 + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_TX, tx_ant);
77 + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_RX, rx_ant);
84 +COMMAND(set, antenna, "<bitmap> | all | <tx bitmap> <rx bitmap>",
85 + NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_antenna,
86 + "Set a bitmap of allowed antennas to use for TX and RX.\n"
87 + "The driver may reject antenna configurations it cannot support.");