[LEDE-DEV] [PATCH v1 1/2] base-files, mac80211, broadcom-wl: plug-and-play wifi detection

Cezary Jackiewicz cezary.jackiewicz at gmail.com
Sat Oct 8 08:46:47 PDT 2016


Dnia 2016-10-08, o godz. 17:41:35
Christian Lamparter <chunkeey at googlemail.com> napisał(a):

> Hello,
> 
> On Friday, October 7, 2016 8:29:30 PM CEST Matthias Schiffer wrote:
> > On 10/07/2016 08:10 PM, Christian Lamparter wrote:  
> > > Currently, the wifi detection script is executed as part of
> > > the (early) boot process. Pluggable wifi USB devices, which
> > > are inserted at a later time are not automatically
> > > detected and therefore they don't show up in LuCI.
> > > 
> > > A user has to deal with wifi detection manually, or restart
> > > the router.
> > > 
> > > [...]
> > > ---
> > > We would like to hear, if these changes work with broadcom-wl.
> > > (Felix removed the hostap, so this isn't included anymore).
> > > 
> > > trap and lock are part of the default busybox setup.  
> > 
> > Hi,
> > it would be great to remove the direct write of /etc/config/wireless
> > completely, as it won't lock against other users of UCI that modify the
> > wireless config. IMO, it should just use UCI to modify the configuration as
> > everything else does.  
> 
> Well, What's the situation with ECE and configd? I didn't want to touch it
> since you plan to move away from the config files and replace them with
> json. 
> 
> Anyway, I attached two RFCs (one for broadcom, the other mac80211)
> that replaces the code with uci calls.
> 
> One issue is that there's no longer the "# REMOVE THIS LINE TO ENABLE WIFI:"
> line and people might overlook the "disabled 1" setting.
> 
> Note: the "> /dev/null" for uci calls were added just in case someone still
> has the old /etc/init.d/boot and to not write garbage into /e/c/wireless.
> 
> Note2: I've also changed the "plug-and-play wifi" patch and removed the
> /tmp/wireless.tmp step. But we still need proper locking. 
> (That said, I would like to move the locking to the mac80211.sh / broadcom.sh
> detect functions, is everyone fine with that?)
> 
> ---
> mac80211: use uci to generate wireless config file
> 
> Previously, wifi detect simply dumped its generated wireless
> configuration out to STDOUT. A second step was needed to
> append the configuration to /etc/config/wireless (or create
> it, if it didn't exist).
> 
> With this patch, The wifi detection script will now use uci
> to update the wireless configuration directly.
> 
> Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
> ---
> diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
> --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
> +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
> @@ -92,7 +92,7 @@ detect_mac80211() {
>  			htmode="VHT80"
>  		}
>  
> -		[ -n $htmode ] && append ht_capab "	option htmode	$htmode" "$N"
> +		[ -n $htmode ] && ht_capab="set wireless.radio${devidx}.htmode=$htmode"
>  
>  		if [ -x /usr/bin/readlink -a -h /sys/class/ieee80211/${dev} ]; then
>  			path="$(readlink -f /sys/class/ieee80211/${dev}/device)"
> @@ -104,30 +104,30 @@ detect_mac80211() {
>  			case "$path" in
>  				platform*/pci*) path="${path##platform/}";;
>  			esac
> -			dev_id="	option path	'$path'"
> +			dev_id="set wireless.radio${devidx}.path='$path'"
>  		else
> -			dev_id="	option macaddr	$(cat /sys/class/ieee80211/${dev}/macaddress)"
> +			dev_id="set wireless.radio${devidx}.macaddr=$(cat /sys/class/ieee80211/${dev}/macaddress)"
>  		fi
>  
> -		cat <<EOF
> -config wifi-device  radio$devidx
> -	option type     mac80211
> -	option channel  ${channel}
> -	option hwmode	11${mode_band}
> -$dev_id
> -$ht_capab
> -	# REMOVE THIS LINE TO ENABLE WIFI:
> -	option disabled 1
> -
> -config wifi-iface
> -	option device   radio$devidx
> -	option network  lan
> -	option mode     ap
> -	option ssid     LEDE
> -	option encryption none
> -
> +		uci -q batch > /dev/null <<-EOF
> +			set wireless.radio${devidx}=wifi-device
> +			set wireless.radio${devidx}.type=mac80211
> +			set wireless.radio${devidx}.channel=${channel}
> +			set wireless.radio${devidx}.hwmode=11${mode_band}
> +			${dev_id}
> +			${ht_capab}
> +			set wireless.radio${devidx}.disabled=1
> +
> +			add wireless wifi-iface
> +			set wireless. at wifi-iface[-1]=wifi-iface
> +			set wireless. at wifi-iface[-1].device=radio${devidx}
> +			set wireless. at wifi-iface[-1].network=lan
> +			set wireless. at wifi-iface[-1].mode=ap


> +			set wireless. at wifi-iface[-1].ssid=LEDE

[...]
> +			set wireless. at wifi-iface[-1].ssid=Lede${i#0}

BTW:

-- 
Pozdrawiam,
 Cezary Jackiewicz



More information about the Lede-dev mailing list