Adding CSR WiFi driver to iMX6 JB4.2.2 buld

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

Adding CSR WiFi driver to iMX6 JB4.2.2 buld

ソリューションへジャンプ
10,203件の閲覧回数
martinhowell
Contributor III

I am trying to add a CSR WiFi driver to the JB 4.2.2 build for the iMX.

I have a working unifi_sdio.ko module (I think it is working as I can manually load it with insmod and the log messages tell me it is happy)

I changed the Boardconfig.mk as follows:


# for APM module with CSR_UNIFI
ifeq ($(BOARD_WLAN_VENDOR),CSR_UNIFI)

WIFI_DRIVER_MODULE_PATH :=  "/system/lib/modules/unifi_sdio.ko"
WIFI_DRIVER_MODULE_NAME     := "unifi_sdio"
WIFI_DRIVER_MODULE_ARG      := ""
WIFI_FIRMWARE_LOADER        := ""
WPA_SUPPLICANT_VERSION      := VER_0_8_X
BOARD_WPA_SUPPLICANT_DRIVER := WEXT
BOARD_HOSTAPD_DRIVER        := WEXT
BOARD_HAVE_WIFI_CSR = true

endif

I use the standard wifi.c module in /hardware/libhardware_legacy/wifi

I built and deployed the new system and when I try to tur the wifi on on the settings page the on screen switch goes on and the screen says "turning wifi on"  I can see the unifi_sdio.ko module load from the debug messages, but then the switch goes off and nothing else happens.

If I use logcat to show activity from the Wifi module I get:

root@android:/ # logcat | grep Wifi

I/AudioFlinger( 2255): loadHwModule() Loaded r_submix audio interface from Wifi Display audio HAL (audio) handle 2

E/WifiStateMachine( 2548): Failed to disable IPv6: java.lang.IllegalStateException: command '1 interface ipv6 wlan0 disa

ble' failed with '400 1 Failed to change IPv6 state (No such file or directory)'

I/WifiService( 2548): WifiService starting up with Wi-Fi disabled

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

E/WifiStateMachine( 2548): Failed to reload STA firmware java.lang.IllegalStateException: command '31 softap fwreload wl

an0 STA' failed with '400 31 Softap operation failed (No such file or directory)'

E/WifiStateMachine( 2548): Unable to change interface settings: java.lang.IllegalStateException: command '33 interface s

etcfg wlan0 0.0.0.0 0 down' failed with '400 33 Failed to set address (No such device)'

+++ LOG: malformed log message

I/unifi_helper( 3188): Synergy Wifi Example Application starting...

E/WifiHW  ( 2548): Failed to stop supplicant

E/WifiHW  ( 2548): Error changing group ownership of /data/misc/wifi/wpa_supplicant.conf to 1010: Operation not permitte

d

E/WifiHW  ( 2548): Wi-Fi will not be enabled

E/WifiStateMachine( 2548): Failed to start supplicant!

D/WifiHW  ( 2548): Unable to unload driver module "unifi_sdio": Try again

E/WifiStateMachine( 2548): Failed to unload driver!

E/WifiStateMachine( 2548): DriverFailedState

It looks like amongst others there is an error changing permissions of a file. How do I resolve this?

Is there anything else I should be doing?

ラベル(2)
0 件の賞賛
返信
1 解決策
2,470件の閲覧回数
martinhowell
Contributor III

Ok, I have solved it, my fault really for trying to be clever and not describing the situation completely.

I was running the Android file system on an NFS share on my dev machine. In desperation I tried programming everything onto the device's native file system and hey-presto it burst into life.

There must be some subtle differences in file permissions on nfs shares.

I have subsequently been told that Android and nfs are known to have problems, first I had heard of it though. You live and learn...

元の投稿で解決策を見る

0 件の賞賛
返信
9 返答(返信)
2,470件の閲覧回数
mutyalaraoneela
Contributor III

Hi all,

  I am glad to inform you that the above issue which I have posted earlier got resolved, but I have another 2 issues one while data transfer, the other while enabling via GUI.

   1) After enabling bluetooth, while transferring file from third party mobile to IMX_6SL board, file is getting transferred(TX), but vice versa (RX) is not happening, it is giving the error message :

   File not Received

   File : sample.jpg

   Reason : Storage issue

  2) And presently I am inserting my driver via GUI, I am getting an error message while enabling bluetooth via GUI   ie Operation not permitted while loading .ko (driver)Please suggest me what to do?? whether I need to install my driver at boot by adding in init.rc?? if I do it always on boot bt will be in ON State only??  OR Do i need to build my driver along with android source code???

Please suggest me how to proceed further???

Thanks and Regards,

Mutyala Rao.

0 件の賞賛
返信
2,470件の閲覧回数
martinhowell
Contributor III

Ok, a bit more progress, in the init.rc script I found the wpa_supplicant service specified a nl80211 type driver where I am using wext.

I changed it to the following (although I am not quite sure what this does)

I also copied the wpa_supplicant.conf file to the directory it is expecting (even though the wifi.c file should be doing this) and set the correct permissions manually

service wpa_supplicant /system/bin/wpa_supplicant \

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

    class late_start

    disabled

    oneshot

Now when I turn Wifi on, the button stays on for much longer and I get the following in the log: So it looks like it cannot talk to the wpa_supplicant over the control channel whatever that is and however that should be setup.

Can anyone tell me how this should be done?

I/WifiService( 2539): WifiService starting up with Wi-Fi disabled

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

E/WifiStateMachine( 2539): Failed to reload STA firmware java.lang.IllegalStateException: command '23 softap fwreload wl

an0 STA' failed with '400 23 Softap operation failed (Invalid argument)'

E/WifiStateMachine( 2539): Unable to change interface settings: java.lang.IllegalStateException: command '25 interface s

etcfg wlan0 0.0.0.0 0 down' failed with '400 25 Failed to set address (No such device)'

E/WifiHW  ( 2539): Error changing group ownership of /data/misc/wifi/entropy.bin to 1010: Operation not permitted

+++ LOG: malformed log message

E/WifiHW  ( 2539): Wi-Fi entropy file was not created

I/unifi_helper( 3096): Synergy Wifi Example Application starting...

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

tory

E/WifiHW  ( 2539): Supplicant not running, cannot connect

E/WifiHW  ( 2539): Supplicant not running, cannot connect

E/WifiHW  ( 2539): Supplicant not running, cannot connect

E/WifiHW  ( 2539): Supplicant not running, cannot connect

E/WifiHW  ( 2539): Supplicant not running, cannot connect

E/WifiStateMachine( 2539): Failed to setup control channel, restart supplicant

E/WifiStateMachine( 2539): Failed to reload STA firmware java.lang.IllegalStateException: command '27 softap fwreload wl

an0 STA' failed with '400 27 Softap operation failed (No such device)'

E/WifiHW  ( 2539): Error changing group ownership of /data/misc/wifi/entropy.bin to 1010: Operation not permitted

E/WifiHW  ( 2539): Wi-Fi entropy file was not created

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

tory

E/WifiStateMachine( 2539): Failed to setup control channel, restart supplicant

E/WifiStateMachine( 2539): Failed to reload STA firmware java.lang.IllegalStateException: command '31 softap fwreload wl

an0 STA' failed with '400 31 Softap operation failed (Cannot assign requested address)'

E/WifiHW  ( 2539): Error changing group ownership of /data/misc/wifi/entropy.bin to 1010: Operation not permitted

E/WifiHW  ( 2539): Wi-Fi entropy file was not created

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

E/WifiStateMachine( 2539): Failed to setup control channel, restart supplicant

E/WifiStateMachine( 2539): Failed to reload STA firmware java.lang.IllegalStateException: command '35 softap fwreload wl

an0 STA' failed with '400 35 Softap operation failed (Cannot assign requested address)'

E/WifiHW  ( 2539): Error changing group ownership of /data/misc/wifi/entropy.bin to 1010: Operation not permitted

E/WifiHW  ( 2539): Wi-Fi entropy file was not created

ADDRCONF(NETDEV_UP): wlan0: link is not ready

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

E/WifiStateMachine( 2539): Failed to setup control channel, restart supplicant

E/WifiStateMachine( 2539): Failed to reload STA firmware java.lang.IllegalStateException: command '39 softap fwreload wl

an0 STA' failed with '400 39 Softap operation failed (Cannot assign requested address)'

E/WifiHW  ( 2539): Error changing group ownership of /data/misc/wifi/entropy.bin to 1010: Operation not permitted

E/WifiHW  ( 2539): Wi-Fi entropy file was not created

ADDRCONF(NETDEV_UP): wlan0: link is not ready

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

E/WifiStateMachine( 2539): Failed to setup control channel, restart supplicant

E/WifiStateMachine( 2539): Failed to reload STA firmware java.lang.IllegalStateException: command '43 softap fwreload wl

an0 STA' failed with '400 43 Softap operation failed (Cannot assign requested address)'

E/WifiHW  ( 2539): Error changing group ownership of /data/misc/wifi/entropy.bin to 1010: Operation not permitted

E/WifiHW  ( 2539): Wi-Fi entropy file was not created

ADDRCONF(NETDEV_UP): wlan0: link is not ready

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

0 件の賞賛
返信
2,470件の閲覧回数
jamesbone
NXP TechSupport
NXP TechSupport

I am not an expert in Android, but let me send you this script that it is useful to add the WIFI Card to a PC.

0 件の賞賛
返信
2,470件の閲覧回数
martinhowell
Contributor III

Thanks but I dont think that script helps me.

I have got to the stage where I can load the driver with insmod, attach the wpa_supplicant to the driver, and can interact with it with wpa_cli. I can list networks, and connect to them with wpa_cli via the command line. But I Cannot get the Android GUI to do this, its very frustrating.

I have 2 issues as I see it.

1. The wifi.c module in /hardware/hardware_legacy/wifi/ (which is part of the android system that turns on the Wifi and sets up the communication with the driver). This module when Wifi is first turned on in a brand new system will check for the presence of the file /data/misc/wifi/wpa_supplicant.conf. If it is not present it copies a template file from /system/etc/wifi/wpa_supplicant.conf (this file is on a ro part of the f/s and it needs to copy it to a rw part of the f/s). It then sets the file permissions to read/write, then it attempts to change the owner and group of the file to system:wifi (the process running this code is user system). This call always fails which cocks things up the first time round so clearly there is some file permission error problem here. I can get round that by manually correcting the file owner from the command line and rebooting. Then we hit problem #2

2. The Android GUI needs to talk to the wpa_supplicant service via some pseudo file on /data/system/wpa_supplicant/wlan0  (where wlan0 is the name of the device driver for the wifi) However when it tries to open this file which does exist it fails with the error connection refused. Again maybe a permission problem but I cant change the owner:group of this file manually as it is created everytime the wifi driver loads. So I am stuck. (wpa_cli can connect to the wpa_supplicant via this file so it can be done!!)

Anyone got any clues?

Martin

0 件の賞賛
返信
2,471件の閲覧回数
martinhowell
Contributor III

Ok, I have solved it, my fault really for trying to be clever and not describing the situation completely.

I was running the Android file system on an NFS share on my dev machine. In desperation I tried programming everything onto the device's native file system and hey-presto it burst into life.

There must be some subtle differences in file permissions on nfs shares.

I have subsequently been told that Android and nfs are known to have problems, first I had heard of it though. You live and learn...

0 件の賞賛
返信
2,470件の閲覧回数
varsmolta
Contributor V

Hi. I am using a Ralink Rt73 based usb wifi dongle with Android JB 4.3.

Like you, I am able to load the driver with insmod, attach the wpa_supplicant to the driver, and can interact with it with wpa_cli, as well as ping nodes on my local network from my sabrelite board. But when I try to enable wifi from the Android GUI. the Settings app just says "Turning Wifi-on" but it never proceeds beyond this point. My logcat ony shows this relevant info:

I/SystemServer( 2720): Connectivity Service

D/ConnectivityService( 2720): ConnectivityService starting up

D/ConnectivityService( 2720): wifiOnly=false

E/ConnectivityService( 2720): Ignoring protectedNetwork 10

E/ConnectivityService( 2720): Ignoring protectedNetwork 11

E/ConnectivityService( 2720): Ignoring protectedNetwork 12

W/ContextImpl( 2720): Calling a method in the system process without a qualified user: android.app.ContextImpl.bindService:1439 android.bluetooth.BluetoothPan.<init>:141 android.bluetooth.BluetoothAdapter.getProfileProxy:1171 android.bluetooth.BluetoothTetheringDataTracker.startMonitoring:121 com.android.server.ConnectivityService.<init>:586

I/WifiService( 2720): WifiService starting up with Wi-Fi enabled

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

I/SystemServer( 2720): Network Service Discovery Service

D/NsdService( 2720): Network service discovery enabled true

I/SystemServer( 2720): UpdateLock Service

Have you been able to figure out how to enable wifi from the GUI? Thanks

0 件の賞賛
返信
2,470件の閲覧回数
x-arm
Contributor I

Hi, could you describe the changes you've made in BoardConfig.mk and build tree to have Ralink Rt73 based wifi dongle supported? Thanks

0 件の賞賛
返信
2,470件の閲覧回数
varsmolta
Contributor V

All i did was rebuilt the kernel modules with these options:

CONFIG_RT2X00=m

CONFIG_RT73USB=m

CONFIG_RT2X00_LIB_USB=m

CONFIG_RT2X00_LIB=m

CONFIG_RT2X00_LIB_FIRMWARE=y

CONFIG_RT2X00_LIB_CRYPTO=y

CONFIG_RT2X00_LIB_LEDS=y

CONFIG_RT2X00_DEBUG=y

Move the modules over to the target and insmod them.

Place the rt73.bin firmware file (you can get this from your linux PC) to /system/etc/firmware on your on your android target device. Insert the usb stick, turn on wifi in Android gui and you should be connected

0 件の賞賛
返信
2,470件の閲覧回数
varsmolta
Contributor V

ok i got it working.

In the GUI, I went into airplane mode and then came out of airplane mode.

And then I turned the Wifi on in the GUI

It asked me for WPA PSK (don't know why even though my wpa_supplicant.conf file has that info), entered the PSK and voila, I am connected.

I can paste my logs if you want

0 件の賞賛
返信