120-antenna_gain.patch 761 B

123456789101112131415161718192021222324252627282930313233
  1. --- a/phy.c
  2. +++ b/phy.c
  3. @@ -855,3 +855,30 @@ static int handle_get_txq(struct nl80211
  4. COMMAND(get, txq, "",
  5. NL80211_CMD_GET_WIPHY, 0, CIB_PHY, handle_get_txq,
  6. "Get TXQ parameters.");
  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.");