wifi binding on imx6sl evk based board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

wifi binding on imx6sl evk based board

Jump to solution
52,372 Views
zoranl
Contributor III

We are having problem with board that is based on imx6sl evk and rtl8192cu (chip on wifi module is RTL8188CTV). The wifi module is on USB interface.
We integrated rtl8192cu driver from another package, we used manual supplied by realtek to integrate there driver into android (from zip file
RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911.zip pdf file \android_ref_codes_JB_4.2\Realtek_Wi-Fi_SDK_for_Android_JB_4_2.pdf).


The driver is build as part of the kernel, not module. We used there's wpa_supplicant, that came with realteks package (wpa_supplicant_8_jb_4.2_rtw_r8680.20130821.tar.gz).


Package is from this site: http://www.realtek.com/downloads/downloadsView.aspx?Langid=2&PFid=48&Level=5&Conn=4&ProdID=277&DownT...

RTL8192CU for Linux/Android

Firmware is from this link: rtl819x - Linux Wireless


Using serial interface terminal, we tested the wlan0 interface,  we can bring it up, and get ip number:


root@evk_6sl:/ # cat /sys/kernel/debug/usb/devices


T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0

D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1

P:  Vendor=0bda ProdID=8176 Rev= 2.00

S:  Manufacturer=Realtek

S:  Product=802.11n WLAN Adapter

S:  SerialNumber=00e04c000001

C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=500mA

I:* If#= 0 Alt= 0 #EPs= 4 Cls=ff(vend.) Sub=ff Prot=ff Driver=rtl8192cu

E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

E:  Ad=84(I) Atr=03(Int.) MxPS=  64 Ivl=125us


root@evk_6sl:/ # dhcpcd wlan0

dhcpcd[2859]: version 5.5.6 start+871x_drv - drv_open, bup=0

===> FirmwareDownload91C() fw:Rtl819XFwImageArray_UMC_B

FirmwareDownload92C accquire FW from embedded image

fw_ver=v80, fw_subver=0, sig=0x88c0

fw download ok!

Set RF Chip ID to RF_6052 and RF type to 1T1R.

IQK:Start!!!

Path A IQK Success!!

Path A IQK Success!!

IQK: final_candidate is 0

IQK: RegE94=103 RegE9C=f RegEA4=fb RegEAC=5 RegEB4=0 RegEBC=0 RegEC4=0 RegECC=0

Path A IQ Calibration Success !

pdmpriv->TxPowerTrackControl = 1

MAC Address from REG_MACID = 44:33:4c:8b:f2:10

rtl8192cu_hal_init in 610ms

MAC Address = 44:33:4c:8b:f2:10

-871x_drv - drv_open, bup=1

ADDRCONF(NETDEV_UP): wlan0: link is not ready

dhcpcd[2859]: wlan0: checking for 169.254.169.141

dhcpcd[2859]: wlan0: using IPv4LL address 169.254.169.141

dhcpcd[2859]: forked to background, child pid 2885



root@evk_6sl:/ # ifconfig wlan0

wlan0: ip 169.254.169.141 mask 255.255.0.0 flags [up broadcast running multicast]


root@evk_6sl:/ # netcfg

lo       UP                                   127.0.0.1/8   0x00000049 00:00:00:00:00:00

eth0     UP                               192.168.0.152/24  0x00001043 24:80:00:00:00:00

tunl0    DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00

sit0     DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00

ip6tnl0  DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00

wlan0    UP                             169.254.169.141/16  0x00001043 44:33:4c:8b:f2:10


We need to use dhcpcd wlan0 command, the suggested init.rs service doesn't work, but thats not the problem.


Our problem is that binding from android ui and kernel isnt working.

When we tried to turn on wifi, from Settings>Wifi in Android UI, the slider button can move and change to On state, but the message on display "To see available networks, turn WiFi on" is still there.

in logcat we get:

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

After that we can't move slider back.

When we exit that menu and return, the slider is back in Off state.



Using wifi from shell, we can get all the other wifi networks:


root@evk_6sl:/data # ./xbin/iwlist wlan0 scanning

survey done event(18)

wlan0     Scan completed :

         Cell 01 - Address: BC:AE:C5:C4:3B:F7

                   ESSID:"Automatic"

                   Protocol:IEEE 802.11bg

                   Mode:Master

                   Frequency:2.412 GHz (Channel 1)

                   Encryption key:on

                   Bit Rates:54 Mb/s

                   Quality=59/100  Signal level=-95 dBm

         Cell 02 - Address: 68:7F:74:01:C6:BE

                   ESSID:""

                   Protocol:IEEE 802.11bg

                   Mode:Master

                   Frequency:2.432 GHz (Channel 5)

                   Encryption key:off

                   Bit Rates:54 Mb/s

                   Quality=100/100  Signal level=-55 dBm

         Cell 03 - Address: 20:AA:4B:1B:A1:7C

                   ESSID:"TEST"

                   Protocol:IEEE 802.11bgn

                   Mode:Master

                   Frequency:2.437 GHz (Channel 6)

                   Encryption key:off

                   Bit Rates:144 Mb/s

                   IE: Unknown: DD750050F204104A0001101044000102103B0001031047001020AA4B1BA17A20AA4B1BA17A022AC107102100104C696E6B73797320627920436973636F102300085752543136304E4C1024000776312E302E303210420001351054000800060050F2040001101100085752543136304E4C100800020084

                   Quality=100/100  Signal level=-71 dBm

         Cell 04 - Address: 00:1D:7E:BD:10:05

                   ESSID:"alt02"

                   Protocol:IEEE 802.11bg

                   Mode:Master

                   Frequency:2.457 GHz (Channel 10)

                   Encryption key:on

                   Bit Rates:54 Mb/s

                   Extra:wpa_ie=dd180050f20101000050f20201000050f20201000050f2020c00

                   IE: WPA Version 1

                       Group Cipher : TKIP

                       Pairwise Ciphers (1) : TKIP

                       Authentication Suites (1) : PSK

                   Quality=100/100  Signal level=-74 dBm

         Cell 05 - Address: 00:18:F8:3B:F1:0A

                   ESSID:"alt1"

                   Protocol:IEEE 802.11bg

                   Mode:Master

                   Frequency:2.462 GHz (Channel 11)

                   Encryption key:on

                   Bit Rates:54 Mb/s

                   Quality=101/100  Signal level=-95 dBm



We also added permissions for wifi in android ..


Please, ask me if you need more details, I kept track of all the changed done in the android and kernel.

Logcat with DBG for classes in wifi is also available.


Does anyone have any idea about this problem? Could you help us, please? We wasted a lot of time on this.


0 Kudos
Reply
1 Solution
30,359 Views
zoranl
Contributor III

Yes, we manage to get wifi working. Here are info's in more detail, so if anybody else has problem ...


We build driver as part of the kernel:

vim kernel_imx/arch/arm/configs/imx6s_{yourdevice}_android_defconfig

CONFIG_CFG80211=y


CONFIG_MAC80211_MESH=y

CONFIG_MAC80211=y


CONFIG_HOSTAP=y

CONFIG_RTL8192CU=y

CONFIG_RTLWIFI=y

CONFIG_RTL8192C_COMMON=y

#CONFIG_RTL8723AS=m

CONFIG_USB_USBNET=y

CONFIG_NET_RADIO=y


vim device/fsl/{yourdevice}/BoardConfig.mk


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 := ""




We disabled p2p, since we dont need it:

vim device/fsl/imx6/{yourboard}.mk

PRODUCT_COPY_FILES += \

#frameworks/native/data/etc/android.hardware.wifi.direct.xml:system/etc/permissions/android.hardware.wifi.direct.xml


or

rm out/target/product/{yourboard}/system/etc/permissions/android.hardware.wifi.direct.xml


or just remount system partition:

root@{yourboard}:/ # mount -o remount, rw /system;

and remove xml:

root@{yourboard}:/ # rm /system/etc/permissions/android.hardware.wifi.direct.xml



edit:

root@{yourboard}:/ # busybox vi system/etc/permissions/required_hardware.xml

or

vim device/fsl/{yourboard}/required_hardware.xml

or

vim out/target/product/{yourboard}/system/etc/permissions/required_hardware.xml

<!--

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

-->


If you use it as module, you will need to add it also in PRODUCT_COPY_FILES


You need to correct init scripts, leave just this lines:

(this is from: http://blog.linuxconsulting.ro/2010/04/porting-wifi-drivers-to-android.html )


You can do it directly to out folder:

vim out/target/product/{yourboard}/root/init.rc

or/and (rebuild the whole system):

vim device/fsl/imx6/imx6.mk


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


    setprop wifi.interface wlan0

    setprop wlan.driver.status "ok"

   #setprop wifi.ap.interface wlan0


#and also remove this lines:

#    mkdir /data/system/wpa_supplicant 0771 wifi wifi

#    chmod 0771 /data/system/wpa_supplicant

#    symlink /data/misc/wifi/wpa_supplicant /data/system/wpa_supplicant


you can read it in that blog link, about unix/android standard socket setup.



vim out/target/product/{yourboard}/root/init.freescale.rc

or/and

vim device/fsl/{yourboard}/init.rc


#this is the only supplicant service and dhcpcd service for wifi that we use:

service rtw_suppl /system/bin/wpa_supplicant -dd -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 iprenew_wlan0 /system/bin/dhcpcd -n

    class main

    disabled

    oneshot



To keep it clean (it doesnt effect wifi):

vim device/fsl/imx6/imx6.mk


PRODUCT_PACKAGES += \

       rtw_suppl               \



We needed to make a little change in wifi_realtek.c since our jb is 4.3:


vim hardware/realtek/wlan/libhardware_legacy/wifi/wifi_realtek.c

int wifi_start_supplicant(int p2p_supported)

..

    wifi_stop_supplicant(p2p_supported);

….


int wifi_stop_supplicant(int p2p_supported){

    char supp_status[PROPERTY_VALUE_MAX] = {'\0'};

    int count = 50; /* wait at most 5 seconds for completion */


    if (p2p_supported) {

        property_get("wifi.supplicant", supplicant_name, P2P_SUPPLICANT_NAME);

        snprintf(supplicant_prop_name, PROPERTY_KEY_MAX, P2P_PROP_NAME, supplicant_name);

    } else {

        property_get("wifi.supplicant", supplicant_name, SUPPLICANT_NAME);

        snprintf(supplicant_prop_name, PROPERTY_KEY_MAX, SUPP_PROP_NAME, supplicant_name);

    }



Our problem was wrong supplicant name in prop setup. And, when wifi starts it first stops supplicant, and it wasn’t able to transfer that info through system. It was quite fun tracking this problem.


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

mWifiNative.killSupplicant(mP2pSupported);

if(mWifiNative.startSupplicant(mP2pSupported)) {

                            setWifiState(WIFI_STATE_ENABLING);

                            if (DBG) log("Supplicant start successful");

                            mWifiMonitor.startMonitoring();

                            transitionTo(mSupplicantStartingState);

                        } else {

                            loge("Failed to start supplicant!!");

                        }



Here are more info:


root@{yourdevice}:/ # cat /data/misc/wifi/wpa_supplicant.conf

ctrl_interface=wlan0

update_config=1

device_name={yourdevice}

manufacturer=Freescale

model_name={YOURDEVICE}

model_number={YOURDEVICE}

serial_number=

device_type=10-0050F204-5

config_methods=physical_display virtual_push_button


network={

        ssid="XXXXX"

        key_mgmt=NONE

        priority=1

}



and it started with:

root@{yourdevice}:/ # cat system/etc/wifi/wpa_supplicant.conf

update_config=1

ctrl_interface=wlan0

eapol_version=1

ap_scan=1

fast_reauth=1



permissions:

root@{yourdevice}:/ # ls -l /data/misc/wifi

-rw-rw---- system   wifi           21 2014-05-27 12:39 entropy.bin

drwxrwx--- wifi     wifi              2014-05-27 12:39 sockets

-rw------- system   system         33 2014-05-27 12:39 softap.conf

-rw-rw---- wifi     wifi          272 2014-05-27 12:39 wpa_supplicant.conf


root@{yourboard}:/ # ls -l /data/misc/

drwxr-s--- system   shell             2014-05-27 12:39 adb

drwxrwx--- bluetooth net_bt_stack          2014-05-27 12:39 bluedroid

drwxrwx--- system   system            2014-05-27 12:39 bluetooth

drwxrwx--- dhcp     dhcp              2014-05-27 12:39 dhcp

drwxrwx--x system   system            2014-05-27 12:39 keychain

drwx------ keystore keystore          2014-05-27 12:39 keystore

drwx------ media    media             2014-05-27 12:39 media

drwxrwx--- system   radio             2014-05-27 12:39 radio

drwxrwx--- system   radio             2014-05-27 12:39 sms

drwx------ system   system            2014-05-27 12:39 systemkeys

drwxrwx--- system   vpn               2014-05-27 12:39 vpn

drwxrwx--- wifi     wifi              2014-05-27 12:39 wifi

drwxrwxr-x system   system            2014-05-27 12:39 zoneinfo


root@{yourboard}:/ # ls -l /system/etc/wifi

-rw-rw---- wifi     wifi           77 2014-05-27 12:39 wpa_supplicant.conf



root@{yourboard}:/ # ps | grep wpa

wifi      2555  1     3104   1876  c0103edc 401a4448 S /system/bin/wpa_supplicant



root@{yourboard}:/ # cat system/etc/permissions/platform.xml | grep -i wifi

    <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" />




root@{yourboard}:/ # cat system/etc/permissions/required_hardware.xml | grep wifi

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




root@{yourboard}:/ # getprop | grep  wifi

[net.tcp.buffersize.wifi]: [524288,1048576,2097152,262144,524288,1048576]

[ro.wifi.channels]: []

[wifi.interface]: [wlan0]


root@{yourboard}:/ # getprop | grep  wlan

[dhcp.wlan0.dns1]: [192.168.1.1]

[dhcp.wlan0.dns2]: []

[dhcp.wlan0.dns3]: []

[dhcp.wlan0.dns4]: []

[dhcp.wlan0.domain]: []

[dhcp.wlan0.gateway]: [192.168.1.1]

[dhcp.wlan0.ipaddress]: [192.168.1.118]

[dhcp.wlan0.leasetime]: [86400]

[dhcp.wlan0.mask]: [255.255.255.0]

[dhcp.wlan0.pid]: [2689]

[dhcp.wlan0.reason]: [REBOOT]

[dhcp.wlan0.result]: [ok]

[dhcp.wlan0.server]: [192.168.1.1]

[dhcp.wlan0.vendorInfo]: []

[init.svc.dhcpcd_wlan0]: [running]

[wifi.interface]: [wlan0]

[wlan.driver.status]: [ok]

[wlan.interface]: [wlan0]



root@{yourboard}:/ # getprop | grep  suppl

[init.svc.rtw_suppl]: [running]



root@{yourboard}:/ # cat /sys/kernel/debug/usb/devices

T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0

D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1

P:  Vendor=0bda ProdID=8176 Rev= 2.00

S:  Manufacturer=Realtek

S:  Product=802.11n WLAN Adapter

S:  SerialNumber=00e04c000001

C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=500mA

I:* If#= 0 Alt= 0 #EPs= 4 Cls=ff(vend.) Sub=ff Prot=ff Driver=rtl8192cu

E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

E:  Ad=84(I) Atr=03(Int.) MxPS=  64 Ivl=125us


root@{yourboard}:/ # cat /sys/bus/usb/devices/2-1/product

802.11n WLAN Adapter



Useful commands:


disable wifi:

root@{yourboard}:/ # svc wifi disable

enable wifi:

root@{yourboard}:/ # svc wifi enable



open wifi settings panel:

root@{yourboard}:/ # am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings


manually starting supplicant with debug:

root@{yourboard}:/ # wpa_supplicant -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf -dd -B


root@{yourboard}:/ # netcfg wlan0 up/down/dhcp


root@{yourboard}:/ # wpa_cli

> status

bssid=20:aa:4b:1b:a1:7c

ssid=ECTEST

id=0

mode=station

pairwise_cipher=NONE

group_cipher=NONE

key_mgmt=NONE

wpa_state=COMPLETED

ip_address=192.168.1.118

p2p_device_address=44:34:4c:8b:f2:10

address=44:34:4c:8b:f2:10

<3>CTRL-EVENT-STATE-CHANGE id=0 state=9 BSSID=20:aa:4b:1b:a1:7c SSID=ECTEST

<3>CTRL-EVENT-CONNECTED - connection to 20:aa:4b:1b:a1:7c completed (reauth) [id=0 id_str=]

> scan

cfg80211_rtw_scan(wlan0)

OK

> no packet in tx packet buffer (0)

survey done event(14) band:0 for wlan0

<3>CTRL-EVENT-SCAN-RESULTS

> scan_results

bssid / frequency / signal level / flags / ssid

20:aa:1b:1b:a1:7c       2437    -74     [WPS][ESS]      ECTEST

00:1d:3e:bd:10:05       2457    -85     [WPA-PSK-TKIP][ESS]     net02

68:7f:74:03:c6:be       2432    -59     [ESS]   \x00\x00\x00\x00

c8:23:73:3f:05:71       2462    -66     [ESS]   Nick's router. Hands off.



root@{yourboard}:/ # ifconfig wlan0

wlan0: ip 192.168.1.118 mask 255.255.255.0 flags [up broadcast running multicast]



root@{yourboard}:/ # dhcpcd wlan0

dhcpcd[3373]: version 5.5.6 starting

dhcpcd[3373]: wlan0: rebinding lease of 192.168.1.118

dhcpcd[3373]: wlan0: acknowledged 192.168.1.118 from 192.168.1.1

dhcpcd[3373]: wlan0: leased 192.168.1.118 for 86400 seconds

dhcpcd[3373]: forked to background, child pid 3405

root@{yourboard}:/ # netcfg

lo       UP                                   127.0.0.1/8   0x00000049 00:00:00:00:00:00

eth0     UP                               192.168.0.152/24  0x00001043 24:80:00:00:00:00

tunl0    DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00

sit0     DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00

ip6tnl0  DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00

wlan0    UP                               192.168.1.118/24  0x00001043 44:34:4c:8b:f2:10

wlan1    DOWN                                   0.0.0.0/0   0x00001002 46:34:4c:8b:f2:10

Good luck with it and please let me know if you need more info.




problem/solution:



if you get this problem:

E/wpa_supplicant( 3159): Could not set interface wlan0 flags (UP): Unknown error 132


solution:

missing rfkill, error 132 means "operation not possible due to RFkill"

vim kernel_imx/arch/arm/mach-mx6/board-mx6sl_{yourboard}.c

static int mx6sl_shd_bt_power_change(int status){return 0;}

static struct platform_device mxc_bt_rfkill = {

  .name = "mxc_bt_rfkill",

};

static struct imx_bt_rfkill_platform_data mxc_bt_rfkill_data = {

  .power_change = mx6sl_shd_bt_power_change,

};


/* init function  */

static void __init {yourboard}_init(void){

     ...

     mxc_register_device(&mxc_bt_rfkill, &mxc_bt_rfkill_data);

}


problem:

E/WifiHW ( 2488): Unable to open connection to supplicant on "/data/system/wpa_supplicant/wlan0": No such file or directory

solution:

setup correctly in init.rc and init.freescale.rc scripts wifi and wpa_supplicant permissions and services.



View solution in original post

0 Kudos
Reply
46 Replies
26,694 Views
arunsrk91
Contributor II

Hi,

I am trying to bring up wifi in i.mx6 sabreauto6q board using Netgear usb dongle. Can any one please help me with Boardconfig.mk file for adding support for ath9k?

This is my configuration:

#BOARD_WLAN_DEVICE        := UNITE
#WPA_SUPPLICANT_VERSION   := VER_0_8_UNITE
TARGET_KERNEL_MODULES     := \
                            kernel_imx/drivers/net/wireless/rtl8723as/8723as.ko:system/lib/modules/8723as.ko \
                            kernel_imx/net/wireless/cfg80211.ko:system/lib/modules/cfg80211_realtek.ko

BOARD_WPA_SUPPLICANT_DRIVER  := NL80211

BOARD_HOSTAPD_DRIVER     := NL80211

BOARD_HOSTAPD_PRIVATE_LIB_QCOM          := lib_driver_cmd_qcwcn
BOARD_WPA_SUPPLICANT_PRIVATE_LIB_QCOM   := lib_driver_cmd_qcwcn
BOARD_HOSTAPD_PRIVATE_LIB_RTL           := lib_driver_cmd_rtl
BOARD_WPA_SUPPLICANT_PRIVATE_LIB_RTL    := lib_driver_cmd_rtl

# Wifi

BOARD_WLAN_VENDOR    := ATHEROS

# for atheros vendor

ifeq ($(BOARD_WLAN_VENDOR),ATHEROS)

BOARD_WLAN_DEVICE    := ar9485
BOARD_HAS_ATH_WLAN    := true
WPA_SUPPLICANT_VERSION    := VER_0_8_ATHEROS

BOARD_WPA_SUPPLICANT_DRIVER     := NL80211

#BOARD_HOSTAPD_PRIVATE_LIB  := lib_driver_cmd

#BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd

WIFI_DRIVER_MODULE_PATH     := "/system/lib/modules/ath9k_htc.ko"

WIFI_DRIVER_MODULE_NAME     := "ath9k_htc"

WIFI_SDIO_IF_DRIVER_MODULE_PATH := "/system/lib/modules/cfg80211.ko"

WIFI_SDIO_IF_DRIVER_MODULE_NAME := "cfg80211"

WIFI_SDIO_IF_DRIVER_MODULE_ARG     := ""

WIFI_COMPAT_MODULE_PATH     := "/system/lib/modules/compat.ko"

WIFI_COMPAT_MODULE_NAME     := "compat"

WIFI_COMPAT_MODULE_ARG    := ""

endif

As mentioned in this thread , am able to connect to wifi from terminal. Please give some suggestions.

Thanks and regards,

Arun S

0 Kudos
Reply
26,696 Views
samiiqneibi
Contributor I

Hi All,

I am working to bring up RealTek USB wifi (rtl8188cu) dongel on android 4.3 and kernel 3.0.35  below are steps I followed :

Step 1) I am building rtl8192cu as module. I made the other components MAC80211 and CFG80211 as built in.

root@nitrogen6x:/ # cat /sys/kernel/debug/usb/devices

...

T:  Bus=02 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  3 Spd=480  MxCh= 0

D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1

P:  Vendor=0bda ProdID=8176 Rev= 2.00

S:  Manufacturer=Realtek

S:  Product=802.11n WLAN Adapter

S:  SerialNumber=00e04c000001

C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=500mA

I:* If#= 0 Alt= 0 #EPs= 4 Cls=ff(vend.) Sub=ff Prot=ff Driver=rtl8192cu

E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

E:  Ad=84(I) Atr=03(Int.) MxPS=  64 Ivl=125us

...

root@nitrogen6x:/ # dmesg

rtl8192cu driver version=v4.0.2_9000.20130911

build time: Feb  2 2015 14:05:08

usb_endpoint_descriptor(0):

bLength=7

bDescriptorType=5

bEndpointAddress=81

wMaxPacketSize=200

bInterval=0

RT_usb_endpoint_is_bulk_in = 1

usb_endpoint_descriptor(1):

bLength=7

bDescriptorType=5

bEndpointAddress=2

wMaxPacketSize=200

bInterval=0

RT_usb_endpoint_is_bulk_out = 2

usb_endpoint_descriptor(2):

bLength=7

bDescriptorType=5

bEndpointAddress=3

wMaxPacketSize=200

bInterval=0

RT_usb_endpoint_is_bulk_out = 3

usb_endpoint_descriptor(3):

bLength=7

bDescriptorType=5

bEndpointAddress=84

wMaxPacketSize=40

bInterval=1

RT_usb_endpoint_is_int_in = 4, Interval = 1

nr_endpoint=4, in_num=2, out_num=2

USB_SPEED_HIGH

CHIP TYPE: RTL8188C_8192C

register rtw_netdev_ops to netdev_ops

Chip Version ID: VERSION_NORMAL_UMC_CHIP_88C_B_CUT.

RF_Type is 3!!

EEPROM type is E-FUSE

====> ReadAdapterInfo8192C

Boot from EFUSE, Autoload OK !

EEPROMVID = 0x0bda

EEPROMPID = 0x8176

EEPROMCustomerID : 0x00

EEPROMSubCustomerID: 0x00

RT_CustomerID: 0x00

_ReadMACAddress MAC Address from EFUSE = 44:33:4c:80:cb:1e

EEPROMRegulatory = 0x0

_ReadBoardType(0)

BT Coexistance = disable

mlmepriv.ChannelPlan = 0x08

_ReadPSSetting...bHWPwrPindetect(0)-bHWPowerdown(10) ,bSupportRemoteWakeup(0)

### PS params=>  power_mgnt(1),usbss_enable(0) ###

### AntDivCfg(0)

readAdapterInfo_8192CU(): REPLACEMENT = 0

<==== ReadAdapterInfo8192C in 240 ms

rtw_register_early_suspend

rtw_macaddr_cfg MAC Address  = 44:33:4c:80:cb:1e

bDriverStopped:1, bSurpriseRemoved:0, bup:0, hw_init_completed:0

_rtw_drv_register_netdev, MAC Address (if1) = 44:33:4c:80:cb:1e

usbcore: registered new interface driver rtl8192cu

init: no such service ''

mtp_open

init: sys_prop: permission denied uid:1003  name:service.bootanim.exit

Step 2) wlan0 interface is creating successfully in /sys/class/net/wlan0.

root@nitrogen6x:/ # ls -l /sys/class/net/wlan0

lrwxrwxrwx root    root              2004-06-05 17:54 wlan0 -> ../../devices/platform/fsl-ehci.1/usb2/2-1/2-1.1/2-1.1:1.0/net/wlan0

root@nitrogen6x:/ # ls -l /sys/devices/platform/fsl-ehci.1/usb2/2-1/2-1.1/2-1.1:1.0/net/wlan0

-r--r--r-- root    root        4096 2004-06-05 17:54 addr_assign_type

-r--r--r-- root    root        4096 2004-06-05 17:54 addr_len

-r--r--r-- root    root        4096 2004-06-05 17:54 address

-r--r--r-- root    root        4096 2004-06-05 17:54 broadcast

-r--r--r-- root    root        4096 2004-06-05 17:54 carrier

-r--r--r-- root    root        4096 2004-06-05 17:54 dev_id

lrwxrwxrwx root    root              2004-06-05 17:54 device -> ../../../2-1.1:1.0

-r--r--r-- root    root        4096 2004-06-05 17:54 dormant

-r--r--r-- root    root        4096 2004-06-05 17:54 duplex

-r--r--r-- root    root        4096 2004-06-05 17:54 features

-rw-r--r-- root    root        4096 2004-06-05 17:54 flags

-rw-r--r-- root    root        4096 2004-06-05 17:54 ifalias

-r--r--r-- root    root        4096 2004-06-05 17:54 ifindex

-r--r--r-- root    root        4096 2004-06-05 17:54 iflink

-r--r--r-- root    root        4096 2004-06-05 17:54 link_mode

-rw-r--r-- root    root        4096 2004-06-05 17:54 mtu

-rw-r--r-- root    root        4096 2004-06-05 17:54 netdev_group

-r--r--r-- root    root        4096 2004-06-05 17:54 operstate

drwxr-xr-x root    root              2004-06-05 17:54 power

drwxr-xr-x root    root              2004-06-05 17:54 queues

-r--r--r-- root    root        4096 2004-06-05 17:54 speed

drwxr-xr-x root    root              2004-06-05 17:54 statistics

lrwxrwxrwx root    root              2004-06-05 17:54 subsystem -> ../../../../../../../../../class/net

-rw-r--r-- root    root        4096 2004-06-05 17:54 tx_queue_len

-r--r--r-- root    root        4096 2004-06-05 17:54 type

-rw-r--r-- root    root        4096 2004-06-05 17:54 uevent

drwxr-xr-x root    root              2004-06-05 17:54 wireless

Step 3) After that I try to run below command.

root@nitrogen6x:/ # dhcpcd wlan0

dhcpcd[3264]: version 5.5.6 start+871x_drv - drv_open, bup=0

ing

===> FirmwareDownload91C() fw:Rtl819XFwImageArray_UMC_B

FirmwareDownload92C accquire FW from embedded image

fw_ver=v88, fw_subver=2, sig=0x88c0

fw download ok!

Set RF Chip ID to RF_6052 and RF type to 1T1R.

IQK:Start!!!

Path A IQK Success!!

Path A IQK Success!!

IQK: final_candidate is 0

IQK: RegE94=102 RegE9C=10 RegEA4=fa RegEAC=3 RegEB4=0 RegEBC=0 RegEC4=0 RegECC=0

Path A IQ Calibration Success !

pdmpriv->TxPowerTrackControl = 1

rtl8192cu_hal_init in 610ms

MAC Address = 44:33:4c:80:cb:1e

-871x_drv - drv_open, bup=1

ADDRCONF(NETDEV_UP): wlan0: link is not ready

dhcpcd[3264]: wlan0: sending IPv6 Router Solicitation

dhcpcd[3264]: wlan0: sendmsg: Network is unreachable

dhcpcd[3264]: wlan0: checking for 169.254.156.2

==>rtw_ps_processor .fw_state(0)

==>ips_enter cnts:1

===> rtw_ips_pwr_down...................

====> rtw_ips_dev_unload...

usb_read_port_cancel

usb_read_port_complete()-1284: RX Warning! bDriverStopped(0) OR bSurpriseRemoved(0) bReadPortCancel(1)

usb_read_port_complete()-1284: RX Warning! bDriverStopped(0) OR bSurpriseRemoved(0) bReadPortCancel(1)

usb_read_port_complete()-1284: RX Warning! bDriverStopped(0) OR bSurpriseRemoved(0) bReadPortCancel(1)

usb_read_port_complete()-1284: RX Warning! bDriverStopped(0) OR bSurpriseRemoved(0) bReadPortCancel(1)

usb_write_port_cancel

==> rtl8192cu_hal_deinit

bkeepfwalive(0)

card disble without HWSM...........

<=== rtw_ips_pwr_down..................... in 90ms

dhcpcd[3264]: wlan0: sending IPv6 Router Solicitation

dhcpcd[3264]: wlan0: sendmsg: Network is unreachable

dhcpcd[3264]: wlan0: using IPv4LL address 169.254.156.2

dhcpcd[3264]: forked to background, child pid 3291

Step 4) If I turn on wifi from Android settings, I only see the following message from logcat:

              D/WifiService( 2746): setWifiEnabled: true pid=2997, uid=1000

kindly help me to solve issue.

Thanks In Advance,

Sami Iqneibi

0 Kudos
Reply
26,696 Views
zoranl
Contributor III

Hello Sami,

Next is for WifiService to Invoking mWifiStateMachine.setWifiEnabled.

This could be something simple, like permissions. Could you check that?

If you run some wifi setup programs, like dhcpcd or wpa_supplicant, you should restart the system, just to be sure. Android's wifi is very sensitive :-).

Also, you could include more debug:

frameworks/base/wifi/java/android/net/wifi/*.java

frameworks/base/services/java/com/android/server/wifi/*.java

    private static final boolean DBG = true;

When you turn wifi on from Android settings, it will run wpa_supplicant service, so if you added debug argument (-dd) you should see more in logcat..

BR,

Zoran

0 Kudos
Reply
26,696 Views
samiiqneibi
Contributor I

Hi Zoran,

Thank you for your help.

I noticed that when I run wpa_supplicant from the command shell as follows:

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

I get the error:

         D/wpa_supplicant( 3901): Could not open file /sys/class/net/wlan0/phy80211/name: No such file or directory

So, I checked the contents of /sys/class/net/wlan0 and found that phy80211 is missing.

I checked my kernel settings in .config file to find that I have these set as follows:

CONFIG_CFG80211=y

CONFIG_NL80211_TESTMODE=y

CONFIG_CFG80211_DEFAULT_PS=y

CONFIG_CFG80211_WEXT=y

CONFIG_MAC80211=y

CONFIG_HOSTAP=y

CONFIG_RTL8192CU=m

and found that those are missing

# CONFIG_USB_USBNET is not set

# CONFIG_NET_RADIO is not set

It seems that I am not building the realtek driver for nl80211 protocol.

I got some compilation errors when I tried to change those settings. I will try some more and come back with results later.

I really appreciate your help with this matter.

Best regards,

Sami

0 Kudos
Reply
26,694 Views
nealbush
Contributor I

Hi Sami:

I am facing the same troble with your met  about the wifi ap mode. when i use the commad "hostapd -d /etc/hostapd.conf" :

could not open file /sys/class/net/wlan0/phy80211/name: No such file or directory

can you share your experience,and give me some advise?

thank you in advance!

0 Kudos
Reply
26,694 Views
samiiqneibi
Contributor I

Hi Neal,

The real authority on this subject is Zoran but I will try my best to answer your question (and Zoran can correct me if I am wrong).

There are two Linux wireless API: WEXT, CFG80211.

In order to enable the CFG80211 API, you need to define CONFIG_IOCTL_CFG80211.

I fixed my problem "could not open file /sys/class/net/wlan0/phy80211/name" by changing the following compile switches in

kernel_imx/drivers/net/wireless/rtl8192cu/include/autoconf.h:

#define CONFIG_IOCTL_CFG80211 1

#ifdef CONFIG_IOCTL_CFG80211

  #define RTW_USE_CFG80211_STA_EVENT /* Indecate new sta asoc through cfg80211_new_sta */

  //#define CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER

  #define CONFIG_DEBUG_CFG80211 1

Best regards,

Sami

0 Kudos
Reply
26,696 Views
zoranl
Contributor III

Hi Sami,

You can try to build driver as integrated =y, maybe you'll get more info during build.

Do you insert all the modules needed, in the right order?

Do you have this in your BoardConfig,mk file:


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


NL80211 supposed to replace WEXT, so maybe disabling the WEXT to build could give you more info.


I also have:

# CONFIG_USB_USBNET is not set

# CONFIG_NET_RADIO is not setvv


NP. Let me know is you need more help



BR,

Zoran

0 Kudos
Reply
26,696 Views
zoranl
Contributor III

Also, for wifi to work on android dont forget to add system/netd/SoftapController_realtek.cpp and modify system/netd/SoftapController.h.

vim system/netd/SoftapController.h

#ifndef _SOFTAP_CONTROLLER_H

#define _SOFTAP_CONTROLLER_H


#include <linux/in.h>

#include <net/if.h>

#include <utils/List.h>


#define SOFTAP_MAX_BUFFER_SIZE  4096

#define AP_BSS_START_DELAY  200000

#define AP_BSS_STOP_DELAY  500000

#define AP_SET_CFG_DELAY  500000

#define AP_DRIVER_START_DELAY  800000


class SoftapController {

    int mSock;

    int addParam(int pos, const char *cmd, const char *arg);

    int setCommand(char *iface, const char *fname, unsigned buflen=0);

    char mIface[IFNAMSIZ];

    char mBuf[SOFTAP_MAX_BUFFER_SIZE];


public:

    SoftapController();

    virtual ~SoftapController();


    int startSoftap();

    int stopSoftap();

    bool isSoftapStarted();

    int setSoftap(int argc, char *argv[]);

    int fwReloadSoftap(int argc, char *argv[]);

    int startDriver(char *iface) ;

    int stopDriver(char *iface) ;

    int clientsSoftap(char **retbuf);


0 Kudos
Reply
26,696 Views
samiiqneibi
Contributor I

Hi Zoran,

Thank you for your continuous help.

Where do I get the "SoftapController_realtek.cpp" from? and Do I really need it if I don't want my wifi dongle to work as SoftAP?

I have made some progress in the last week.

I was able to build the realtek driver after changing a couple of compile switches and get the NL80211 protocol working.

The realtek wifi dongle is now working if I start it up manually.

What I mean by starting it manually is:

- If I start my board while the wifi dongle is inserted into the USB connector. The wifi dongle will not work. I have to disconnect it and then connect it back.

- After the wifi dongle works, I need to start the dhcpcd from the console

  root@nitrogen6x:/ #  dhcpcd wlan0

- After the wifi dongle takes an IP address, I can start the wpa_supplicant as a service:

  root@nitrogen6x:/ #  start rtw_suppl

- Then I can start the wpa_cli, scan for networks, connect to one network, and ping the internet.

My current problems are:

- Realtek dongle will not automatically start

- dhcpcd_wlan0 service doesnot start automatically and will not start manually (i.e. with "start dhcpcd_wlan0" command from console)

- When I try to enable wifi from Android UI setting, nothing happens.

I saw your message in this thread to Ranganath tm to send the following files/folders:

out/target/product/{yourdevice}/system/etc/wifi/wpa_supplicant.conf

out/target/product/{yourdevice}/root//init.rc

out/target/product/{yourdevice}/root/init.{yourdevice}.rc

out/target/product/{yourboard}/system/etc/permissions

hardware/realtek

hardware/libhardware_legacy

external/wpa_supplicant_8

kernel_imx/arch/arm/configs/imx6s_{yourdevice}_android_defconfig

device/fsl/{yourdevice}/BoardConfig.mk

frameworks/base/wifi/java/android/net/wifi

Please list all relevant folders/files to recheck permissions!

Could you send those files/folders to me or I could send you mine (if you prefer)?

I have already sent you my email in a PM (I hope you don't mind).

Best regards,

Sami

0 Kudos
Reply
26,694 Views
samiiqneibi
Contributor I

Hi Zoran,

Thank you very much for your help.

I made all the changes you suggested in your private message and the realtek wifi adaptor is finally working properly.

My last permissions problem was:

             03-05 14:22:16.460: E/WifiHW(2779): Unable to open connection to supplicant on "/data/system/wpa_supplicant/wlan0": No such file or directory

It was fixed when I deleted the folder:

             /data/system/wpa_supplicant

as suggested by the link you gave me in your last email:

http://blog.linuxconsulting.ro/2010/04/porting-wifi-drivers-to-android.html

Thanks again.

best regards,

Sami

0 Kudos
Reply
26,694 Views
zoranl
Contributor III

Hello Sami,

Great to hear that, you are very welcome.

BR,

Zoran

0 Kudos
Reply
26,711 Views
igorpadykov
NXP Employee
NXP Employee

Hi, Zoran

what Android was used, is it Freescale Android (link below) ?

IMX6_JB43_110_ANDROID_SOURCE_BSP : i.MX 6Quad, i.MX 6Dual, i.MX 6DualLite,

i.MX 6Solo and i.MX 6Sololite Android jb4.3_1.1.0 0 BSP, Documentation and Source Code

i.MX 6SoloLite Evaluation Kit

Also very often WiFi modules have different firmware, so different drivers are needed, though module

name may the same. Have you contacted Realtek for updated version of driver for this specific module ?

0 Kudos
Reply
26,711 Views
zoranl
Contributor III

Hello,

Thank you for answering,

Yeah, I wanted to add that info. It was JB4.3 and the Realtek porting for rtl8192cu driver is for JB4.2.

Some more porting work was needed to be done that wasnt in the manual.

Also we are currently working on nfs, there shouldnt be some permissions problem.

We put every all firmware files in the root fs (nfs) just in case.

ls /system/etc/firmware/rtlwifi/ -l                                        

-rw------- root    root        11216 2014-04-23 13:10 rtl8188efw.bin

-rw------- root    root        13904 2014-04-23 13:10 rtl8188eufw.bin

-rw------- root    root        13540 2014-04-23 13:10 rtl8192cfw.bin

-rw------- root    root        14818 2014-04-23 13:10 rtl8192cfwU.bin

-rw------- root    root        14800 2014-04-23 13:10 rtl8192cfwU_B.bin

-rw------- root    root        16014 2014-04-23 13:10 rtl8192cufw.bin

-rw------- root    root        16116 2014-04-23 13:10 rtl8192cufw_A.bin

-rw------- root    root        16096 2014-04-23 13:10 rtl8192cufw_B.bin

-rw------- root    root        16116 2014-04-23 13:10 rtl8192cufw_TMSC.bin

-rw------- root    root        22978 2014-04-23 13:10 rtl8192defw.bin

-rw------- root    root        32754 2014-04-23 13:10 rtl8192eefw.bin

-rw------- root    root        80208 2014-04-23 13:10 rtl8192sefw.bin

-rw------- root    root      122328 2014-04-23 13:10 rtl8712u.bin

-rw------- root    root        22172 2014-04-23 13:10 rtl8723aufw_A.bin

-rw------- root    root        24118 2014-04-23 13:10 rtl8723aufw_B.bin

-rw------- root    root        19200 2014-04-23 13:10 rtl8723aufw_B_NoBT.bin

-rw------- root    root        11662 2014-04-23 13:10 rtl8723fw.bin

-rw------- root    root        22996 2014-04-23 13:10 rtl8723fw_B.bin

-rw------- root    root        29198 2014-04-23 13:10 rtl8821aefw.bin

but driver source it askes for:

(kernel_imx/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c file)

MODULE_FIRMWARE("rtlwifi/rtl8192cufw.bin");

also, driver is build in the kernel, from boot:

rtl8192cu driver version=v4.0.2_9000.20130911

build time: Apr 24 2014 13:14:21

usbcore: registered new interface driver rtl8192cu

..

USB_SPEED_HIGH

CHIP TYPE: RTL8188C_8192C

register rtw_netdev_ops to netdev_ops

android_work: sent uevent USB_STATE=CONNECTED

Netfilter messages via NETLINK v0.30.

android_work: sent uevent USB_STATE=DISCONNECTED

Chip Version ID: VERSION_NORMAL_UMC_CHIP_88C_B_CUT.

nf_conntrack version 0.5.0 (7141 buckets, 28564 max)

RF_Type is 3!!

ctnetlink v0.93: registering with nfnetlink.

NF_TPROXY: Transparent proxy support initialized, version 4.1.0

...

readAdapterInfo_8192CU(): REPLACEMENT = 0

<==== ReadAdapterInfo8192C in 570 ms

rtw_register_early_suspend

rtw_macaddr_cfg MAC Address  = 44:33:4c:8b:f2:10

bDriverStopped:1, bSurpriseRemoved:0, bup:0, hw_init_completed:0

This shouldn't be a problem:

-rw------- root    root

because system handles driver. But I will check out this, more.

Other thing is that wpa_supplicant isnt  not called from init script, there is no trace of it in logcat.

in init.freescale.rs file:

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

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

    socket wpa_wlan0 dgram 660 wifi wifi

    class late_start

    disabled

    oneshot

service p2p_supplicant /system/bin/wpa_supplicant \

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

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

    class late_start

    disabled

    oneshot

service rtw_suppl_con /system/bin/rtl_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 late_start

    socket wpa_wlan0 dgram 660 wifi wifi

    disabled

    oneshot

service rtw_suppl /system/bin/wpa_supplicant -iwlan0 -Dnl80211a \

    -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

in init.rs file:

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

    mkdir /data/misc/wifi 0770 wifi wifi

    chmod 0770 /data/misc/wifi

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

    mkdir /data/misc/wifi/wpa_supplicant 0770 wifi wifi

    mkdir /data/misc/wifi/p2p_supplicant 0770 wifi wifi

    mkdir /data/misc/dhcp 0770 dhcp dhcp

    chown dhcp dhcp /data/misc/dhcp

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

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

    chmod 0775 /system/etc/dhcpcd/dhcpcd-run-hooks

######for nfs maybe some permissions problems (didn't work)

#    chown system wifi /data/misc/wifi

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

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

If we manual start dhcp for wlan0, we can get wifi ip address (in my previous post).

When we manually call wpa_supplicant:

wpa_supplicant -iwlan0 -c/system/etc/wifi/wpa_supplicant.conf -B

we get this in logcat:

--------- beginning of /dev/log/main

I/wpa_supplicant( 2938): Successfully initialized wpa_supplicant

E/wpa_supplicant( 2938): nl80211: Could not add multicast membership for scan events: -2 (No such file or directory)

E/wpa_supplicant( 2938): Failed to initialize driver 'nl80211'

In board config file:

(./device/fsl/evk_6sl/BoardConfig.mk file)

BOARD_WPA_SUPPLICANT_DRIVER  := NL80211

BOARD_HOSTAPD_DRIVER        := NL80211

in both

./external/wpa_supplicant_8/wpa_supplicant/android.config

and

./external/wpa_supplicant_8/hostapd/android.config

CONFIG_DRIVER_NL80211=y




We didn't contacted Realtek yet, we believe that we have some binding problems with driver and android ui.


Also, slider button for wifi in the Settings menu in the Android ui seamed not to be connected to Settings>Wifi button.

I can move button in Settings menu, to On state. And the enter the Settings>Wi-Fi and the button is in Off state.

Exiting Settings>Wi-Fi menu and entering it again, it shows that button is back in Off state.

Toggling wifi button to Off state isn't possible, after it was set to On state by us.


After moving the wifi button slider to Off state we get this in logcat:

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

E/WifiService( 2401): Invoking mWifiStateMachine.setWifiEnabled

in system/core/include/private/android_filesystem_config.h file we can see uid's

#define AID_SYSTEM        1000  /* system server */

#define AID_WIFI          1010  /* wifi subsystem */

Do we need to register platform driver callbacks, but this is usb module, it shouldn't need that?

Is it some nfs permission related issue with wifi?

So, what do you think?

0 Kudos
Reply
26,711 Views
zoranl
Contributor III

building the driver as module also doesn't work ..

we are pretty sure that it is to android binding with driver.

we tried three different drivers for rtl8192cu.

root@evk_6sl:/ # insmod /system/lib/modules/cfg80211_realtek.ko

cfg80211: Calling CRDA to update world regulatory domain

root@evk_6sl:/ # insmod /system/lib/modules/8192cu.ko

rtl8192cu driver version=v4.0.2_9000.20130911

build time: Apr 25 2014 15:18:54


usb_endpoint_descriptor(0):

bLength=7

bDescriptorType=5

bEndpointAddress=81

wMaxPacketSize=200

bInterval=0

RT_usb_endpoint_is_bulk_in = 1


usb_endpoint_descriptor(1):

bLength=7

bDescriptorType=5

bEndpointAddress=2

wMaxPacketSize=200

bInterval=0

RT_usb_endpoint_is_bulk_out = 2


usb_endpoint_descriptor(2):

bLength=7

bDescriptorType=5

bEndpointAddress=3

wMaxPacketSize=200

bInterval=0

RT_usb_endpoint_is_bulk_out = 3


usb_endpoint_descriptor(3):

bLength=7

bDescriptorType=5

bEndpointAddress=84

wMaxPacketSize=40

bInterval=1

RT_usb_endpoint_is_int_in = 4, Interval = 1

nr_endpoint=4, in_num=2, out_num=2


USB_SPEED_HIGH

CHIP TYPE: RTL8188C_8192C

register rtw_netdev_ops to netdev_ops

Chip Version ID: VERSION_NORMAL_UMC_CHIP_88C_B_CUT.

RF_Type is 3!!

EEPROM type is E-FUSE

====> ReadAdapterInfo8192C

Boot from EFUSE, Autoload OK !

EEPROMVID = 0x0bda

EEPROMPID = 0x8176

EEPROMCustomerID : 0x00

EEPROMSubCustomerID: 0x00

RT_CustomerID: 0x00

_ReadMACAddress MAC Address from EFUSE = 44:33:4c:8b:f2:10

EEPROMRegulatory = 0x0

_ReadBoardType(0)

BT Coexistance = disable

mlmepriv.ChannelPlan = 0x08

_ReadPSSetting...bHWPwrPindetect(0)-bHWPowerdown(10) ,bSupportRemoteWakeup(0)

### PS params=>  power_mgnt(0),usbss_enable(0) ###

### AntDivCfg(0)

readAdapterInfo_8192CU(): REPLACEMENT = 0

<==== ReadAdapterInfo8192C in 180 ms

rtw_wdev_alloc(padapter=da5f7000)

rtw_register_early_suspend

rtw_macaddr_cfg MAC Address  = 44:33:4c:8b:f2:10

bDriverStopped:1, bSurpriseRemoved:0, bup:0, hw_init_completed:0

register rtw_netdev_ops to netdev_ops

register rtw_netdev_if2_ops to netdev_ops

rtw_wdev_alloc(padapter=db8e7000)

Chip Version ID: VERSION_NORMAL_UMC_CHIP_88C_B_CUT.

RF_Type is 3!!

_rtw_drv_register_netdev, MAC Address (if1) = 44:33:4c:8b:f2:10

_rtw_drv_register_netdev, MAC Address (if2) = 46:33:4c:8b:f2:10

usbcore: registered new interface driver rtl8192cu




here is this kernel build config file:


CONFIG_WLAN=y

CONFIG_WIFI_CONTROL_FUNC=y

CONFIG_HOSTAP=y

CONFIG_CFG80211=m

CONFIG_NL80211_TESTMODE=y

CONFIG_CFG80211_REG_DEBUG=y

CONFIG_CFG80211_DEFAULT_PS=y

CONFIG_CFG80211_DEBUGFS=y

CONFIG_CFG80211_WEXT=y

CONFIG_LIB80211=y

CONFIG_LIB80211_CRYPT_WEP=y

CONFIG_LIB80211_CRYPT_CCMP=y

CONFIG_LIB80211_CRYPT_TKIP=y

CONFIG_CFG80211_ALLOW_RECONNECT=y

CONFIG_MAC80211=m

CONFIG_MAC80211_HAS_RC=y

CONFIG_MAC80211_RC_MINSTREL=y

CONFIG_MAC80211_RC_MINSTREL_HT=y

CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y

CONFIG_MAC80211_RC_DEFAULT="minstrel_ht"

CONFIG_MAC80211_MESH=y

CONFIG_RTL8192CU=m

root@evk_6sl:/ # lsmod

8192cu 674910 0 - Live 0x00000000

cfg80211 155527 1 8192cu, Live 0x00000000

before that driver was build as part of kernel:

CONFIG_RTL8192CU=y

0 Kudos
Reply
26,711 Views
igorpadykov
NXP Employee
NXP Employee

Hi Zoran, I got advice from our expert:

I had been reading about this issue and also i read the description from the client and seem

there's some missing configuration which the client could try.

First of all try to set BOARD_WPA_SUPPLICANT_DRIVER to WEXT in the Android BSP.

Also you need to provide a proper wpa configuration file for your device.

For more details check this reference:

PaNiC Random Rant (or how we used to call it: .plan): Porting WiFi drivers to Android

Hope this helps

0 Kudos
Reply
26,711 Views
zoranl
Contributor III

Yep, I tried this link.

In manual provided with rtl wifi driver, it states to use new nl80211 interface.

BoardConfig.mk

BOARD_WPA_SUPPLICANT_DRIVER=NL80211




Problem is that Wifi slider switch cant be moved, but nothing happens, so some binding or some permissions are problem. This is done in nfs.

When slider is moved to On position in logcat we get this:

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

E/WifiService( 2401): Invoking mWifiStateMachine.setWifiEnabled

there should be more data or some error or permission staff for wifi, after this.

wpa_supplicant doesnt start automatically, but it is in init.freescale.rc script. It can start manually with nl80211 driver.

WEXT, I will try this again, thank you. I am not sure it will work, i dont think the driver is problem. I can scan and get all networks in area, using shell.

0 Kudos
Reply
26,711 Views
robertmclean
Contributor I

We have a similar setup and are having the same problems.  Right down to the same bogus IP address reported by netconfig after dhcpcd seems to believe it got an address from the DHCP server on my Access Point.

Has there been any activity on this?

0 Kudos
Reply
30,360 Views
zoranl
Contributor III

Yes, we manage to get wifi working. Here are info's in more detail, so if anybody else has problem ...


We build driver as part of the kernel:

vim kernel_imx/arch/arm/configs/imx6s_{yourdevice}_android_defconfig

CONFIG_CFG80211=y


CONFIG_MAC80211_MESH=y

CONFIG_MAC80211=y


CONFIG_HOSTAP=y

CONFIG_RTL8192CU=y

CONFIG_RTLWIFI=y

CONFIG_RTL8192C_COMMON=y

#CONFIG_RTL8723AS=m

CONFIG_USB_USBNET=y

CONFIG_NET_RADIO=y


vim device/fsl/{yourdevice}/BoardConfig.mk


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 := ""




We disabled p2p, since we dont need it:

vim device/fsl/imx6/{yourboard}.mk

PRODUCT_COPY_FILES += \

#frameworks/native/data/etc/android.hardware.wifi.direct.xml:system/etc/permissions/android.hardware.wifi.direct.xml


or

rm out/target/product/{yourboard}/system/etc/permissions/android.hardware.wifi.direct.xml


or just remount system partition:

root@{yourboard}:/ # mount -o remount, rw /system;

and remove xml:

root@{yourboard}:/ # rm /system/etc/permissions/android.hardware.wifi.direct.xml



edit:

root@{yourboard}:/ # busybox vi system/etc/permissions/required_hardware.xml

or

vim device/fsl/{yourboard}/required_hardware.xml

or

vim out/target/product/{yourboard}/system/etc/permissions/required_hardware.xml

<!--

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

-->


If you use it as module, you will need to add it also in PRODUCT_COPY_FILES


You need to correct init scripts, leave just this lines:

(this is from: http://blog.linuxconsulting.ro/2010/04/porting-wifi-drivers-to-android.html )


You can do it directly to out folder:

vim out/target/product/{yourboard}/root/init.rc

or/and (rebuild the whole system):

vim device/fsl/imx6/imx6.mk


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


    setprop wifi.interface wlan0

    setprop wlan.driver.status "ok"

   #setprop wifi.ap.interface wlan0


#and also remove this lines:

#    mkdir /data/system/wpa_supplicant 0771 wifi wifi

#    chmod 0771 /data/system/wpa_supplicant

#    symlink /data/misc/wifi/wpa_supplicant /data/system/wpa_supplicant


you can read it in that blog link, about unix/android standard socket setup.



vim out/target/product/{yourboard}/root/init.freescale.rc

or/and

vim device/fsl/{yourboard}/init.rc


#this is the only supplicant service and dhcpcd service for wifi that we use:

service rtw_suppl /system/bin/wpa_supplicant -dd -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 iprenew_wlan0 /system/bin/dhcpcd -n

    class main

    disabled

    oneshot



To keep it clean (it doesnt effect wifi):

vim device/fsl/imx6/imx6.mk


PRODUCT_PACKAGES += \

       rtw_suppl               \



We needed to make a little change in wifi_realtek.c since our jb is 4.3:


vim hardware/realtek/wlan/libhardware_legacy/wifi/wifi_realtek.c

int wifi_start_supplicant(int p2p_supported)

..

    wifi_stop_supplicant(p2p_supported);

….


int wifi_stop_supplicant(int p2p_supported){

    char supp_status[PROPERTY_VALUE_MAX] = {'\0'};

    int count = 50; /* wait at most 5 seconds for completion */


    if (p2p_supported) {

        property_get("wifi.supplicant", supplicant_name, P2P_SUPPLICANT_NAME);

        snprintf(supplicant_prop_name, PROPERTY_KEY_MAX, P2P_PROP_NAME, supplicant_name);

    } else {

        property_get("wifi.supplicant", supplicant_name, SUPPLICANT_NAME);

        snprintf(supplicant_prop_name, PROPERTY_KEY_MAX, SUPP_PROP_NAME, supplicant_name);

    }



Our problem was wrong supplicant name in prop setup. And, when wifi starts it first stops supplicant, and it wasn’t able to transfer that info through system. It was quite fun tracking this problem.


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

mWifiNative.killSupplicant(mP2pSupported);

if(mWifiNative.startSupplicant(mP2pSupported)) {

                            setWifiState(WIFI_STATE_ENABLING);

                            if (DBG) log("Supplicant start successful");

                            mWifiMonitor.startMonitoring();

                            transitionTo(mSupplicantStartingState);

                        } else {

                            loge("Failed to start supplicant!!");

                        }



Here are more info:


root@{yourdevice}:/ # cat /data/misc/wifi/wpa_supplicant.conf

ctrl_interface=wlan0

update_config=1

device_name={yourdevice}

manufacturer=Freescale

model_name={YOURDEVICE}

model_number={YOURDEVICE}

serial_number=

device_type=10-0050F204-5

config_methods=physical_display virtual_push_button


network={

        ssid="XXXXX"

        key_mgmt=NONE

        priority=1

}



and it started with:

root@{yourdevice}:/ # cat system/etc/wifi/wpa_supplicant.conf

update_config=1

ctrl_interface=wlan0

eapol_version=1

ap_scan=1

fast_reauth=1



permissions:

root@{yourdevice}:/ # ls -l /data/misc/wifi

-rw-rw---- system   wifi           21 2014-05-27 12:39 entropy.bin

drwxrwx--- wifi     wifi              2014-05-27 12:39 sockets

-rw------- system   system         33 2014-05-27 12:39 softap.conf

-rw-rw---- wifi     wifi          272 2014-05-27 12:39 wpa_supplicant.conf


root@{yourboard}:/ # ls -l /data/misc/

drwxr-s--- system   shell             2014-05-27 12:39 adb

drwxrwx--- bluetooth net_bt_stack          2014-05-27 12:39 bluedroid

drwxrwx--- system   system            2014-05-27 12:39 bluetooth

drwxrwx--- dhcp     dhcp              2014-05-27 12:39 dhcp

drwxrwx--x system   system            2014-05-27 12:39 keychain

drwx------ keystore keystore          2014-05-27 12:39 keystore

drwx------ media    media             2014-05-27 12:39 media

drwxrwx--- system   radio             2014-05-27 12:39 radio

drwxrwx--- system   radio             2014-05-27 12:39 sms

drwx------ system   system            2014-05-27 12:39 systemkeys

drwxrwx--- system   vpn               2014-05-27 12:39 vpn

drwxrwx--- wifi     wifi              2014-05-27 12:39 wifi

drwxrwxr-x system   system            2014-05-27 12:39 zoneinfo


root@{yourboard}:/ # ls -l /system/etc/wifi

-rw-rw---- wifi     wifi           77 2014-05-27 12:39 wpa_supplicant.conf



root@{yourboard}:/ # ps | grep wpa

wifi      2555  1     3104   1876  c0103edc 401a4448 S /system/bin/wpa_supplicant



root@{yourboard}:/ # cat system/etc/permissions/platform.xml | grep -i wifi

    <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" />




root@{yourboard}:/ # cat system/etc/permissions/required_hardware.xml | grep wifi

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




root@{yourboard}:/ # getprop | grep  wifi

[net.tcp.buffersize.wifi]: [524288,1048576,2097152,262144,524288,1048576]

[ro.wifi.channels]: []

[wifi.interface]: [wlan0]


root@{yourboard}:/ # getprop | grep  wlan

[dhcp.wlan0.dns1]: [192.168.1.1]

[dhcp.wlan0.dns2]: []

[dhcp.wlan0.dns3]: []

[dhcp.wlan0.dns4]: []

[dhcp.wlan0.domain]: []

[dhcp.wlan0.gateway]: [192.168.1.1]

[dhcp.wlan0.ipaddress]: [192.168.1.118]

[dhcp.wlan0.leasetime]: [86400]

[dhcp.wlan0.mask]: [255.255.255.0]

[dhcp.wlan0.pid]: [2689]

[dhcp.wlan0.reason]: [REBOOT]

[dhcp.wlan0.result]: [ok]

[dhcp.wlan0.server]: [192.168.1.1]

[dhcp.wlan0.vendorInfo]: []

[init.svc.dhcpcd_wlan0]: [running]

[wifi.interface]: [wlan0]

[wlan.driver.status]: [ok]

[wlan.interface]: [wlan0]



root@{yourboard}:/ # getprop | grep  suppl

[init.svc.rtw_suppl]: [running]



root@{yourboard}:/ # cat /sys/kernel/debug/usb/devices

T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0

D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1

P:  Vendor=0bda ProdID=8176 Rev= 2.00

S:  Manufacturer=Realtek

S:  Product=802.11n WLAN Adapter

S:  SerialNumber=00e04c000001

C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=500mA

I:* If#= 0 Alt= 0 #EPs= 4 Cls=ff(vend.) Sub=ff Prot=ff Driver=rtl8192cu

E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

E:  Ad=84(I) Atr=03(Int.) MxPS=  64 Ivl=125us


root@{yourboard}:/ # cat /sys/bus/usb/devices/2-1/product

802.11n WLAN Adapter



Useful commands:


disable wifi:

root@{yourboard}:/ # svc wifi disable

enable wifi:

root@{yourboard}:/ # svc wifi enable



open wifi settings panel:

root@{yourboard}:/ # am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings


manually starting supplicant with debug:

root@{yourboard}:/ # wpa_supplicant -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf -dd -B


root@{yourboard}:/ # netcfg wlan0 up/down/dhcp


root@{yourboard}:/ # wpa_cli

> status

bssid=20:aa:4b:1b:a1:7c

ssid=ECTEST

id=0

mode=station

pairwise_cipher=NONE

group_cipher=NONE

key_mgmt=NONE

wpa_state=COMPLETED

ip_address=192.168.1.118

p2p_device_address=44:34:4c:8b:f2:10

address=44:34:4c:8b:f2:10

<3>CTRL-EVENT-STATE-CHANGE id=0 state=9 BSSID=20:aa:4b:1b:a1:7c SSID=ECTEST

<3>CTRL-EVENT-CONNECTED - connection to 20:aa:4b:1b:a1:7c completed (reauth) [id=0 id_str=]

> scan

cfg80211_rtw_scan(wlan0)

OK

> no packet in tx packet buffer (0)

survey done event(14) band:0 for wlan0

<3>CTRL-EVENT-SCAN-RESULTS

> scan_results

bssid / frequency / signal level / flags / ssid

20:aa:1b:1b:a1:7c       2437    -74     [WPS][ESS]      ECTEST

00:1d:3e:bd:10:05       2457    -85     [WPA-PSK-TKIP][ESS]     net02

68:7f:74:03:c6:be       2432    -59     [ESS]   \x00\x00\x00\x00

c8:23:73:3f:05:71       2462    -66     [ESS]   Nick's router. Hands off.



root@{yourboard}:/ # ifconfig wlan0

wlan0: ip 192.168.1.118 mask 255.255.255.0 flags [up broadcast running multicast]



root@{yourboard}:/ # dhcpcd wlan0

dhcpcd[3373]: version 5.5.6 starting

dhcpcd[3373]: wlan0: rebinding lease of 192.168.1.118

dhcpcd[3373]: wlan0: acknowledged 192.168.1.118 from 192.168.1.1

dhcpcd[3373]: wlan0: leased 192.168.1.118 for 86400 seconds

dhcpcd[3373]: forked to background, child pid 3405

root@{yourboard}:/ # netcfg

lo       UP                                   127.0.0.1/8   0x00000049 00:00:00:00:00:00

eth0     UP                               192.168.0.152/24  0x00001043 24:80:00:00:00:00

tunl0    DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00

sit0     DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00

ip6tnl0  DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00

wlan0    UP                               192.168.1.118/24  0x00001043 44:34:4c:8b:f2:10

wlan1    DOWN                                   0.0.0.0/0   0x00001002 46:34:4c:8b:f2:10

Good luck with it and please let me know if you need more info.




problem/solution:



if you get this problem:

E/wpa_supplicant( 3159): Could not set interface wlan0 flags (UP): Unknown error 132


solution:

missing rfkill, error 132 means "operation not possible due to RFkill"

vim kernel_imx/arch/arm/mach-mx6/board-mx6sl_{yourboard}.c

static int mx6sl_shd_bt_power_change(int status){return 0;}

static struct platform_device mxc_bt_rfkill = {

  .name = "mxc_bt_rfkill",

};

static struct imx_bt_rfkill_platform_data mxc_bt_rfkill_data = {

  .power_change = mx6sl_shd_bt_power_change,

};


/* init function  */

static void __init {yourboard}_init(void){

     ...

     mxc_register_device(&mxc_bt_rfkill, &mxc_bt_rfkill_data);

}


problem:

E/WifiHW ( 2488): Unable to open connection to supplicant on "/data/system/wpa_supplicant/wlan0": No such file or directory

solution:

setup correctly in init.rc and init.freescale.rc scripts wifi and wpa_supplicant permissions and services.



0 Kudos
Reply
26,711 Views
ranganathtm
Contributor I

Hi All,

I am working to bring up RealTeck USB wifi dongel on android 4.3 and kernel 3.0.35  below are steps I followed :

1) I am building  drivers as modules, copying them to  /system/lib/modules/ and after that I added below lines in init.rc before wpa_supplicant service start.

    insmod /system/lib/modules/cfg80211.ko

    insmod /system/lib/modules/mac80211.ko

    insmod /system/lib/modules/rtlwifi.ko

    insmod /system/lib/modules/rtl8192c-common.ko

    insmod /system/lib/modules/rtl8192cu.ko

2)wlan0 interface is creating successfully in /sys/class/net/wlan0.

3) After that I try to run below commands :


root@sabresd_6dq:wpa_supplicant -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf -dd -B ---> success


root@sabresd_6dq: wpa_cli ----> Able to scan the devices form command line .


But if I try to do from application I am getting below errors:


E/WifiHW  ( 2514): Unable to open connection to supplicant on "/data/system/wpa_supplicant/wlan0": Connection refused

D/BluetoothAdapter( 2755): 1101306992: getState() :  mService = null. Returning STATE_OFF

I/wpa_supplicant( 3163): Successfully initialized wpa_supplicant

I/wpa_supplicant( 3163): rfkill: Cannot open RFKILL control device

E/wpa_supplicant( 3163): nl80211: Could not configure driver to use managed mode

E/wpa_supplicant( 3163): Could not read interface p2p0 flags: No such device

E/wpa_supplicant( 3163): p2p0: Failed to initialize driver interface

kindly help me to solve issues.

Thanks In Advance,

Ranganath TM




0 Kudos
Reply
26,711 Views
zoranl
Contributor III

Hello Ranganath,


You need to run wpa_supplicant as service (in init.rc or init.xxxxx.rc script).


Do you need rf kill ?

We removed it completely from our android system.



BR,

Zoran



0 Kudos
Reply