Cannot get WiFi and Bluetooth running

1,031 views
Skip to first unread message

BiX

unread,
Mar 10, 2011, 1:58:18 AM3/10/11
to android-porting
Using Gingerbread on OMAP 3530

For WiFi:

1. Build rt73 as loadable module.
2. Added BOARD_WLAN_TI_STA_DK_ROOT in BoardConfig.mk to build
wlan_loader.
3. Placed rt73usb.ko, rt2x00lib.ko & rt2x00usb.ko in /system/lib/
modules.
4. Placed rt73.bin in /system/etc/firmware.

Locat:
I/WifiHW ( 973): Loading WiFi Modules
E/WifiHW ( 973): Cannot find driver rt73usb in proc
I/WifiHW ( 973): insmod
I/WifiHW ( 973): insmod
I/WifiHW ( 973): insmod
D/Tethering( 973): wlan0 is not a tetherable iface, ignoring
E/wlan_loader( 1316): Cannot open eeprom image file <./nvs_map.bin>:
No such file or directory
E/wlan_loader( 1316): init_driver() failed
I/WifiHW ( 973): rmmod
E/Tethering( 973): attempting to remove unknown iface (wlan0),
ignoring
E/WifiService( 973): Failed to load Wi-Fi driver.

For Bluetooth:

1. Build HCI USB and HCI UART for kernel.
2. Add to BoardConfig.mk:
BOARD_HAVE_BLUETOOTH := true
3. Remove from $ANDROID/system/bluetooth/bluedroid/bluetooth.c:
if (set_bluetooth_power(1) < 0) goto out;


Once Bluetooth is ticked, this message will keep repeating 'E/
bluetooth_ScoSocket.cpp( 1035): accept_work socket() failed: Protocol
not supported'.
I can scan with hcitool scan but if I try to l2ping, I'll get 'Can't
create socket: Protocol not supported'.

Logcat:
I/bluedroid( 972): Starting hciattach daemon
I/bluedroid( 972): Starting bluetoothd deamon
E/BluetoothEventLoop.cpp( 972): event_filter: Received signal
org.freedesktop.DBus:NameAcquired from /org/freedesktop/DBus
E/BluetoothEventLoop.cpp( 972): event_filter: Received signal
org.bluez.Adapter:PropertyChanged from /org/bluez/1309/hci0
D/BluetoothService( 972): Bluetooth state 11 -> 12
V/BluetoothEventRedirector( 1289): Received
android.bluetooth.adapter.action.STATE_CHANGED
E/BluetoothAudioGateway.cpp( 1035): Can't create RFCOMM socket
E/BT Audio Gateway( 1035): Could not set up listening socket, exiting
E/bluetooth_ScoSocket.cpp( 1035): accept_work socket() failed:
Protocol not supported


Things added to my init.rc:

# wifi
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

#bluetooth power up/down interface
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
chmod 0660 /sys/class/rfkill/rfkill0/state

setprop wifi.interface wlan0
setprop wlan.driver.status ok

service wlan_loader /system/bin/wlan_loader
disabled
oneshot

service ifcfg_ralink /system/bin/ifconfig wlan0 up
disabled
oneshot

service wpa_supplicant /system/bin/wpa_supplicant -dd -Dwext -iwlan0 -
c /system/etc/wifi/wpa_supplicant.conf
group system wifi inet
disabled
oneshot

service dhcpcd /system/bin/logwrapper /system/bin/dhcpcd -d wlan0
disabled
oneshot
#group system dhcp

service hciattach /system/bin/hciattach -l
user root
# changing user to root from bluetooth is a potential security issue
# service hciattach_legacy is used instead of hciattach because, we
dont
# have nodes named ttyHS0
group bluetooth net_bt_admin misc
disabled
oneshot

on property:init.svc.wpa_supplicant=stopped
stop dhcpcd

Pavan Savoy

unread,
Mar 10, 2011, 8:30:27 AM3/10/11
to bix...@gmail.com, android-porting

You need to enable these in your kernel,
#
# Network testing
#
# CONFIG_NET_PKTGEN is not set
# CONFIG_HAMRADIO is not set
# CONFIG_CAN is not set
# CONFIG_IRDA is not set
CONFIG_BT=y
CONFIG_BT_L2CAP=y
# CONFIG_BT_L2CAP_EXT_FEATURES is not set
CONFIG_BT_SCO=y
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
# CONFIG_BT_BNEP is not set
CONFIG_BT_HIDP=y

> --
> unsubscribe: android-porti...@googlegroups.com
> website: http://groups.google.com/group/android-porting
>

--
--Pavan Savoy

BiX

unread,
Mar 11, 2011, 3:09:56 AM3/11/11
to android-porting
Ok, I've enabled all those that you have listed down.
This time I can toggle wifi but once I navigate to some other places,
it untoggles.
If I try to on wifi inside wifi settings, it'll return error to me.
netcfg shows only lan0
Still getting the same results as the previous logcat.

For bluetooth, I can do hcitool scan once in a while but for l2ping,
I'll still get 'Can't
create socket: Protocol not supported'.

These are the new errors for bluetooth:

E/BluetoothService.cpp( 982): setAdapterPropertyNative: D-Bus error:
org.bluez.Error.NotReady (Adapter is not ready)
I/InputDispatcher( 982): Application is not responding:
AppWindowToken{40708b28 token=HistoryRecord{4066a888
com.android.settings/.bluetooth.BluetoothSettings}} - Window{40667200
com.android.settings/com.android.settings.bluetooth.BluetoothSettings
paused=false}. 5005.1ms since event, 5003.4ms since wait started
I/WindowManager( 982): Input event dispatching timed out sending to
com.android.settings/com.android.settings.bluetooth.BluetoothSettings

D/BluetoothService( 982): Bluetooth state 12 -> 13
D/ScoSocket( 1050): android.bluetooth.ScoSocket@40539c10 SCO OBJECT
close() mState = 2
I/BtOppRfcommListener( 1215): stopping Accept Thread
E/BtOppRfcommListener( 1215): Error accept connection
java.io.IOException: Operation Canceled
I/BtOppRfcommListener( 1215): BluetoothSocket listen thread finished
V/BluetoothEventRedirector( 1869): Received
android.bluetooth.adapter.action.STATE_CHANGED
E/BluetoothEventLoop.cpp( 982): tearDownEventLoop: D-Bus error:
org.freedesktop.DBus.Error.UnknownMethod (Method "UnregisterAgent"
with signature "o" on interface "org.bluez.Adapter" doesn't exist
E/BluetoothEventLoop.cpp( 982): )
I/bluedroid( 982): Stopping bluetoothd deamon
I/bluedroid( 982): Stopping hciattach deamon
W/bluedroid( 982): open(/sys/class/rfkill/rfkill0/type) failed: No
such file or directory (2)
D/BluetoothService( 982): Bluetooth state 13 -> 10
V/BluetoothEventRedirector( 1869): Received
android.bluetooth.adapter.action.STATE_CHANGED

On Mar 10, 9:30 pm, Pavan Savoy <pavan.sa...@gmail.com> wrote:

BiX

unread,
Mar 14, 2011, 5:30:59 AM3/14/11
to android-porting
Thanks Pavan for the config.

WiFi:
I built wpa_supplicant instead of BOARD_WLAN_TI_STA_DK_ROOT.
These are the changes I've made:
1. Add to BoardConfig.mk:
BOARD_WPA_SUPPLICANT_DRIVER := WEXT
2. Uncommment wpa_supplicant config in external/wpa_supplicant/
Android.mk
3. Add to init.rc:
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
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

However, I still cannot get WiFi on.

Logcat:
I/WifiHW ( 1004): Loading WiFi Modules
E/WifiHW ( 1004): Cannot find driver rt73usb in proc
I/WifiHW ( 1004): insmod
I/WifiHW ( 1004): insmod
I/WifiHW ( 1004): insmod
I/WifiHW ( 1004): start wifi_start_supplicant
E/WifiHW ( 1004): ensure_config_file_exists
I/WifiHW ( 1004): Wi-Fi is running
I/WifiHW ( 1004): wifi_command called, cmd:BLACKLIST clear
I/WifiHW ( 1004): wifi_send_command, cmd = BLACKLIST clear
I/WifiHW ( 1004): wifi_connect_to_supplicant called
I/WifiHW ( 1004): Interface directory = /data/system/wpa_supplicant
I/WifiHW ( 1004): Interface name = wlan0
E/WifiHW ( 1004): Unable to open connection to supplicant on "wlan0":
No such file or directory
D/WifiStateTracker( 1004): Reset connections and stopping DHCP
E/wpa_supplicant( 1391): Failed to read or parse configuration '/
system/etc/wifi/wpa_supplicant.conf'.
I/logwrapper( 1388): /system/bin/wpa_supplicant terminated by
exit(255)
D/WifiStateTracker( 1004): Disabling interface


Bluetooth:
I can scan devices! However I cannot seem to pair with them.

Logcat:
D/BluetoothService( 1003): 00:27:13:6D:D5:0C bond state 11 -> 10 (0)
W/BluetoothService( 1003): setBondState() called to unbond device, but
reason code is invalid. Overriding reason code with
BOND_RESULT_REMOVED
I/BluetoothEventLoop.cpp( 1003): agent_event_filter: Received method
org.bluez.Agent:Release
V/BluetoothEventRedirector( 1345): Received
android.bluetooth.device.action.BOND_STATE_CHANGED
W/CachedBluetoothDeviceManager( 1345): showUnbondMessage: Not
displaying any message for reason:9

Are there any modifications or modules missing?
Thanks in advance.

On Mar 10, 9:30 pm, Pavan Savoy <pavan.sa...@gmail.com> wrote:

Pavan Savoy

unread,
Mar 14, 2011, 9:14:41 AM3/14/11
to bix...@gmail.com, android-porting

Here you either need to build rt73usb as module or comment this out from wifi.c

> I/WifiHW  ( 1004): insmod
> I/WifiHW  ( 1004): insmod
> I/WifiHW  ( 1004): insmod
> I/WifiHW  ( 1004): start wifi_start_supplicant
> E/WifiHW  ( 1004): ensure_config_file_exists
> I/WifiHW  ( 1004): Wi-Fi is running
> I/WifiHW  ( 1004): wifi_command called, cmd:BLACKLIST clear
> I/WifiHW  ( 1004): wifi_send_command, cmd = BLACKLIST clear
> I/WifiHW  ( 1004): wifi_connect_to_supplicant called
> I/WifiHW  ( 1004): Interface directory = /data/system/wpa_supplicant
> I/WifiHW  ( 1004): Interface name = wlan0
> E/WifiHW  ( 1004): Unable to open connection to supplicant on "wlan0":
> No such file or directory
> D/WifiStateTracker( 1004): Reset connections and stopping DHCP
> E/wpa_supplicant( 1391): Failed to read or parse configuration '/
> system/etc/wifi/wpa_supplicant.conf'.

problem here - wpa_supplicant.conf not found....

> I/logwrapper( 1388): /system/bin/wpa_supplicant terminated by
> exit(255)
> D/WifiStateTracker( 1004): Disabling interface
>
>
> Bluetooth:
> I can scan devices! However I cannot seem to pair with them.
>
> Logcat:
> D/BluetoothService( 1003): 00:27:13:6D:D5:0C bond state 11 -> 10 (0)
> W/BluetoothService( 1003): setBondState() called to unbond device, but
> reason code is invalid. Overriding reason code with
> BOND_RESULT_REMOVED
> I/BluetoothEventLoop.cpp( 1003): agent_event_filter: Received method
> org.bluez.Agent:Release
> V/BluetoothEventRedirector( 1345): Received
> android.bluetooth.device.action.BOND_STATE_CHANGED
> W/CachedBluetoothDeviceManager( 1345): showUnbondMessage: Not
> displaying any message for reason:9

from the earlier messages, the adapter itself doesn't seem to be up,
for example - you can try hciconfig -a - to check the status of adapter.

> Are there any modifications or modules missing?


As a general rule - enable Wi-Fi or Bluetooth from command line first
- start using them as in scanning APs or BT devices and then try and
enable them from the UI ...

BiX

unread,
Mar 14, 2011, 10:44:22 PM3/14/11
to android-porting
> problem here - wpa_supplicant.conf not found....
My wpa_supplicant.conf was placed in system/etc/wifi. Where else
should it be placed in?

> build rt73usb as module
I rebuild rt73 as module, placed rt2x00lib.ko, rt2x00usb.ko and
rt73usb.ko in /system/lib/modules and rt73.bin is placed in /system/
etc/firmware.

I'm getting different errors this time:
phy0 -> rt2x00_print_chip: Info - Chipset detected - rt: 1300, rf:
0002, rev: 0.
usbcore: registered new interface driver
rt73usb
phy0 -> rt2x00lib_request_firmware: Info - Loading firmware file
'rt73.bin'.
rt73usb 1-2.1:1.0: firmware: requesting
rt73.bin
usbcore: deregistering interface driver
rt73usb
phy0 -> rt2x00lib_request_firmware: Error - Failed to request
Firmware.

Logcat:
I/WifiHW ( 990): Loading WiFi Modules
E/WifiHW ( 990): Cannot find driver rt73usb in proc
I/WifiHW ( 990): insmod
I/WifiHW ( 990): insmod
I/WifiHW ( 990): insmod
D/Tethering( 990): wlan0 is not a tetherable iface, ignoring
I/WifiHW ( 990): rmmod
E/Tethering( 990): attempting to remove unknown iface (wlan0),
ignoring
E/WifiService( 990): Failed to load Wi-Fi driver.

> Cannot find driver rt73usb in proc
Thinking that it expects rt73usb.ko to be in the proc folder, I
created a proc/modules and copied it over to proc and proc/modules
just to be safe.
However the error still remains.

> try hciconfig -a
The adapter is down but when I tried hciconfig up it still stay down.
I can only turn the adapter on in UI which hciconfig -a will return an
up.
Bluetooth is unstable for me; sometimes it cannot scan for other
devices and display timeout.

On Mar 14, 9:14 pm, Pavan Savoy <pavan.sa...@gmail.com> wrote:

BiX

unread,
Mar 14, 2011, 10:53:23 PM3/14/11
to android-porting
> comment this out from wifi.c
I modified it according to http://projectkennel.com/wiki/diffs/wifi.html
so it's wrong?

On Mar 14, 9:14 pm, Pavan Savoy <pavan.sa...@gmail.com> wrote:

BiX

unread,
Mar 14, 2011, 10:52:24 PM3/14/11
to android-porting
> comment this out from wifi.c
My wifi.c was modified to follow http://projectkennel.com/wiki/diffs/wifi.html
so this is wrong?

On Mar 14, 9:14 pm, Pavan Savoy <pavan.sa...@gmail.com> wrote:

BiX

unread,
Mar 17, 2011, 5:39:09 AM3/17/11
to android-porting
Ok I followed this article http://blog.linuxconsulting.ro/2010/04/porting-wifi-drivers-to-android.html
Built following the Unix standard socket as /data/system/
wpa_supplicant seems to be needed.

Created wlan_loader with:

#!/system/bin/sh
#
# WLAN Loader
#
if netcfg wlan0 up; then
sleep 1
setprop wlan.driver.status ok
fi


When I tried to on WiFi, logcat keep repeating the same errors:

E/WifiService( 1016): Failed to unload Wi-Fi driver.
I/WifiHW ( 1016): Loading WiFi Modules
E/WifiHW ( 1016): Cannot find driver rt73usb in proc
I/WifiHW ( 1016): insmod
I/WifiHW ( 1016): insmod
I/WifiHW ( 1016): insmod
D/wpa_supplicant( 1484): RTM_NEWLINK: operstate=0 ifi_flags=0x1002 ()
D/wpa_supplicant( 1484): RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0'
added
D/wpa_supplicant( 1484): RTM_NEWLINK: operstate=0 ifi_flags=0x1003
([UP])
D/wpa_supplicant( 1484): RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0'
added
I/WifiHW ( 1016): start wifi_start_supplicant
E/WifiHW ( 1016): ensure_config_file_exists
I/WifiHW ( 1016): Wi-Fi is running
I/WifiHW ( 1016): wifi_connect_to_supplicant called
I/WifiHW ( 1016): Interface directory = /data/system/wpa_supplicant
I/WifiHW ( 1016): Interface name = /data/system/wpa_supplicant/wlan0
I/WifiHW ( 1016): Connect to Supplicant done
I/WifiHW ( 1016): wifi_command called, cmd:DRIVER MACADDR
I/WifiHW ( 1016): wifi_send_command, cmd = DRIVER MACADDR
D/wpa_supplicant( 1484): wpa_driver_priv_driver_cmd MACADDR len = 4096
E/wpa_supplicant( 1484): wpa_driver_priv_driver_cmd failed
I/wpa_supplicant( 1484): CTRL-EVENT-DRIVER-STATE HANGED
I/WifiHW ( 1016): reply:FAIL
I/WifiHW ( 1016):
I/WifiHW ( 1016): returning nread
V/WifiMonitor( 1016): Event [CTRL-EVENT-DRIVER-STATE HANGED]
I/WifiHW ( 1016): wifi_command called, cmd:BLACKLIST clear
I/WifiHW ( 1016): wifi_send_command, cmd = BLACKLIST clear
D/wpa_supplicant( 1484): CTRL_IFACE: bssid=' clear'
D/wpa_supplicant( 1484): Setting scan request: 0 sec 0 usec
D/wpa_supplicant( 1484): No enabled networks - do not scan
D/wpa_supplicant( 1484): State: INACTIVE -> INACTIVE
I/wpa_supplicant( 1484): CTRL-EVENT-STATE-CHANGE id=-1 state=1
I/WifiHW ( 1016): returning reply for cmd BLACKLIST clear
I/WifiHW ( 1016): wifi_command called, cmd:BLACKLIST clear
I/WifiHW ( 1016): wifi_send_command, cmd = BLACKLIST clear
D/wpa_supplicant( 1484): wpa_driver_priv_driver_cmd BTCOEXSCAN-STOP
len = 4096
E/wpa_supplicant( 1484): wpa_driver_priv_driver_cmd failed
I/WifiHW ( 1016): reply:FAIL
I/WifiHW ( 1016):
E/WifiStateTracker( 1016): Wifi Driver reports HUNG - reloading.
I/WifiHW ( 1016): wifi_stop_supplicant called
D/WifiStateTracker( 1016): Reset connections and stopping DHCP
V/WifiStateTracker( 1016): Changing supplicant state: INACTIVE ==>
INACTIVE
D/wpa_supplicant( 1484): RTM_NEWLINK: operstate=0 ifi_flags=0x1002 ()
D/wpa_supplicant( 1484): RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0'
added
I/WifiHW ( 1016): rmmod
E/WifiHW ( 1016): Unable to unload driver module "rt73usb": No such
file or directory
E/WifiService( 1016): Failed to unload Wi-Fi driver.


Minicom:

phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 0 - CWmin: 3,
CWmax: 4, A.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 1 - CWmin: 4,
CWmax: 5, A.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 2 - CWmin: 5,
CWmax: 10, .
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 3 - CWmin: 5,
CWmax: 10, .

On Mar 15, 10:52 am, BiX <bixt...@gmail.com> wrote:
> > comment this out from wifi.c
>
> My wifi.c was modified to followhttp://projectkennel.com/wiki/diffs/wifi.html
Reply all
Reply to author
Forward
0 new messages