Forum switched to read-only as of 2020/06/01
Latest product reviews |
---|
![]() |
![]() |
Smartphones ![]() |
TV Connect ![]() |
![]() |
ClockworkMod (CWM) Recovery easy install for RK3066 and RK3188 -- TWRP/CWM Flash-Tool and root for RK3288
 Please donate to support OMA and CrewRKTablets firmware work, thank you !



2015/02/11

Hello ri9000,
unfortunately, the WLAN driver kernel modules are not explicitly insmod'ed by the init.rc files.
It looks like a service "WifiHW" is responsible for doing it (can be seen from logcat output), and I assume that libhw_legacy.so might be involved, but I have been unable to find out any more details, so I hope for Oma's help with this...
Best regards,
awl


Contributor
2014/09/07

I found this which might help. Scroll down to "Changing Wifi and BT drivers".
This suggests a custom "/system/lib/libhardware_legacy.so"
edit: this service "/system/bin/svc wifi disable/enable" manages wifi. eg: for deep sleep etc.
The following users say thank you to ri9000 for this useful post:
awl
2015/02/11

Update:
My stock libhardware_legacy.so is either so much custom or incompatible due to the fact that it is an Android 4.1.1 version that it completely crashes the CM 10.1 installation when I replace it there.
I'm now trying to compile the MT5931 driver statically into the kernel and rename wlan.ko to mt5931.ko and see whether that might be a viable solution...

2015/02/11

Update: more progress, but once again stuck between a rock and a hard place...
I have now compiled the latest available version (2.14) of mt5931 inline into my kernel and renamed wlan.ko to mt5931.ko in order to make CM 10.1 libhardware_legacy.so successfully enable the wifi service. This works fine: wpa_supplicant starts up fine, but now my major issue is with wpa_supplicant:
- The wpa_supplicant version from CM10.1 is able to scan and detect the Wifi networks in my surrounding, and is also able to complete the WPS negotiation process and insert a proper connection description (with correct PSK) into wpa_supplicant.conf, but in the end is unable to connect to this network: "WPA: Failed to set PTK to the driver". I assume this is because nl80211 crypto support is not available in my kernel (and neither compiled into this version of wpa_supplicant).
- The original 4.1.1 wpa_supplicant version from my stock kernel is able to connect fine to my WPA2-encrypted network once its entry is already present in wpa_supplicant.conf (as it seems to include nl80211 crypto support in the binary), but is completely unable to find any networks during the scan process: for a yet unknown reason, it first states "nl80211: New scan results available", but shortly after "wlan0: No suitable network found".
So I either am unable to find any Wifi networks, or am able to find them, but then unable to connect...
@Oma:
Desperately need your help with this, especially as you seem to have been already aware of issues like that (see further up this thread). Have you been able to resolve this? The only way that I can currently think of is to compile a recent wpa_supplicant from scratch with nl80211 and crypto support statically linked into the binary (using Android NDK or gnueabi cross compiler)?
Looking forward to your kind advice!
Thanks a million & best regards,
awl
Â
Edit: I have just checked wpa_supplicant binary from Android 4.1.2 for Nexus 7, but it has the same issue as my stock version: unable to find any networks during the scan phase...


Moderator

Firmware Guru
2012/10/06

Sorry guys, very busy in real life.
Back to some recommendations given in the early posts.
1) with 3.0.8+ kernel use the CM10.1 build as linked in post #6; the model fix does contain everything to enable mt5931 wifi; the build includes already an autoloader (see here http://forum.xda-developers.com/showthread.php?t=2108704&highlight=loader&page=51); if you'd like to compile the wifi driver inline this model fix includes a wlan.ko which points to an inline driver: http://crewrktablets.arctablet.com/?wpfb_dl=2439
2) with 3.0.36+ kernel use the V88 KK build as linked in post #47, which includes a full mt5931 footprint
Pls note this is my tab: Chuwi V88 with MT5931 wifi - http://forum.xda-developers.com/showthread.php?t=2310818
We never could compile a kernel for that tab due to not published kernel sources. We never could compile a working mt5931 wifi footprint for KK builds (see here: http://crewrktablets.arctablet.com/?p=3555) due to the fact that sources are only leaked for JB. In KK the wext driver will not longer work.
- Oma -
The following users say thank you to Oma7144 for this useful post:
awl, ri9000Per aspera ad astra, we rock the Tablets !
If you like our firmwares, please consider making a donation to support our work.
Thank you!

2015/02/11

Hello Oma,
no worries, will be more busy in real life soon as well...
Regarding your 1):
- I have already reverted to trying the CM 10.1 build. I am up and running with regards to the driver, my issues now are with wpa_supplicant only (see above in #65).
- "Your" mt5931.ko v1.08 (wext) does not work with "my" Ventos stock 4.1.1 wpa_supplicant: The Ventos 4.1.1 stock wpa_supplicant has no wext, but only nl80211 support, and the Ventos stock kernel uses mt5931 v2.07 (based on nl80211).
- This means that none of your model fixes so far will work out of the box due to the issues with wpa_supplicant: The CM 10.1 version does return scan results, but does not connect due to the Ventos kernel lacking nl80211 crypto support (is this available as a module?). The stock Ventos version, only when run on CM 10.1, does not find any Wifi networks when scanning, so I am stuck even with CM 10.1.
Regarding 2): The MT5931 driver that supports nl80211 for JB is called version 2.x. The MT5931 driver that supports nl80211 for KK is called version 4.x
- The source code for v2.07 comes with the Ventos kernel sources as stated in post #1 in this thread. The source code for v2.14 is here: https://github.com/omegamoon/Rockchip-GPL-Kernel/tree/master/drivers/net/wireless/mt5931
- The source code for a KitKat-compliant version 4.02 is here: https://github.com/omegamoon/Rockchip-GPL-Kernel/tree/master/drivers/net/wireless/mt5931_kk/drv_wlan
I have not tried the KK version yet, but successfully included v2.14 into my kernel (can also compile as module).
So if you find some time, you have some new MT5931 sources that you can try...
What can I try in order to resolve the wpa_supplicant issues? Do you have a wpa_supplicant build that statically links in nl80211 (including nl80211 crypto)? It seems that this is what will be needed to get CM 10.1 to finally be usable...
Best regards,
awl

2015/02/11

Interesting news: Just ran across these kernel Kconfig options in drivers/net/wireless/Kconfig, which still seem pretty experimental (and unlinked to the rest of Kconfig, so they don't show up in make (g)config!!!) in the Ventos 3.0.8+ kernel source:
CONFIG_LIB80211_CRYPT_WEP
CONFIG_LIB80211_CRYPT_CCMP
CONFIG_LIB80211_CRYPT_TKIP
Will set them to "y" and recompile the kernel, then see if CM 10.1 stock wpa_supplicant will then be able to connect. Will report back later tonight...
Best regards,
awl


Moderator

Firmware Guru
2012/10/06

I meant sources to compile a libhardware_legacy.so. This one is the key.
The wlan.ko is just the spy sorting out what module it is and tells it to /sys/class/...
Here you have some idea of the process:
mkdir /data/system/wpa_supplicant
mkdir /data/misc/wifi/
chown wifi.wifi /data/system/wpa_supplicant
chown wifi.wifi /data/misc/wifi/
mkdir /data/misc/wifi/sockets
chown wifi.wifi /data/misc/wifi/sockets
echo "ctrl_interface=DIR=/data/system/wpa_supplicant GROUP=wifi" > /data/misc/wifi/wpa_supplicant.conf
echo "update_config=1" >> /data/misc/wifi/wpa_supplicant.conf
echo "ap_scan=1" >> /data/misc/wifi/wpa_supplicant.conf
chown wifi.wifi /data/misc/wifi/wpa_supplicant.conf
insmod /system/modules/mt5931.ko
wpa_supplicant -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf -dd &
wpa_cli -p/data/system/wpa_supplicant/
add_n
remove_n 1
set_n 0 ssid "NAME"
set_n 0 key_mgmt WPA-PSK
set_n 0 psk "PASSWORD"
enable_n 0q
netcfg
netcfg wlan0 dhcp
- Oma -
The following users say thank you to Oma7144 for this useful post:
awlPer aspera ad astra, we rock the Tablets !
If you like our firmwares, please consider making a donation to support our work.
Thank you!

2015/02/11

Hello again,
great news: Success! I have now a working MT5931 ver 2.14 WiFi driver in nl80211 mode on CM 10.1 with my custom 3.0.8+ kernel and stock CM 10.1 wpa_supplicant!
Two things were still missing:
- The kernel must include CONFIG_LIB80211_CRYPT_* variables to provide auth algorithms
- A small change in the mt5931 driver as described here:
http://t49302.linux-kernel-wireless-general.wirelessforum.info/mwifiex-return-success-in-set-default-key-for-wpa-wpa2-t49302.html
"set_default_key() is specific to WEP keys and should not be called in case of WPA/WPA2 security. The set_default_key() won't be called if wpa_supplicant uses "-Dwext" option, but it's been called if "-Dnl80211" option is specified."
The mt5931 implementation of set_default_key() has so far returned EINVAL in this case, which makes wpa_supplicant break: wpa_supplicant disconnects if the driver returns -EINVAL in set_default_key handler.
WPA: Installing PTK to the driver.
WPA: RSC - hexdump(len=6): 00 00 00 00 00 00
wpa_driver_nl80211_set_key: ifindex=3 alg=2 addr=0x9f6eef8 key_idx=0 set_tx=1 seq_len=6 key_len=32
addr=00:50:43:21:07:f8
nl80211: set_key default failed; err=-22 Invalid argument)
WPA: Failed to set PTK to the driver (alg=2 keylen=32 bssid=00:50:43:21:07:f8)
wpa_driver_nl80211_disconnect
So I will now continue to look into getting Bluetooth to work...
Best regards,
awl
The following users say thank you to awl for this useful post:
zoz
2015/02/11

Hello Oma,
using my custom model patch that - for Bluetooth (MT5931/MT6622 combo) - contains
/system/etc/firmware/MTK_MT6622_E2_Patch.nb0
/system/lib/libbluetooth_mtk.so
Bluetooth does not yet work on CM 10.1 (CrewRKTablets_RK30_Genio by Oma_CM10.1_v1.4).
I have attached two log excerpts: dmesg and logcat (all messages containing grep expressions "-i -e blue -e bt").
Do you have any ideas what to do next in order to find out why Bluetooth does not work?
One more time, thanks a million!
awl


Moderator

Firmware Guru
2012/10/06

Bluetooth stack has changed: http://elinux.org/images/f/f5/Bringing_the_bluez_back_to_android--holtmann.pdf
Check for hci kernel support and your bt vendor lib (/system/vendor/lib/).
- Oma -
The following users say thank you to Oma7144 for this useful post:
awlPer aspera ad astra, we rock the Tablets !
If you like our firmwares, please consider making a donation to support our work.
Thank you!

2015/02/11

Hello again, Oma,
oops - this does not sound promising...
The stock 4.1.1 image from Trekstor does not have any vendor libs (other than /system/vendor/pittpatt/detection and /system/vendor/pittpatt/recognition).
This is the current 3.0.8 kernel config in terms of Bluetooth:
# Bluetooth device drivers
# CONFIG_BT_AUTOSLEEP is not set
# CONFIG_BT_BNEP_MC_FILTER is not set
# CONFIG_BT_BNEP_PROTO_FILTER is not set
CONFIG_BT_BNEP=y
# CONFIG_BT_HCIBCM203X is not set
CONFIG_BT_HCIBCM4325=m
# CONFIG_BT_HCIBFUSB is not set
# CONFIG_BT_HCIBPA10X is not set
# CONFIG_BT_HCIBTSDIO is not set
# CONFIG_BT_HCIBTUSB is not set
# CONFIG_BT_HCIUART_ATH3K is not set
# CONFIG_BT_HCIUART_BCSP is not set
CONFIG_BT_HCIUART_H4=y
CONFIG_BT_HCIUART_LL=y
CONFIG_BT_HCIUART=y
# CONFIG_BT_HCIVHCI is not set
CONFIG_BT_HIDP=y
CONFIG_BT_L2CAP=y
CONFIG_BT_MODULE_NH660=y
# CONFIG_BT_MRVL is not set
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_RFCOMM=y
CONFIG_BT_SCO=y
What do we exactly need in terms of "kernel hci support"? These kernel options have definitely been sufficient to make "bluez" work on stock Android 4.1.
In addition, I do have a binary /system/bin/hciattach in the Trekstor 4.1 image, but I don't know how it fits into the whole scenario. Would it make sense to try and copy this to the CM 10.1 system (where this executable does not exist)?
What would you advise? Trying to reintroduce 4.1 "bluez" (is there a tutorial or past experience doing so?) or trying to get 4.2 Broadcom "bluedroid" to run on MT6622?
Thanks again & best regards,
awl

2015/02/11

Addition: content of original stock system.img regarding Bluetooth
android@android-build:~/stock$ find system -name "*bt*"
system/lib/libthread_db.so
system/lib/libbtio.so
system/lib/libttspico.so
system/lib/libtinyalsa.so
system/lib/libttscompat.so
system/xbin/bt_sco_app
system/xbin/btool
system/xbin/bttest
android@android-build:~/stock$ find system -name "*blue*"
system/lib/libbluetooth.so
system/lib/libbluedroid.so
system/lib/bluez-plugin
system/lib/bluez-plugin/bluetooth-health.so
system/lib/libbluetoothd.so
system/lib/libbluetooth_mtk.so
system/etc/bluez
system/etc/bluetooth
system/bin/bluetoothd
android@android-build:~/stock$ find system -name "*hci*"
system/xbin/hcidump
system/xbin/hciconfig
system/xbin/hcitool
system/bin/hciattach
Hope this helps...
awl


Moderator

Firmware Guru
2012/10/06

Copy attached files into /system/lib.
- Oma -
The following users say thank you to Oma7144 for this useful post:
awlPer aspera ad astra, we rock the Tablets !
If you like our firmwares, please consider making a donation to support our work.
Thank you!
Most Users Ever Online: 749
Currently Online:
85 Guest(s)
Currently Browsing this Page:
2 Guest(s)
Devices in use: Desktop (71), Phone (14)
Top Posters:
finless: 604
DarthJabba: 551
maikal: 394
mussonero1: 350
alex: 252
damo: 243
DanielVd: 237
Mark06: 222
Newest Members:
jessicapeterson
Riki111
andre92
firmwarefile
mongol
country822
Forum Stats:
Groups: 10
Forums: 185
Topics: 6037
Posts: 60500
Member Stats:
Guest Posters: 43
Members: 262194
Moderators: 5
Admins: 1
Administrators: admin
Moderators: globula_neagra, exelletor, JochenKauz, Oma7144, cracktech
CrewRKTablets moderators: JochenKauz and Astralix