From patchwork Thu Dec 13 23:24:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hurrhnn--- via openwrt-devel X-Patchwork-Id: 1013207 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lists.openwrt.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qVfIXtGg"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43G8sX3wTkz9s4s for ; Fri, 14 Dec 2018 10:24:43 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Date:Sender:Content-Type: Subject:List-Help:Reply-To:List-Archive:List-Unsubscribe:List-Subscribe:Cc: From:List-Post:List-Id:Message-ID:MIME-Version:To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=fxDuDLmGcHIkQGdR3lQZibLUkAXfnaHWfOeHaHcRqG4=; b=qVfIXtGge5gNlvqxhtfZdQXtPy Wnd+rbnkF6ISfNVZOu3GpmU4TtDwca/mp3z/pzTXNremhZ6+3K8y/NQdIFNxxpwpPo6A6KZnuRclE 2NKJpeoyBJPbVPZE3PmcBkgHddNCu8kP7/+ruf6HhUVKfSweg6pz03zK3qi9TLo0o51Q9G1klYWTi UTVGmF33t8q9FM1QfC0PlqQ3sJjhYl/bERU822wIhQF/3uYVoDjbHr12oCfHlQ6WbNlHNSsPsJ95X yn9PHoTR9/TDjKUTzj7+9lgjfne2Rki6xxoF7FcQFaNn0nZcjvH4mhrVynKsT5IwWzk+XsUT187vr 5Fl96Pzw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gXaLK-00073s-Ks; Thu, 13 Dec 2018 23:24:34 +0000 To: openwrt-devel@lists.openwrt.org MIME-Version: 1.0 Message-ID: List-Id: List-Post: X-Patchwork-Original-From: Ben Greear via openwrt-devel From: hurrhnn--- via openwrt-devel Precedence: list Cc: Ben Greear X-Mailman-Version: 2.1.21 X-BeenThere: openwrt-devel@lists.openwrt.org List-Subscribe: , List-Unsubscribe: , List-Archive: Reply-To: greearb@candelatech.com List-Help: Subject: [OpenWrt-Devel] [PATCH] hotplug: Allow renaming phy devices. Sender: "openwrt-devel" Date: Thu, 13 Dec 2018 23:24:34 +0000 Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software. From: Ben Greear uci set wireless.@wifi-device[0].phyname=wiphy0 Then reboot and/or re-plug that device, and this will name the phy wiphy0 instead of phy0, phy1, etc. Signed-off-by: Ben Greear --- .../kernel/mac80211/files/mac80211.hotplug | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/package/kernel/mac80211/files/mac80211.hotplug b/package/kernel/mac80211/files/mac80211.hotplug index b865552661..a394e3195e 100644 --- a/package/kernel/mac80211/files/mac80211.hotplug +++ b/package/kernel/mac80211/files/mac80211.hotplug @@ -3,3 +3,35 @@ [ "${ACTION}" = "add" ] && { /sbin/wifi config } + + +OPATH=${DEVPATH##/devices/platform/} +OPATH=${OPATH%%/ieee*} + +# For USB, OPATH looks like this at this point in this script: +# soc/soc:usb30@0/11000000.dwc3/xhci-hcd.0.auto/usb1/1-1/1-1:1.0 +# But, the uci path has a platform/ prefix on that: +# platform/soc/soc:usb30@0/11000000.dwc3/xhci-hcd.0.auto/usb1/1-1/1-1:1.0 +OPATH_USB="platform/$OPATH"; + +# 10 radios is enough for anyone! +#echo "fix-wifi-mac, OPATH: $OPATH" >> /tmp/foo.txt +for i in `seq 0 9`; + do + BUS=`uci get wireless.@wifi-device[$i].path` + #echo "fix-wifi-mac, BUS[$i]: $BUS" >> /tmp/foo.txt + if [ "$BUS " == "$OPATH " ] || [ "$BUS " == "$OPATH_USB " ] + then + PHYNAME=${DEVPATH##*ieee80211/} + NPHYNAME=`uci get wireless.@wifi-device[$i].phyname` + #echo "fix-wifi-mac, PHYNAME[$i]: $PHYNAME NPHYNAME: $NPHYNAME" >> /tmp/foo.txt; + if [ "$NPHYNAME " != " " ] + then + if [ "$PHYNAME " != "$NPHYNAME " ] + then + #echo "fix-wifi-mac, renaming..." >> /tmp/foo.txt; + iw $PHYNAME set name $NPHYNAME + fi + fi + fi +done