3 @@ -156,6 +156,14 @@ static int print_phy_handler(struct nl_m
4 printf("\tRTS threshold: %d\n", rts);
7 + if (tb_msg[NL80211_ATTR_WIPHY_COVERAGE_CLASS]) {
8 + unsigned char coverage;
10 + coverage = nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_COVERAGE_CLASS]);
11 + /* See handle_distance() for an explanation where the '450' comes from */
12 + printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage);
15 if (!tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES])
20 @@ -164,3 +164,61 @@ static int handle_netns(struct nl80211_s
21 COMMAND(set, netns, "<pid>",
22 NL80211_CMD_SET_WIPHY_NETNS, 0, CIB_PHY, handle_netns,
23 "Put this wireless device into a different network namespace");
25 +static int handle_coverage(struct nl80211_state *state,
28 + int argc, char **argv)
30 + unsigned int coverage;
35 + coverage = strtoul(argv[0], NULL, 10);
39 + NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_COVERAGE_CLASS, coverage);
45 +COMMAND(set, coverage, "<coverage class>",
46 + NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_coverage,
47 + "Set coverage class (1 for every 3 usec of air propagation time).\n"
48 + "Valid values: 0 - 255.");
50 +static int handle_distance(struct nl80211_state *state,
53 + int argc, char **argv)
55 + unsigned int distance, coverage;
60 + distance = strtoul(argv[0], NULL, 10);
63 + * Divide double the distance by the speed of light in m/usec (300) to
64 + * get round-trip time in microseconds and then divide the result by
65 + * three to get coverage class as specified in IEEE 802.11-2007 table
66 + * 7-27. Values are rounded upwards.
68 + coverage = (distance + 449) / 450;
72 + NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_COVERAGE_CLASS, coverage);
78 +COMMAND(set, distance, "<distance>",
79 + NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_distance,
80 + "Set appropriate coverage class for given link distance in meters.\n"
81 + "Valid values: 0 - 114750");