Raspberry Pi 2でWiFiドングル PLANEX GW-450Dを使う

Raspbian jessi, kernel 4.1.10-v7+ を使っています。

neuralassemblyのメモ: Raspberry Pi + kernel 4.1 / 4.4 / 4.9 / 4.14 系列で5GHz対応WifiドングルGW-450D/GW-450D2/Archer T1U/WI-U2-433DMを動かした を参考にさせていただき、同じソースコード、同じパッチを使いました。
ただしセルフビルドでなくクロスビルドのために以下の変更をしました。

$ diff -u Makefile.org Makefile
--- Makefile.org	2013-09-16 23:03:08.000000000 +0900
+++ Makefile	2015-10-18 16:59:23.386655463 +0900
@@ -32,7 +32,7 @@
 RTMP_SRC_DIR = $(RT28xx_DIR)/RT$(MODULE)
 
 #PLATFORM: Target platform
-PLATFORM = PC
+#PLATFORM = PC
 #PLATFORM = 5VT
 #PLATFORM = IKANOS_V160
 #PLATFORM = IKANOS_V180
@@ -68,6 +68,7 @@
 #PLATFORM = RALINK_3352
 #PLATFORM = UBICOM_IPX8
 #PLATFORM = INTELP6
+PLATFORM = RASPBERRY_PI
 
 #APSOC
 ifeq ($(MODULE),3050)
@@ -105,6 +106,13 @@
 export MODULE
 endif
 
+ifeq ($(PLATFORM),RASPBERRY_PI)
+LINUX_SRC = $(HOME)/work/raspi/linux
+ARCH = arm
+export ARCH
+CROSS_COMPILE = arm-linux-gnueabihf-
+endif
+
 ifeq ($(PLATFORM),5VT)
 LINUX_SRC = /home/ralink-2860-sdk-5vt-distribution/linux-2.6.17
 CROSS_COMPILE = /opt/crosstool/uClibc_v5te_le_gcc_4_1_1/bin/arm-linux-
$ diff -u os/linux/config.mk.org os/linux/config.mk
--- os/linux/config.mk.org	2015-10-18 15:20:30.000000000 +0900
+++ os/linux/config.mk	2015-10-18 17:08:20.186201077 +0900
@@ -941,6 +941,10 @@
 WFLAGS += -DST
 endif
 
+ifeq ($(PLATFORM),RASPBERRY_PI)
+EXTRA_CFLAGS := $(WFLAGS)
+endif
+
 #kernel build options for 2.4
 # move to Makefile outside LINUX_SRC := /opt/star/kernel/linux-2.4.27-star

できたos/linux/mt7650u_sta.koをRaspberry Pi 2 の/lib/modules/4.1.10-v7+/ にコピーし、

$ sudo depmod

を実行して、モジュールの依存関係を更新します。
また、設定ファイルもRaspberry Pi 2にコピーします。

$ sudo mkdir -p /etc/Wireless/RT2870STA
$ sudo cp RT2870STA.dat /etc/Wireless/RT2870STA/RT2870STA.dat

/etc/network/interface に以下の行を追加します。

auto ra0
allow-hotplug ra0
iface ra0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

WiFiアクセスポイントの登録はRaspberry Pi 2でWiFiを使う - 組み込みの人。の通り。

これでPLANEX GW-450Dを挿したときのカーネルログは以下。

[  291.872361] usb 1-1.5: new high-speed USB device number 4 using dwc_otg
[  291.988871] usb 1-1.5: New USB device found, idVendor=2019, idProduct=ab31
[  291.988899] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  291.988917] usb 1-1.5: Product: GW-450D
[  291.988933] usb 1-1.5: Manufacturer: Planex
[  291.988949] usb 1-1.5: SerialNumber: 1.0
[  294.903179] rtusb init rt2870 --->
[  294.904227] 

=== pAd = bd282000, size = 857568 ===

[  294.904301] <-- RTMPAllocTxRxRingMemory, Status=0
[  294.904821] <-- RTMPAllocAdapterBlock, Status=0
[  294.905048] ==>RT65xx_WLAN_ChipOnOff(): OnOff:1, Reset= 0, pAd->WlanFunCtrl:0x0, Reg-WlanFunCtrl=0xff000002
[  294.906147] MCUType = 2
[  294.906396] NVM is EFUSE
[  294.906406] Endpoint(8) is for In-band Command
[  294.906415] Endpoint(4) is for WMM0 AC0
[  294.906422] Endpoint(5) is for WMM0 AC1
[  294.906430] Endpoint(6) is for WMM0 AC2
[  294.906437] Endpoint(7) is for WMM0 AC3
[  294.906444] Endpoint(9) is for WMM1 AC0
[  294.906451] Endpoint(84) is for Data-In
[  294.906459] Endpoint(85) is for Command Rsp
[  294.907663] usbcore: registered new interface driver rt2870
[  295.045978] -->RTUSBVenderReset
[  295.046095] <--RTUSBVenderReset
[  295.051116] fw version:0.1.00 build:7640
[  295.051135] build time:201308221655____
[  295.051180] ilm length = 68780(bytes)
[  295.051189] dlm length = 11476(bytes)
[  295.072423] #
[  295.080056] loading fw......
[  295.152448] #
[  295.371566] RTMP_TimerListAdd: add timer obj bd300b84!
[  295.371595] RTMP_TimerListAdd: add timer obj bd300bcc!
[  295.371605] RTMP_TimerListAdd: add timer obj bd300c14!
[  295.371614] RTMP_TimerListAdd: add timer obj bd300b3c!
[  295.371627] RTMP_TimerListAdd: add timer obj bd300a64!
[  295.371636] RTMP_TimerListAdd: add timer obj bd300aac!
[  295.371649] RTMP_TimerListAdd: add timer obj bd294c2c!
[  295.371659] RTMP_TimerListAdd: add timer obj bd28403c!
[  295.371668] RTMP_TimerListAdd: add timer obj bd284088!
[  295.371678] RTMP_TimerListAdd: add timer obj bd294d14!
[  295.371691] RTMP_TimerListAdd: add timer obj bd294b9c!
[  295.371707] RTMP_TimerListAdd: add timer obj bd294ccc!
[  295.382926] cfg_mode=5
[  295.382950] wmode_band_equal(): Band Not Equal!
[  295.383529] Key1Str is Invalid key length(0) or Type(0)
[  295.383591] Key2Str is Invalid key length(0) or Type(0)
[  295.383652] Key3Str is Invalid key length(0) or Type(0)
[  295.383715] Key4Str is Invalid key length(0) or Type(0)
[  295.384919] 1. Phy Mode = 31
[  295.384928] 2. Phy Mode = 31
[  295.384938] NVM is Efuse and its size =1d[1e0-1fc] 
[  295.396012] /home/koba/work/raspi/gw-450d_driver_linux_v3002/mt7610u_wifi_sta_v3002_dpo_20130916/os/linux/../../chips/mt76x0.c:2114 assert (pAd->TxPower[choffset].Channel == 36)failed
[  295.406380] ERROR!!! E2PROM: WRONG VERSION 0x2, should be 1
[  295.410472] mt76x0_read_tx_alc_info_from_eeprom: EEPROM_MT76x0_TEMPERATURE_OFFSET (0xD1) = 0xf8
[  295.410483] mt76x0_read_tx_alc_info_from_eeprom: TemperatureOffset = 0xfffffff8
[  295.410491] Temperature Tx ALC not enabled
[  295.427483] 3. Phy Mode = 31
[  295.427499] AntCfgInit: primary/secondary ant 0/1
[  295.432937] RTMPSetPhyMode: channel is out of range, use first channel=1 
[  295.434454] MCS Set = ff 00 00 00 01
[  295.444494] <==== rt28xx_init, Status=0
[  295.445463] 0x1300 = 00064300
[  295.445474] RTMPDrvSTAOpen(1):Check if PDMA is idle!
[  295.445795] RTMPDrvSTAOpen(2):Check if PDMA is idle!
[  295.449133] IOCTL::unknown IOCTL's cmd = 0x00008947
[  296.126395] /home/koba/work/raspi/gw-450d_driver_linux_v3002/mt7610u_wifi_sta_v3002_dpo_20130916/os/linux/../../common/cmm_asic.c:2112 assert KeyIdx < 4failed
[  296.126825] /home/koba/work/raspi/gw-450d_driver_linux_v3002/mt7610u_wifi_sta_v3002_dpo_20130916/os/linux/../../common/cmm_asic.c:2112 assert KeyIdx < 4failed
[  299.749434] ===>rt_ioctl_giwscan. 6(6) BSS returned, data->length = 957
[  299.750764] ==>rt_ioctl_siwfreq::SIOCSIWFREQ(Channel=8)
[  299.878216] PeerBeaconAtJoinAction(): HT-CtrlChannel=8, CentralChannel=>8
[  299.878236] PeerBeaconAtJoinAction(): Set CentralChannel=8
[  299.878253] AdjustChannelRelatedValue(): Input BW=0, rf_channel=8, vht_bw=1, Channel=8, vht_cent_ch=0!
[  300.149464] Rcv Wcid(1) AddBAReq
[  300.149486] Start Seq = 00000000
[  300.149502] RTMP_TimerListAdd: add timer obj bd34df0c!
[  300.222457] RTMP_TimerListAdd: add timer obj bd34b2f8!
[  305.672520] RTMP_TimerListAdd: add timer obj bd34b350!

assertionのfailed がいくつか出ていて気持ち悪いですが、とりあえず接続して使用可能です。

関連
Raspberry Pi 2でWiFiを使う - 組み込みの人。
Raspberry Pi 2のカーネルをビルドしてみた - 組み込みの人。