gluon-core: 200-wireless: upgrade 11ac radios to VHT20 (#1328)
Patch originally authored by @oleeander. Fixes #424
This commit is contained in:
		
							parent
							
								
									d61f6a1e85
								
							
						
					
					
						commit
						427c83754b
					
				| @ -17,8 +17,8 @@ define Package/gluon-core | |||||||
|   CATEGORY:=Gluon |   CATEGORY:=Gluon | ||||||
|   TITLE:=Base files of Gluon |   TITLE:=Base files of Gluon | ||||||
|   DEPENDS:= \
 |   DEPENDS:= \
 | ||||||
| 	+gluon-site +libgluonutil +lua-platform-info +lua-simple-uci +lua-hash +lua-jsonc +luci-lib-nixio \
 | 	+gluon-site +libgluonutil +libiwinfo-lua +lua-platform-info +lua-simple-uci +lua-hash +lua-jsonc \
 | ||||||
| 	+vxlan +odhcp6c +firewall +pretty-hostname | 	+luci-lib-nixio +vxlan +odhcp6c +firewall +pretty-hostname | ||||||
| endef | endef | ||||||
| 
 | 
 | ||||||
| define Package/gluon-core/description | define Package/gluon-core/description | ||||||
|  | |||||||
| @ -3,6 +3,7 @@ | |||||||
| local util = require 'gluon.util' | local util = require 'gluon.util' | ||||||
| local site = require 'gluon.site' | local site = require 'gluon.site' | ||||||
| local sysconfig = require 'gluon.sysconfig' | local sysconfig = require 'gluon.sysconfig' | ||||||
|  | local iwinfo = require 'iwinfo' | ||||||
| 
 | 
 | ||||||
| local uci = require('simple-uci').cursor() | local uci = require('simple-uci').cursor() | ||||||
| 
 | 
 | ||||||
| @ -20,6 +21,15 @@ local function get_channel(radio, config) | |||||||
| 	return channel or config.channel() | 	return channel or config.channel() | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
|  | local function get_htmode(radio) | ||||||
|  |        local phy = util.find_phy(radio) | ||||||
|  |        if iwinfo.nl80211.hwmodelist(phy).ac then | ||||||
|  |                return 'VHT20' | ||||||
|  |        else | ||||||
|  |                return 'HT20' | ||||||
|  |        end | ||||||
|  | end | ||||||
|  | 
 | ||||||
| local function is_disabled(name) | local function is_disabled(name) | ||||||
| 	if uci:get('wireless', name) then | 	if uci:get('wireless', name) then | ||||||
| 		return uci:get_bool('wireless', name, 'disabled') | 		return uci:get_bool('wireless', name, 'disabled') | ||||||
| @ -152,11 +162,12 @@ util.foreach_radio(uci, function(radio, index, config) | |||||||
| 	end | 	end | ||||||
| 
 | 
 | ||||||
| 	local channel = get_channel(radio, config) | 	local channel = get_channel(radio, config) | ||||||
|  | 	local htmode = get_htmode(radio) | ||||||
| 
 | 
 | ||||||
| 	uci:delete('wireless', radio_name, 'disabled') | 	uci:delete('wireless', radio_name, 'disabled') | ||||||
| 
 | 
 | ||||||
| 	uci:set('wireless', radio_name, 'channel', channel) | 	uci:set('wireless', radio_name, 'channel', channel) | ||||||
| 	uci:set('wireless', radio_name, 'htmode', 'HT20') | 	uci:set('wireless', radio_name, 'htmode', htmode) | ||||||
| 	uci:set('wireless', radio_name, 'country', site.regdom()) | 	uci:set('wireless', radio_name, 'country', site.regdom()) | ||||||
| 
 | 
 | ||||||
| 	uci:set_list('wireless', radio_name, 'supported_rates', config.supported_rates()) | 	uci:set_list('wireless', radio_name, 'supported_rates', config.supported_rates()) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user