AnsweredAssumed Answered

problem to add rtl8192cu to kitkat on imx6q

Question asked by kim suhak on Sep 15, 2014
Latest reply on Dec 4, 2015 by Evgeny Molchanov

hello,

 

I'm trying to add rtl8192cu to kitkat on imx6q.

 

I referenced the question "wifi binding on imx6sl evk based board"

 

rtl8192cu is a wifi module (USB type)

 

the following is what I did.

======================================================

first, I modified kernel configuration (menuconfig)

actually, in kernel_imx, RTL8192CU is just commented.

so I removed "//" and activated it.

and I checked as built in.

 

CONFIG_CFG80211=y

CONFIG_MAC80211_MESH=y

CONFIG_MAC80211=y

CONFIG_HOSTAP=y

CONFIG_RTL8192CU=y

CONFIG_RTLWIFI=y

CONFIG_RTL8192C_COMMON=y

CONFIG_USB_USBNET=y

CONFIG_NET_RADIO=y


second, I modified device/fsl/sabreauto_6q/BoardConfig.mk

 

I removed UNITE parts and add the following.

BOARD_WIFI_VENDOR := realtek

WPA_SUPPLICANT_VERSION := VER_0_8_X

CONFIG_DRIVER_NL80211 := true

 

BOARD_WPA_SUPPLICANT_DRIVER := NL80211

BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_rtl

BOARD_HOSTAPD_DRIVER := NL80211

BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_rtl

 

BOARD_WLAN_DEVICE := rtl8192cu

 

WIFI_DRIVER_MODULE_NAME := "wlan0"

WIFI_DRIVER_MODULE_PATH := ""

WIFI_DRIVER_MODULE_ARG := ""

 

WIFI_FIRMWARE_LOADER := ""

WIFI_DRIVER_FW_PATH_STA := ""

WIFI_DRIVER_FW_PATH_AP := ""

WIFI_DRIVER_FW_PATH_P2P := ""

WIFI_DRIVER_FW_PATH_PARAM := ""

 

third, I modified device/fsl/imx6/etc/init.rc

 

    # give system access to wpa_supplicant.conf for backup and restore

    mkdir /system/etc/wifi 0770 wifi wifi             

    chmod 0770 /system/etc/wifi                                 

    chmod 0660 /system/etc/wifi/wpa_supplicant.conf                 

    chown wifi wifi /system/etc/wifi/wpa_supplicant.conf

#wpa_supplicant control socket for android wifi.c (android private socket)

    mkdir /data/misc/wifi 0770 wifi wifi

    mkdir /data/misc/wifi/sockets 0770 wifi wifi

    chmod 0770 /data/misc/wifi

    chmod 0660 /data/misc/wifi/wpa_supplicant.conf       

    chown wifi wifi /data/misc/wifi

    chown wifi wifi /data/misc/wifi/wpa_supplicant.conf

 

    mkdir /data/local 0751 root root         

    mkdir /data/misc/media 0700 media media

.......

.......

# Prepare for wifi                                   

    setprop wifi.interface wlan0                

#setprop wifi.ap.interface wlan0           

    setprop wlan.driver.status "ok"

 

forth, I modified device/fsl/imx6/imx6q.mk

 

 

I added this

  PRODUCT_PACKAGES += rtw_suppl

 

fifth, I modified device/fsl/sabreauto_6q/required_hardware.xml

I added this

 

<feature name="android.hardware.wifi" />

 

sixth, I modified device/fsl/sabreauto_6q/init.rc

I added following

service rtw_suppl_con /system/bin/wpa_supplicant \

    -ip2p0 -Dnl80211 -c /data/misc/wifi/p2p_supplicant.conf -e/data/misc/wifi/entropy.bin -N \

    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf

    class main

    disabled

    oneshot

service rtw_suppl /system/bin/wpa_supplicant -iwlan0 -Dnl80211

    -c/data/misc/wifi/wpa_supplicant.conf

    socket wpa_wlan0 dgram 660 wifi wifi

    class main

    disabled

    oneshot

service dhcpcd_wlan0 /system/bin/dhcpcd -aABKL

    class main

    disabled

    oneshot

service dhcpcd_p2p /system/bin/dhcpcd -aABKL

    class main

    disabled

    oneshot

service iprenew_wlan0 /system/bin/dhcpcd -n

    class main

    disabled

    oneshot

service iprenew_p2p /system/bin/dhcpcd -n

    class main

    disabled

    oneshot


seventh, I modified hardware/libhardware_legacy/wifi/Android.mk

I added following

LOCAL_CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_DIR=\"/data/misc/wifi/sockets\"

LOCAL_CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_PREFIX=\"wpa_ctrl\"


and modified

ifeq ($(BOARD_WLAN_VENDOR),REALTEK)

LOCAL_SRC_FILES += wifi/wifi_realtek.c

LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../external/wpa_supplicant_8/src/common

else

  LOCAL_SRC_FILES += wifi/wifi.c

  LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../external/wpa_supplicant_8/src/common

endif

 

======================================================

BUT, I get errors from wifi_realtek.c.

there are 2 kinds

one is that some functions have unmatched number of arguments cuz of ifname (wifi.h has no arguments for ifname)

I think wlan0 shoud be a primary interface. so I remove the argument, ifname temporarily  to avoid compile error

etc, wifi_command...

 

//int wifi_command(const char *ifname, const char *command, char *reply, size_t *reply_len)

int wifi_command( const char *command, char *reply, size_t *reply_len)

{

    //if (is_primary_interface(ifname)) {

        return wifi_send_command(PRIMARY, command, reply, reply_len);

    //} else {

        //return wifi_send_command(SECONDARY, command, reply, reply_len);

    //}

}

another one, in wifi_start_supplicant, there is an unknown param type.

    pi = __system_property_find(supplicant_prop_name);

    if (pi != NULL) {

        //serial = pi->serial;                <================== origin code

        serial = __system_property_serial(pi); <================== new code

    }

======================================================

after that, I built android kitkat and write on SD card.

but wifi is not working.

If I set the wifi on, in logcat,

D/WifiService( 2401): setWifiEnabled: true pid=2561, uid=1000

this message is shown up.

after that,  no messages anymore.

I added permission for wifi at system/etc/permissions/platrorm.xml,

    <permission name="android.permission.ACCESS_WIFI_STATE" >

        <group gid="wifi" />

    <permission name="android.permission.CHANGE_WIFI_STATE" >

        <group gid="wifi" />

    <permission name="android.permission.WIFI" >

        <group gid="wifi" />

but, still doesn't work

 

======================================================

there are more informations

 

cat /data/misc/wifi/wpa_supplicant.conf

ctrl_interface=wlan0

update_config=1

device_name=sabreauto

manufacturer=Freescale

model_name=sabreauto

model_number=sabreauto

serial_number=

device_type=10-0050F204-5

config_methods=physical_display virtual_push_button

 

network={

   ssid="xxx"

        psk="xxx"

        key_mgmt=WPA-PSK

        proto=RSN WPA

        pairwise=CCMP TKIP

        group=CCMP TKIP

}

cat system/etc/wifi/wpa_supplicant.conf                 

update_config=1

ctrl_interface=wlan0

eapol_version=1

ap_scan=1

fast_reauth=1

config_methods=virtual_push_button physical_display keypad

persistent_reconnect=1

 

But no results for

- ps | grep wpa

- getprop | grep  suppl

 

 

do u have any ideas?

Outcomes