Changeset 17529
- Timestamp:
- 08/30/11 00:23:53 (21 months ago)
- Location:
- src/router
- Files:
-
- 2 edited
-
libutils/mac80211info.c (modified) (1 diff)
-
shared/wlutils.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/router/libutils/mac80211info.c
r17428 r17529 738 738 return 0; 739 739 } 740 741 void mac80211_set_antennas(int phy,uint32_t tx_ant,uint32_t rx_ant ) { 742 struct nl_msg *msg; 743 744 msg = unl_genl_msg(&unl, NL80211_CMD_SET_WIPHY, false); 745 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, phy); 746 #ifdef HAVE_AP83 747 if (tx_ant == 5) tx_ant=3; 748 #endif 749 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_TX, tx_ant); 750 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_RX, rx_ant); 751 unl_genl_request(&unl, msg, NULL, NULL); 752 return; 753 754 nla_put_failure: 755 nlmsg_free(msg); 756 return; 757 } 758 759 static int mac80211_get_antennas(int phy,int which,int direction) { 760 struct nlattr *tb[NL80211_ATTR_MAX + 1]; 761 struct nl_msg *msg; 762 struct genlmsghdr *gnlh; 763 764 msg = unl_genl_msg(&unl, NL80211_CMD_GET_WIPHY, true); 765 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, phy); 766 if (unl_genl_request_single(&unl, msg, &msg) < 0) 767 return 0; 768 gnlh=nlmsg_data(nlmsg_hdr(msg)); 769 nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), 770 genlmsg_attrlen(gnlh, 0), NULL); 771 if (which == 0 && direction == 0) { 772 if (tb[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX]) 773 return((int) nla_get_u32(tb[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX])); 774 } 775 776 if (which == 0 && direction == 1) { 777 if (tb[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX]) 778 return((int) nla_get_u32(tb[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX])); 779 } 780 781 if (which == 1 && direction == 0) { 782 if (tb[NL80211_ATTR_WIPHY_ANTENNA_TX]) 783 return((int) nla_get_u32(tb[NL80211_ATTR_WIPHY_ANTENNA_TX])); 784 } 785 786 if (which == 1 && direction == 1) { 787 if (tb[NL80211_ATTR_WIPHY_ANTENNA_RX]) 788 return((int) nla_get_u32(tb[NL80211_ATTR_WIPHY_ANTENNA_RX])); 789 } 790 nlmsg_free(msg); 791 return 0; 792 nla_put_failure: 793 nlmsg_free(msg); 794 return 0; 795 } 796 797 int mac80211_get_avail_tx_antenna(int phy) { 798 int ret=mac80211_get_antennas(phy,0,0); 799 #ifdef HAVE_AP83 800 if (ret == 3) ret=5; 801 #endif 802 return(ret); 803 } 804 805 int mac80211_get_avail_rx_antenna(int phy) { 806 return(mac80211_get_antennas(phy,0,1)); 807 } 808 809 int mac80211_get_configured_tx_antenna(int phy) { 810 int ret=mac80211_get_antennas(phy,1,0); 811 #ifdef HAVE_AP83 812 if (ret == 3) ret=5; 813 #endif 814 return(ret); 815 } 816 817 int mac80211_get_configured_rx_antenna(int phy) { 818 return(mac80211_get_antennas(phy,1,1)); 819 } -
src/router/shared/wlutils.h
r16848 r17529 108 108 struct wifi_channels *mac80211_get_channels(char *interface,char *country,int max_bandwidth_khz, unsigned char checkband); 109 109 extern struct mac80211_ac *mac80211autochannel(char *interface, char *freq_range, int scans, int ammount, int enable_passive); 110 extern void mac80211_set_antennas(int phy,uint32_t tx_ant,uint32_t rx_ant ); 111 extern int mac80211_get_avail_tx_antenna(int phy); 112 extern int mac80211_get_avail_rx_antenna(int phy); 113 extern int mac80211_get_configured_tx_antenna(int phy); 114 extern int mac80211_get_configured_rx_antenna(int phy); 110 115 111 116 struct wifi_channels {
Note: See TracChangeset
for help on using the changeset viewer.
