summaryrefslogtreecommitdiff
path: root/package/ramips/drivers/mt7628sta
diff options
context:
space:
mode:
Diffstat (limited to 'package/ramips/drivers/mt7628sta')
-rwxr-xr-xpackage/ramips/drivers/mt7628sta/Makefile111
-rwxr-xr-xpackage/ramips/drivers/mt7628sta/config.in246
-rwxr-xr-xpackage/ramips/drivers/mt7628sta/files/mt7628sta.dat95
-rw-r--r--package/ramips/drivers/mt7628sta/files/mt7628sta.sh63
-rwxr-xr-xpackage/ramips/drivers/mt7628sta/files/wpa_supplicant.sh194
-rw-r--r--package/ramips/drivers/mt7628sta/patches/001-openwrt-build.patch20
-rw-r--r--package/ramips/drivers/mt7628sta/patches/002-path.patch31
-rw-r--r--package/ramips/drivers/mt7628sta/patches/003-log.patch30
8 files changed, 790 insertions, 0 deletions
diff --git a/package/ramips/drivers/mt7628sta/Makefile b/package/ramips/drivers/mt7628sta/Makefile
new file mode 100755
index 0000000..daa9d63
--- /dev/null
+++ b/package/ramips/drivers/mt7628sta/Makefile
@@ -0,0 +1,111 @@
+# All rights reserved.
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=mt7628sta
+P4REV:=130908
+PKG_VERSION:=4.0.1.4
+PKG_SOURCE:=MT7628-STA-4.0.1.4.tar.bz2
+PKG_SOURCE_URL:=http://localhost/
+PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_KCONFIG:=RALINK_MT7628 \
+ MT_WIFI \
+ FIRST_IF_EEPROM_PROM \
+ FIRST_IF_EEPROM_EFUSE \
+ FIRST_IF_EEPROM_FLASH \
+ RT_FIRST_CARD_EEPROM \
+ SECOND_IF_EEPROM_PROM \
+ SECOND_IF_EEPROM_EFUSE \
+ SECOND_IF_EEPROM_FLASH \
+ RT_SECOND_CARD_EEPROM \
+ MULTI_INF_SUPPORT \
+ WIFI_BASIC_FUNC \
+ MT7628_WSC_INCLUDED \
+ MT7628_WSC_V2_SUPPORT \
+ MT7628_DOT11W_PMF_SUPPORT \
+ MT7628_LLTD_SUPPORT \
+ MT7628_QOS_DLS_SUPPORT \
+ MT7628_IGMP_SNOOP_SUPPORT \
+ MT7628_BLOCK_NET_IF \
+ MT7628_RATE_ADAPTION \
+ MT7628_NEW_RATE_ADAPT_SUPPORT \
+ MT7628_AGS_SUPPORT \
+ MT7628_IDS_SUPPORT \
+ MT7628_WIFI_WORKQUEUE \
+ MT7628_WIFI_SKB_RECYCLE \
+ MT7628_SMART_CARRIER_SENSE_SUPPORT \
+ MT7628_LED_CONTROL_SUPPORT \
+ MT7628_ATE_SUPPORT \
+ MT7628_MEMORY_OPTIMIZATION \
+ MT7628_PASSPOINT_R2 \
+ MT7628_SINGLE_SKU \
+ MT7628_UAPSD \
+ MT_MAC \
+ RTMP_PCI_SUPPORT \
+ RTMP_USB_SUPPORT \
+ RTMP_RBUS_SUPPORT \
+ MT_WIFI_MODE_AP \
+ MT_WIFI_MODE_STA \
+ MT_WIFI_MODE_BOTH \
+ MT_AP_SUPPORT \
+ MT_STA_SUPPORT
+
+include $(INCLUDE_DIR)/package.mk
+
+TAR_CMD=$(HOST_TAR) -C $(1)/ $(TAR_OPTIONS)
+
+define KernelPackage/mt7628sta
+ CATEGORY:=MTK Properties
+ TITLE:=MTK MT7628 wifi STA driver
+ FILES:=$(PKG_BUILD_DIR)/mt_wifi_sta/mt7628sta.ko
+ AUTOLOAD:=$(call AutoLoad,90,mt7628sta)
+ DEPENDS:=@TARGET_ramips_mt7628 +kmod-cfg80211-normal +wpa-supplicant-20
+ SUBMENU:=Drivers
+ MENU:=1
+endef
+
+define KernelPackage/mt7628sta/config
+ source "$(SOURCE)/config.in"
+endef
+
+define Build/Compile
+ $(MAKE) -C "$(LINUX_DIR)" V=1 \
+ CROSS_COMPILE="$(TARGET_CROSS)" \
+ ARCH="$(LINUX_KARCH)" \
+ SUBDIRS="$(PKG_BUILD_DIR)/mt_wifi_sta/" \
+ $(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_$c),CONFIG_$(c)=$(CONFIG_$(c)))) \
+ modules
+endef
+
+define P4/Info
+ P4URL:=//Jedi/MP/jedi.MT7628.MP/wifi_driver/
+endef
+
+define P4/Release
+ echo "Gone with the wind."
+endef
+
+define KernelPackage/mt7628sta/install
+ $(INSTALL_DIR) $(1)/lib/wifi/
+ $(INSTALL_BIN) ./files/mt7628sta.sh $(1)/lib/wifi/
+ $(INSTALL_BIN) ./files/wpa_supplicant.sh $(1)/lib/wifi/
+ $(INSTALL_DIR) $(1)/etc/wireless/mt7628sta/
+ $(INSTALL_BIN) ./files/mt7628sta.dat $(1)/etc/wireless/mt7628sta/
+ #-if [ "$$(CONFIG_INTERNAL_PA_INTERNAL_LNA)" = "y" ]; then \
+ # $(INSTALL_BIN) ./files/mt7628sta.eeprom.ipa.ilna.bin $(1)/etc/wireless/mt7628sta/mt7628sta.eeprom.bin; \
+ #elif [ "$$(CONFIG_INTERNAL_PA_EXTERNAL_LNA)" = "y" ]; then \
+ # $(INSTALL_BIN) ./files/mt7628sta.eeprom.ipa.elna.bin $(1)/etc/wireless/mt7628sta/mt7628sta.eeprom.bin; \
+ #elif [ "$$(CONFIG_EXTERNAL_PA_EXTERNAL_LNA)" = "y" ]; then \
+ # $(INSTALL_BIN) ./files/mt7628sta.eeprom.epa.elna.bin $(1)/etc/wireless/mt7628sta/mt7628sta.eeprom.bin; \
+ #else \
+ # $(INSTALL_BIN) ./files/mt7628sta.eeprom.ipa.elna.bin $(1)/etc/wireless/mt7628sta/mt7628sta.eeprom.bin; \
+ #fi
+ echo $(PKG_VERSION) > $(1)/etc/wireless/mt7628sta/version
+endef
+
+$(eval $(call KernelPackage,mt7628sta))
diff --git a/package/ramips/drivers/mt7628sta/config.in b/package/ramips/drivers/mt7628sta/config.in
new file mode 100755
index 0000000..6b74237
--- /dev/null
+++ b/package/ramips/drivers/mt7628sta/config.in
@@ -0,0 +1,246 @@
+if PACKAGE_kmod-mt7628sta
+
+config MT7628_RT_FIRST_CARD
+ int
+ default 7628
+
+config MT7628_MT_WIFI
+ bool
+ select WIFI_BASIC_FUNC
+ default y
+
+config MT7628_MT_WIFI_PATH
+ string
+ depends on MT7628_MT_WIFI
+ default "rlt_wifi"
+
+config MT_WIFI
+ tristate #"MT WIFI Driver"
+ select WIFI_BASIC_FUNC if MT_WIFI
+ default y
+
+#config MT_WIFI_PATH
+# string
+# depends on MT_WIFI
+# default "rlt_wifi"
+
+if MT_WIFI
+menu "WiFi Generic Feature Options"
+
+config FIRST_IF_EEPROM_FLASH
+ bool
+ default y
+
+config RT_FIRST_CARD_EEPROM
+ string
+ default "flash"
+
+config SECOND_IF_EEPROM_FLASH
+ bool
+ default y
+
+config RT_SECOND_CARD_EEPROM
+ string
+ default "flash"
+
+config MULTI_INF_SUPPORT
+ bool
+ #default y if !FIRST_IF_NONE && !SECOND_IF_NONE
+ default n
+
+config WIFI_BASIC_FUNC
+ bool "Basic Functions"
+ select WIRELESS_EXT
+ select WEXT_SPY
+ select WEXT_PRIV
+
+config MT7628_WSC_INCLUDED
+ bool "WSC (WiFi Simple Config)"
+ depends on MT7628_AP_SUPPORT
+ default y
+
+config MT7628_WSC_V2_SUPPORT
+ bool "WSC V2(WiFi Simple Config Version 2.0)"
+ depends on MT7628_AP_SUPPORT
+ default y
+
+config MT7628_DOT11W_PMF_SUPPORT
+ bool "PMF"
+ depends on MT7628_AP_SUPPORT
+ default y
+
+config MT7628_LLTD_SUPPORT
+ bool "LLTD (Link Layer Topology Discovery Protocol)"
+ depends on MT7628_AP_SUPPORT
+ default n
+
+config MT7628_QOS_DLS_SUPPORT
+ bool "802.11e DLS ((Direct-Link Setup) Support"
+ depends on MT7628_AP_SUPPORT
+ default n
+
+#config MT7628_WAPI_SUPPORT
+# bool "WAPI Support"
+## default n
+
+#config MT7628_FTM_SUPPORT
+# bool "FTM Support"
+## default n
+
+config MT7628_IGMP_SNOOP_SUPPORT
+ bool "IGMP snooping"
+ depends on MT7628_AP_SUPPORT
+ default n
+
+config MT7628_BLOCK_NET_IF
+ bool "NETIF Block"
+ depends on MT7628_AP_SUPPORT
+ default n
+ help
+ Support Net interface block while Tx-Sw queue full
+
+config MT7628_RATE_ADAPTION
+ bool "New Rate Adaptation support"
+ default y
+
+config MT7628_NEW_RATE_ADAPT_SUPPORT
+ bool "Intelligent Rate Adaption"
+ depends on MT7628_RATE_ADAPTION
+ default y
+
+config MT7628_AGS_SUPPORT
+ bool "Adaptive Group Switching"
+ depends on MT7628_RATE_ADAPTION
+ depends on MT7628_AP_SUPPORT
+ default n
+
+config MT7628_IDS_SUPPORT
+ bool "IDS (Intrusion Detection System) Support"
+ depends on MT7628_AP_SUPPORT
+ default n
+
+config MT7628_WIFI_WORK_QUEUE
+ bool "Work Queue"
+ default n
+
+config MT7628_WIFI_SKB_RECYCLE
+ bool "SKB Recycle(Linux)"
+ depends on MT7628_AP_SUPPORT
+ default n
+
+config MT7628_SMART_CARRIER_SENSE_SUPPORT
+ bool "Smart Carrier Sense"
+ default y
+
+config MT7628_LED_CONTROL_SUPPORT
+ bool "LED Support"
+ depends on MT7628_AP_SUPPORT
+ default n
+
+config MT7628_ATE_SUPPORT
+ bool "ATE/QA Support"
+ depends on MT7628_AP_SUPPORT
+ default n
+
+config MT7628_MEMORY_OPTIMIZATION
+ bool "Memory Optimization"
+ default n
+
+config MT7628_PASSPOINT_R2
+ bool "Passpoint Release-2 Support"
+ select MT7628_DOT11W_PMF_SUPPORT
+ depends on MT7628_AP_SUPPORT
+ default n
+
+#config MT7628_TRACE_IPARP
+# bool "IP/ARP trace log"
+#
+config MT7628_SINGLE_SKU
+ bool "Single SKU Support"
+ depends on MT7628_AP_SUPPORT
+ default n
+
+config MT7628_UAPSD
+ bool "UAPSD support"
+ depends on MT7628_AP_SUPPORT
+ default y
+
+#
+# Section for chip architectures
+#
+# "MT MAC Support"
+config MT_MAC
+ bool
+ default y
+
+# "RLT MAC Support"
+#config RLT_MAC
+# bool
+## default n
+
+#config RLT_BBP
+# bool
+
+#config RLT_RF
+# bool
+
+# "RTMP MAC Support"
+#config RTMP_MAC
+# bool
+## default n
+
+#config RTMP_BBP
+# bool
+
+#config RTMP_RF
+# bool
+
+#
+# Section for interfaces
+#
+config RTMP_PCI_SUPPORT
+ bool
+
+config RTMP_USB_SUPPORT
+ bool
+
+config RTMP_RBUS_SUPPORT
+ bool
+
+endmenu
+
+menu "WiFi Operation Modes"
+ choice
+ prompt "Main Mode"
+ default MT_WIFI_MODE_STA
+
+ config MT_WIFI_MODE_AP
+ bool "AP"
+ select MT_AP_SUPPORT
+
+ config MT_WIFI_MODE_STA
+ bool "STA"
+ select MT_STA_SUPPORT
+
+ config MT_WIFI_MODE_BOTH
+ bool "APSTA"
+ select MT_AP_SUPPORT
+ select MT_STA_SUPPORT
+
+ endchoice
+
+ config MT_STA_SUPPORT
+ tristate "Mediatek 802.11n STA support"
+ select WIRELESS_EXT
+ select WEXT_SPY
+ select WEXT_PRIV
+ default y
+
+config MT_AP_SUPPORT
+ bool
+
+endmenu
+
+endif
+
+endif
diff --git a/package/ramips/drivers/mt7628sta/files/mt7628sta.dat b/package/ramips/drivers/mt7628sta/files/mt7628sta.dat
new file mode 100755
index 0000000..5f306b9
--- /dev/null
+++ b/package/ramips/drivers/mt7628sta/files/mt7628sta.dat
@@ -0,0 +1,95 @@
+#The word of "Default" must not be removed
+Default
+CountryRegion=5
+CountryRegionABand=7
+CountryCode=
+ChannelGeography=1
+SSID=Dennis2860AP
+NetworkType=Infra
+WirelessMode=9
+Channel=0
+BeaconPeriod=100
+TxPower=100
+BGProtection=0
+TxPreamble=0
+RTSThreshold=2347
+FragThreshold=2346
+TxBurst=1
+PktAggregate=0
+WmmCapable=1
+AckPolicy=0;0;0;0
+AuthMode=OPEN
+EncrypType=NONE
+WPAPSK=
+DefaultKeyID=1
+Key1Type=0
+Key1Str=
+Key2Type=0
+Key2Str=
+Key3Type=0
+Key3Str=
+Key4Type=0
+Key4Str=
+PSMode=CAM
+AutoRoaming=0
+RoamThreshold=70
+APSDCapable=0
+APSDAC=0;0;0;0
+HT_RDG=1
+HT_EXTCHA=0
+HT_OpMode=0
+HT_MpduDensity=4
+HT_BW=1
+HT_AutoBA=1
+HT_BADecline=0
+HT_AMSDU=0
+HT_BAWinSize=64
+HT_GI=1
+HT_MCS=33
+HT_MIMOPSMode=3
+HT_DisallowTKIP=1
+HT_LDPC=0
+HT_STBC=0
+VHT_BW=1
+VHT_SGI=1
+VHT_STBC=0
+VHT_BW_SIGNAL=0
+VHT_DisallowNonVHT=0
+VHT_LDPC=0
+EthConvertMode=
+EthCloneMac=
+IEEE80211H=0
+TGnWifiTest=0
+WirelessEvent=0
+MeshId=MESH
+MeshAutoLink=1
+MeshAuthMode=OPEN
+MeshEncrypType=NONE
+MeshWPAKEY=
+MeshDefaultkey=1
+MeshWEPKEY=
+CarrierDetect=0
+AntDiversity=0
+BeaconLostTime=4
+FtSupport=0
+Wapiifname=ra0
+WapiPsk=
+WapiPskType=
+WapiUserCertPath=
+WapiAsCertPath=
+PSP_XLINK_MODE=0
+WscManufacturer=
+WscModelName=
+WscDeviceName=
+WscModelNumber=
+WscSerialNumber=
+RadioOn=1
+WIDIEnable=1
+P2P_L2SD_SCAN_TOGGLE=3
+Wsc4digitPinCode=0
+P2P_WIDIEnable=0
+PMFMFPC=0
+PMFMFPR=0
+PMFSHA256=0
+SnifferType=0
+LoadCodeMethod=0
diff --git a/package/ramips/drivers/mt7628sta/files/mt7628sta.sh b/package/ramips/drivers/mt7628sta/files/mt7628sta.sh
new file mode 100644
index 0000000..093101a
--- /dev/null
+++ b/package/ramips/drivers/mt7628sta/files/mt7628sta.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+append DRIVERS "mt7628sta"
+
+. /lib/wifi/ralink_common.sh
+. /lib/wifi/wpa_supplicant.sh
+
+prepare_mt7628sta() {
+ logger prepare_mt7628sta
+}
+
+scan_mt7628sta() {
+ logger scan_mt7628sta
+}
+
+
+disable_mt7628sta() {
+ logger disable_mt7628sta
+ local ifname
+ config_get vifs "$device" vifs
+ for vif in $vifs; do
+ config_get ifname $vif ifname
+ uci -q delete wireless.${vif}.bssid # for luci
+ uci -q commit wireless # for luci
+ ifconfig $ifname down
+ done
+
+ killall wpa_supplicant 2>/dev/null
+ echo 0 > /dev/null
+}
+
+enable_mt7628sta() {
+ logger enable_mt7628sta
+ local ifname disabled
+ config_get vifs "$device" vifs
+ for vif in $vifs; do
+ config_get ifname $vif ifname
+ config_get disabled $vif disabled
+ [ "$disabled" == "1" ] || {
+ ifconfig $ifname up
+ wpa_supplicant_setup_vif $vif nl80211
+ }
+ done
+}
+
+detect_mt7628sta() {
+ cd /sys/module/
+ [ -d mt7628sta ] || return
+ [ -e /etc/config/wireless ] && return
+ cat <<EOF
+config wifi-device mt7628sta
+ option type mt7628sta
+ option vendor ralink
+ option ifname rai0
+
+config wifi-iface
+ option device mt7628sta
+ option ifname rai0
+ option mode sta
+
+EOF
+}
+
+
diff --git a/package/ramips/drivers/mt7628sta/files/wpa_supplicant.sh b/package/ramips/drivers/mt7628sta/files/wpa_supplicant.sh
new file mode 100755
index 0000000..ee4ed50
--- /dev/null
+++ b/package/ramips/drivers/mt7628sta/files/wpa_supplicant.sh
@@ -0,0 +1,194 @@
+wpa_supplicant_setup_vif() {
+ local vif="$1"
+ local driver="$2"
+ local key="$key"
+ local options="$3"
+ local freq=""
+ local ht="$5"
+ local ap_scan=""
+ local scan_ssid="1"
+ [ -n "$4" ] && freq="frequency=$4"
+
+ config_get enc "$vif" encryption
+ config_get key "$vif" key
+
+ local net_cfg bridge
+ config_get bridge "$vif" bridge
+ [ -z "$bridge" ] && {
+ net_cfg="$(find_net_config "$vif")"
+ [ -z "$net_cfg" ] || bridge="$(bridge_interface "$net_cfg")"
+ config_set "$vif" bridge "$bridge"
+ }
+
+ local mode ifname wds modestr=""
+ config_get mode "$vif" mode
+ config_get ifname "$vif" ifname
+ config_get_bool wds "$vif" wds 0
+ [ -z "$bridge" ] || [ "$mode" = ap ] || [ "$mode" = sta -a $wds -eq 1 ] || {
+ echo "wpa_supplicant_setup_vif($ifname): Refusing to bridge $mode mode interface"
+ return 1
+ }
+ [ "$mode" = "adhoc" ] && {
+ modestr="mode=1"
+ scan_ssid="0"
+ ap_scan="ap_scan=2"
+ }
+
+ key_mgmt='NONE'
+ case "$enc" in
+ *none*) ;;
+ *wep*)
+ config_get key "$vif" key
+ key="${key:-1}"
+ case "$key" in
+ [1234])
+ for idx in 1 2 3 4; do
+ local zidx
+ zidx=$(($idx - 1))
+ config_get ckey "$vif" "key${idx}"
+ [ -n "$ckey" ] && \
+ append "wep_key${zidx}" "wep_key${zidx}=$(prepare_key_wep "$ckey")"
+ done
+ wep_tx_keyidx="wep_tx_keyidx=$((key - 1))"
+ ;;
+ *)
+ wep_key0="wep_key0=$(prepare_key_wep "$key")"
+ wep_tx_keyidx="wep_tx_keyidx=0"
+ ;;
+ esac
+ ;;
+ *psk*)
+ key_mgmt='WPA-PSK'
+ # if you want to use PSK with a non-nl80211 driver you
+ # have to use WPA-NONE and wext driver for wpa_s
+ [ "$mode" = "adhoc" -a "$driver" != "nl80211" ] && {
+ key_mgmt='WPA-NONE'
+ driver='wext'
+ }
+ if [ ${#key} -eq 64 ]; then
+ passphrase="psk=${key}"
+ else
+ passphrase="psk=\"${key}\""
+ fi
+ case "$enc" in
+ *psk2*)
+ proto='proto=RSN'
+ config_get ieee80211w "$vif" ieee80211w
+ ;;
+ *psk*)
+ proto='proto=WPA'
+ ;;
+ esac
+ ;;
+ *wpa*|*8021x*)
+ proto='proto=WPA2'
+ key_mgmt='WPA-EAP'
+ config_get ieee80211w "$vif" ieee80211w
+ config_get ca_cert "$vif" ca_cert
+ config_get eap_type "$vif" eap_type
+ ca_cert=${ca_cert:+"ca_cert=\"$ca_cert\""}
+ case "$eap_type" in
+ tls)
+ pairwise='pairwise=CCMP'
+ group='group=CCMP'
+ config_get identity "$vif" identity
+ config_get client_cert "$vif" client_cert
+ config_get priv_key "$vif" priv_key
+ config_get priv_key_pwd "$vif" priv_key_pwd
+ identity="identity=\"$identity\""
+ client_cert="client_cert=\"$client_cert\""
+ priv_key="private_key=\"$priv_key\""
+ priv_key_pwd="private_key_passwd=\"$priv_key_pwd\""
+ ;;
+ peap|ttls)
+ config_get auth "$vif" auth
+ config_get identity "$vif" identity
+ config_get password "$vif" password
+ phase2="phase2=\"auth=${auth:-MSCHAPV2}\""
+ identity="identity=\"$identity\""
+ password="${password:+password=\"$password\"}"
+ ;;
+ esac
+ eap_type="eap=$(echo $eap_type | tr 'a-z' 'A-Z')"
+ ;;
+ esac
+
+ case "$ieee80211w" in
+ [012])
+ ieee80211w="ieee80211w=$ieee80211w"
+ ;;
+ esac
+
+ local fixed_freq bssid1 beacon_int brates mrate
+ config_get ifname "$vif" ifname
+ config_get bridge "$vif" bridge
+ config_get ssid "$vif" ssid
+ config_get bssid "$vif" bssid
+ bssid1=${bssid:+"bssid=$bssid"}
+ beacon_int=${beacon_int:+"beacon_int=$beacon_int"}
+
+ local br brval brsub brstr
+ [ -n "$basic_rate_list" ] && {
+ for br in $basic_rate_list; do
+ brval="$(($br / 1000))"
+ brsub="$((($br / 100) % 10))"
+ [ "$brsub" -gt 0 ] && brval="$brval.$brsub"
+ [ -n "$brstr" ] && brstr="$brstr,"
+ brstr="$brstr$brval"
+ done
+ brates=${basic_rate_list:+"rates=$brstr"}
+ }
+
+ local mcval=""
+ [ -n "$mcast_rate" ] && {
+ mcval="$(($mcast_rate / 1000))"
+ mcsub="$(( ($mcast_rate / 100) % 10 ))"
+ [ "$mcsub" -gt 0 ] && mcval="$mcval.$mcsub"
+ mrate=${mcast_rate:+"mcast_rate=$mcval"}
+ }
+
+ local ht_str
+ [ -n "$ht" ] && ht_str="htmode=$ht"
+
+ rm -rf /var/run/wpa_supplicant-$ifname
+ cat > /var/run/wpa_supplicant-$ifname.conf <<EOF
+ctrl_interface=/var/run/wpa_supplicant-$ifname
+$ap_scan
+network={
+ $modestr
+ scan_ssid=$scan_ssid
+ ssid="$ssid"
+ $bssid1
+ key_mgmt=$key_mgmt
+ $proto
+ $freq
+ ${fixed:+"fixed_freq=1"}
+ $beacon_int
+ $brates
+ $mrate
+ $ht_str
+ $ieee80211w
+ $passphrase
+ $pairwise
+ $group
+ $eap_type
+ $ca_cert
+ $client_cert
+ $priv_key
+ $priv_key_pwd
+ $phase2
+ $identity
+ $password
+ $wep_key0
+ $wep_key1
+ $wep_key2
+ $wep_key3
+ $wep_tx_keyidx
+}
+EOF
+ if [ -n "$proto" -o "$key_mgmt" == "NONE" ]; then
+# wpa_supplicant ${bridge:+ -b $bridge} -B -P "/var/run/wifi-${ifname}.pid" -D ${driver:-wext} -i "$ifname" -c /var/run/wpa_supplicant-$ifname.conf $options
+ else
+ return 0
+ fi
+}
diff --git a/package/ramips/drivers/mt7628sta/patches/001-openwrt-build.patch b/package/ramips/drivers/mt7628sta/patches/001-openwrt-build.patch
new file mode 100644
index 0000000..3429f57
--- /dev/null
+++ b/package/ramips/drivers/mt7628sta/patches/001-openwrt-build.patch
@@ -0,0 +1,20 @@
+Index: mt7628sta-4.0.1.4/mt_wifi_sta/Makefile
+===================================================================
+--- mt7628sta-4.0.1.4.orig/mt_wifi_sta/Makefile
++++ mt7628sta-4.0.1.4/mt_wifi_sta/Makefile
+@@ -1,10 +1,10 @@
+-EXTRA_CFLAGS = -Idrivers/net/wireless/mt_wifi/include \
+- -Idrivers/net/wireless/mt_wifi/embedded/include \
+- -Idrivers/net/wireless/mt_wifi/ate/include
++EXTRA_CFLAGS = -I$(src)/../mt_wifi/include \
++ -I$(src)/../mt_wifi/embedded/include \
++ -I$(src)/../mt_wifi/ate/include
+
+-DRV_NAME = mt_wifi
++DRV_NAME = mt7628sta
+ SRC_DIR = ../mt_wifi/embedded
+-obj-$(CONFIG_MT_STA_SUPPORT) += $(DRV_NAME).o
++obj-m += $(DRV_NAME).o
+
+ ########################################################
+ # Common files
diff --git a/package/ramips/drivers/mt7628sta/patches/002-path.patch b/package/ramips/drivers/mt7628sta/patches/002-path.patch
new file mode 100644
index 0000000..c23ed27
--- /dev/null
+++ b/package/ramips/drivers/mt7628sta/patches/002-path.patch
@@ -0,0 +1,31 @@
+Index: mt7628sta-4.0.1.4/mt_wifi/embedded/include/os/rt_linux.h
+===================================================================
+--- mt7628sta-4.0.1.4.orig/mt_wifi/embedded/include/os/rt_linux.h
++++ mt7628sta-4.0.1.4/mt_wifi/embedded/include/os/rt_linux.h
+@@ -174,7 +174,7 @@ typedef struct usb_ctrlrequest devctrlre
+
+ #ifdef CONFIG_STA_SUPPORT
+ #ifdef RTMP_MAC_PCI
+-#define STA_PROFILE_PATH "/etc/Wireless/RT2860STA/RT2860STA.dat"
++#define STA_PROFILE_PATH "/etc/wireless/mt7628sta/mt7628sta.dat"
+ #define STA_DRIVER_VERSION "4.0.1.4"
+ #ifdef MULTIPLE_CARD_SUPPORT
+ #define CARD_INFO_PATH "/etc/Wireless/RT2860STA/RT2860STACard.dat"
+@@ -194,7 +194,7 @@ typedef struct usb_ctrlrequest devctrlre
+ #ifdef RTMP_RBUS_SUPPORT
+ #define RTMP_FIRMWARE_FILE_NAME "/etc_ro/Wireless/RT2860STA/RT2860STA.bin"
+ #define PROFILE_PATH "/etc/Wireless/RT2860i.dat"
+-#define STA_PROFILE_PATH_RBUS "/etc/Wireless/RT2860/RT2860.dat"
++#define STA_PROFILE_PATH_RBUS "/etc/wireless/mt7628sta/mt7628sta.dat"
+ #define RT2880_STA_DRIVER_VERSION "4.0.1.4"
+ #endif /* RTMP_RBUS_SUPPORT */
+
+@@ -1689,7 +1689,7 @@ extern int rausb_control_msg(VOID *dev,
+ #ifdef CONFIG_AP_SUPPORT
+ #ifndef CONFIG_STA_SUPPORT /* avoid wrong usage when enabling P2P_SUPPORT */
+ #if defined(CONFIG_SUPPORT_OPENWRT)
+-#define EEPROM_BIN_FILE_NAME "/etc/wireless/mt7628/mt7628.eeprom.bin"
++#define EEPROM_BIN_FILE_NAME "/etc/wireless/mt7628/mt7628sta.eeprom.bin"
+ #else
+ #define EEPROM_BIN_FILE_NAME "/etc/Wireless/RT2860AP/e2p.bin"
+ #endif /* CONFIG_SUPPORT_OPENWRT */
diff --git a/package/ramips/drivers/mt7628sta/patches/003-log.patch b/package/ramips/drivers/mt7628sta/patches/003-log.patch
new file mode 100644
index 0000000..945003e
--- /dev/null
+++ b/package/ramips/drivers/mt7628sta/patches/003-log.patch
@@ -0,0 +1,30 @@
+Index: mt7628sta-4.0.1.4/mt_wifi/embedded/mcu/andes_mt.c
+===================================================================
+--- mt7628sta-4.0.1.4.orig/mt_wifi/embedded/mcu/andes_mt.c
++++ mt7628sta-4.0.1.4/mt_wifi/embedded/mcu/andes_mt.c
+@@ -4346,7 +4346,11 @@ error:
+ ret = AndesSendCmdMsg(pAd, msg);
+
+ error:
+- MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_ERROR, ("%s:(ret = %d)\n", __FUNCTION__, ret));
++ if (ret)
++ MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_ERROR, ("%s:(ret = %d)\n", __FUNCTION__, ret));
++ else
++ MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_LOUD, ("%s:(ret = %d)\n", __FUNCTION__, ret));
++
+ return ret;
+ }
+
+Index: mt7628sta-4.0.1.4/mt_wifi/hw_ctrl/cmm_asic_mt.c
+===================================================================
+--- mt7628sta-4.0.1.4.orig/mt_wifi/hw_ctrl/cmm_asic_mt.c
++++ mt7628sta-4.0.1.4/mt_wifi/hw_ctrl/cmm_asic_mt.c
+@@ -1225,7 +1225,7 @@ UINT32 MtAsicGetRetryLimit(RTMP_ADAPTER
+ VOID MtAsicSetSlotTime(RTMP_ADAPTER *pAd, UINT32 SlotTime, UINT32 SifsTime)
+ {
+ CmdSlotTimeSet(pAd,(UINT8)SlotTime,(UINT8)SifsTime,(UINT8)RIFS_TIME, EIFS_TIME);
+- MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_TRACE, ("%s(%d): SetSlotTime!\n",__FUNCTION__, __LINE__));
++ MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_LOUD, ("%s(%d): SetSlotTime!\n",__FUNCTION__, __LINE__));
+ }
+
+ #define MAX_RX_PKT_LENGTH 0x400 /* WORD(4 Bytes) unit */