4 #include <netlink/genl/genl.h>
5 #include <netlink/msg.h>
6 #include <netlink/attr.h>
11 static int set_sar_specs(struct nl80211_state
*state
,
13 int argc
, char **argv
,
16 struct nlattr
*nl_sar
, *nl_specs
, *nl_sub
;
17 enum nl80211_sar_type type
;
28 nl_sar
= nla_nest_start(msg
, NL80211_ATTR_SAR_SPEC
);
32 NLA_PUT_U32(msg
, NL80211_SAR_ATTR_TYPE
, type
);
34 nl_specs
= nla_nest_start(msg
, NL80211_SAR_ATTR_SPECS
);
38 for (i
= 1; i
< argc
; i
++) {
39 tmp
= strchr(argv
[i
], ':');
43 if (tmp
!= strrchr(argv
[i
], ':'))
46 count
= sscanf(argv
[i
], "%u:%d", &idx
, &pwr
);
50 nl_sub
= nla_nest_start(msg
, i
- 1);
54 NLA_PUT_U32(msg
, NL80211_SAR_ATTR_SPECS_RANGE_INDEX
, idx
);
55 NLA_PUT_S32(msg
, NL80211_SAR_ATTR_SPECS_POWER
, pwr
);
57 nla_nest_end(msg
, nl_sub
);
60 nla_nest_end(msg
, nl_specs
);
61 nla_nest_end(msg
, nl_sar
);
69 COMMAND(set
, sar_specs
, "<sar type> <range index:sar power>*",
70 NL80211_CMD_SET_SAR_SPECS
, 0, CIB_PHY
, set_sar_specs
,
71 "Set SAR specs corresponding to SAR capa of wiphy.");