Android rt3070 or rt2x00

Материал из Toshiba AC100 wiki
Перейти к: навигация, поиск

Use rt3070 usb wifi module with rt2x00 kernel drivers in Android os

Prerequisites

  • Linux kernel working with your device in android
    • For example android start on device and everything work but rt3070 wifi
  • Ralink firmware binary
    • Maybe it is possible to override use of binary firmware

Android device setup

  • Place firmware binary to some folder of device tree
    • For example device/toshiba/paz00-common/prebuild/firmware/rt2870.bin
  • Copy firmware in board makefile
    • For example your device make file is ac100.mk, put this line into it
PRODUCT_COPY_FILES += device/toshiba/paz00-common/prebuild/firmware/rt2870.bin:system/vendor/firmware/rt2870.bin

syntax is copy_variable += binary_source_path:binary_destination_path

  • Add wifi section in BoardConfig.mk
    • My section is pretty complex but will give a clue
# Wifi related defines
USES_TI_MAC80211                        := false
USES_BCMHD_NL80211                      := true

ifdef USES_TI_MAC80211
BOARD_WPA_SUPPLICANT_DRIVER             := NL80211
WPA_SUPPLICANT_VERSION                  := VER_0_8_X
BOARD_WPA_SUPPLICANT_PRIVATE_LIB        := lib_driver_cmd_wl12xx
BOARD_HOSTAPD_DRIVER                    := NL80211
BOARD_HOSTAPD_PRIVATE_LIB               := lib_driver_cmd_wl12xx
BOARD_SOFTAP_DEVICE                     := wlan0
COMMON_GLOBAL_CFLAGS += -DUSES_TI_MAC80211
endif

ifdef USES_BCMHD_NL80211
BOARD_WPA_SUPPLICANT_DRIVER             := WEXT
WPA_SUPPLICANT_VERSION                  := VER_0_8_X
BOARD_WPA_SUPPLICANT_PRIVATE_LIB        := private_lib_driver_cmd
BOARD_HOSTAPD_DRIVER                    := WEXT
BOARD_HOSTAPD_PRIVATE_LIB               := private_lib_driver_cmd
# Unknow option
#BOARD_LEGACY_NL80211_STA_EVENTS        := true
endif

# Wifi base
BOARD_WLAN_DEVICE                       := wlan0
WIFI_DRIVER_MODULE_NAME                 := "rt2800usb"
WIFI_DRIVER_MODULE_PATH                 := "/system/lib/modules/rt2800usb.ko"
WIFI_DRIVER_MODULE_ARG                  := "nohwcrypt=1"
WIFI_DRIVER_FW_PATH_STA                 := "/system/vendor/firmware/rt2870.bin"
WIFI_DRIVER_FW_PATH_P2P                 := "/system/vendor/firmware/rt2870.bin"
WIFI_DRIVER_FW_PATH_AP                  := "/system/vendor/firmware/rt2870.bin"
WIFI_FIRMWARE_LOADER                    := ""

As im trying to use ti mac80211 private or broadcom bcmhd i made section for both of them


  • Add wpa_supplicant section to board init file
    • For example your board init file is init.paz00.rc then add this sections
service wpa_supplicant /system/bin/wpa_supplicant \
    -Dwext -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf -e/data/misc/wifi/entropy.bin
#   we will start as root and wpa_supplicant will switch to user wifi
#   after setting up the capabilities required for WEXT
#   user wifi
#   group wifi inet keystore
    class main
    socket wpa_wlan0 dgram 660 wifi wifi
    disabled
    oneshot

service p2p_supplicant /system/bin/wpa_supplicant \
    -Dwext -iwlan0 -puse_p2p_group_interface=1 -c/data/misc/wifi/wpa_supplicant.conf
# we will start as root and wpa_supplicant will switch to user wifi
# after setting up the capabilities required for WEXT
# user wifi
# group wifi inet keystore
    class main
    socket wpa_eth0 dgram 660 wifi wifi
    disabled
    oneshot

service hostapd /system/bin/hostapd /data/misc/wifi/hostapd.conf
    socket wpa_wlan0 dgram 660 wifi wifi
    class main
    oneshot
    disabled

service dhcpcd_wlan0 /system/bin/dhcpcd -ABKL
    class main
    disabled
    oneshot

service iprenew_wlan0 /system/bin/dhcpcd -n
    class main
    disabled
    oneshot
      • For TI private lib replace -Dwext with -Dnl80211
  • Find usable wpa_supplicant private lib
    • As of starting from Android 4.x aka ICS it use new wpa_supplicant fork from Broadcom, you need separate lib

to make your device work with wpa_supplicant

      • Perfect way is to know all the driver kitchen and to write own lib fully compatible with device driver
      • I fount that TI wl12x and Broadcom BCMHD private libs works somehow with rt3070 usb device, both need

small patches to compile but nothing serious

        • Place private lib to device tree

Status

  • For with kernel 3.1 all this is working but not perfect (lower connect distance, sporadic reconnects)
    • Dunno who exacly in charge rt2x00 kernel driver or android wpa_supplicant fork, i prefer to think its wpa_supplicant

as in linux with same kernel and hardware people have much less problems