problem to add rtl8192cu to kitkat on imx6q

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

problem to add rtl8192cu to kitkat on imx6q

3,826件の閲覧回数
kimsuhak
Contributor I

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?

ラベル(2)
タグ(4)
0 件の賞賛
返信
3 返答(返信)

996件の閲覧回数
evgenymolchanov
Contributor III

Also I found one mistake in you hardware/libhardware_legacy/wifi/Android.mk:

used BOARD_WLAN_VENDOR,

but in you BoardConfig.mk you set BOARD_WIFI_VENDOR

0 件の賞賛
返信

996件の閲覧回数
evgenymolchanov
Contributor III

Hello kim,

Did you solved problem with rtl8192cu?

If yes, could you please be so kind to share how to.

Thank you.

0 件の賞賛
返信

996件の閲覧回数
zoranl
Contributor III

Were you able to solve this?

It seams that services arnt started with system initialization.

Did you try to start manually wpa_supplicant?

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

(-dd means extra debugging info)

What does the logcat say?

When you plug driver, does it get recognized?

cat /sys/kernel/debug/usb/devices

Did you fix wifi_start_supplicant and  wifi_stop_supplicant?

in frameworks, they added IFNAME=...

We are not using p2p0, so I just changed:

vim frameworks/base/wifi/java/android/net/wifi/WifiMonitor.java

        public void run() {

.................

                } else {

                    // events without prefix belong to p2p0 monitor

                    //m = mWifiMonitorSingleton.getMonitor("p2p0");

                    m = mWifiMonitorSingleton.getMonitor("wlan0");

                }

Enable Debug and add this:

                } else {

                    if (DBG) Log.d(TAG, "Sending to all monitors because there's no interface id:" + iface);

And comment all reference to IFNAME=:

(doBooleanCommandNative=>doBooleanCommand)

vim frameworks/base/wifi/java/android/net/wifi/WifiNative.java

    public WifiNative(String interfaceName) {

        mInterfaceName = interfaceName;

        mTAG = "WifiNative-" + interfaceName;

            mInterfacePrefix = "";

    }

    public boolean startWpsPbc(String iface, String bssid) {

        if (TextUtils.isEmpty(bssid)) {

            return doBooleanCommand("WPS_PBC interface=" + iface);

        } else {

            return doBooleanCommand("WPS_PBC interface=" + iface + " " + bssid);

        }

    }

    public boolean startWpsPinKeypad(String iface, String pin) {

        if (TextUtils.isEmpty(pin)) return false;

        return doBooleanCommand("WPS_PIN interface=" + iface + " any " + pin);

    }

    public boolean startWpsPinKeypad(String iface, String pin) {

        if (TextUtils.isEmpty(pin)) return false;

        return doBooleanCommand("WPS_PIN interface=" + iface + " any " + pin);

    }

    public boolean setP2pGroupIdle(String iface, int time) {

        return doBooleanCommand("SET interface=" + iface + " p2p_group_idle " + time);

    }

    public boolean setP2pPowerSave(String iface, boolean enabled) {

        if (enabled) {

            return doBooleanCommand("P2P_SET interface=" + iface + " ps 1");

        } else {

            return doBooleanCommand("P2P_SET interface=" + iface + " ps 0");

        }

    }

    public boolean p2pGroupRemove(String iface) {

        if (TextUtils.isEmpty(iface)) return false;

        return doBooleanCommand("P2P_GROUP_REMOVE " + iface);

    }

This wifi chip works with KitKat, for sure :-).

BR,

Zoran

0 件の賞賛
返信