USB WiFi OTG - wpa_supplicant / android issue - Android Q&A, Help & Troubleshooting

Hello, I hope an advanced user can help me with this, I want to use my usb wireless card, so far I have successfully compiled the 3.0.36+ kernel modules for the card rt2800usb.ko + support modules and i can insmod them ..etc
insmod /system/lib/modules/rt2x00lib.ko
insmod /system/lib/modules/rt2x00usb.ko
insmod /system/lib/modules/rt2800lib.ko
insmod /system/lib/modules/rt2800usb.ko
Here is my issue
I made a copy of wpa_supplicant.conf in /data/misc/wifi/ to wlan1_supplicant.conf then run
/system/bin/wpa_supplicant -B -iwlan1 -c/data/misc/wifi/wlan1_supplicant.conf -dd &
(also tried rtl_supplicant, both seem to work the same)
then
dhcpcd wlan1
(made sure the internal wifi is offline)
it connects to my access point fine and I can browse the internet, youtube (videos), remote desktop apps work but the problem is I can't download any files with the web browsers (tried chrome, boat broswer, dolphin) or download off Google play it just says "waiting for network.", I'm guessing all these programs hook into download manger or something and perhaps that's the issue.
I'm thinking its a socket problem the default wpa_supplicant.conf has wlan0 as the ctrl_interface, in wlan1_supplicant.conf I changed it to /data/misc/wifi/sockets (as well as trying other things like wlan1 ..etc) I just cant figure this out for the life of me,
I am using android 4.2.2 , pipo s1 tablet
using ps aux on the default connection android runs the normal wireless like this...
4931 1010 0:00 /system/bin/rtl_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
4941 1014 0:00 /system/bin/dhcpcd -ABKL -f /system/etc/dhcpcd/dhcpcd.conf -h android-<randomnumber> wlan0

Related

How to install OpenVPN on GT 10.1

Hi everyone,
I tried to gather some information to install OpenVPN on the Galaxy Tab 10.1, but could not complete the install.
I already installed successfully OpenVPN Installer, BusyBox Installer, OpenVPN Settings, copied tun.ko to modules folder (/system/lib/modules).
I ran those commands (first had read only errors but eventually succeeded with adb console) :
insmod /modules/tun.ko
ln -s /system/bin/busybox/system/xbins/bb/ route
ln -s /system/bin/busybox/system/xbins/bb/ ifconfig
Then, when i launch OpenVPN Settings, it starts connecting but finally says "FATAL: Linux ifconfig failed, could not start external program".
Anybody could tell me how to do it properly? Is it even possible on the Galaxy Tab 10.1?
Many thanks!!!
I'm about to try it right now, I have ovpn running on my galaxy s, just going to create certificates for my tablet, and copy the config across and see if it works.
I believe the default kernel includes tun support.. or so I have been told.. will find out I guess.
Thanks! Keep me updated please.
Anyone able to make progress on getting openvpn working?
Hi. I just wanted to add that if anyone have any more info on openvpn and tun.ko for the gt-7100 that i too would be greatful.
Vissie
I have openvpn working. I installed busybox installer, openvpn and openvpn settings from the market place.
I Used root explorer and made the directory /system/xbin/bb. I also used root explorer to make this directory read/write. Then I used a terminal app to do
Su
ln -s /system/xbin/route /system/xbin/bb/route
ln -s /system/xbin/ifconfig /system/xbin/bb/ifconfig
after this make the directory read only. In openvpn settings point tun.ko path to
/data/media/openvpn/openvpn/tun.ko
add your config and that should do it
i still can't connect
Well when i comment
iproute /data/local/bin/iproute-wrapper.sh
Click to expand...
Click to collapse
openvpn connects but i cant browse my local lan
when i uncomment this line nothing happens when i try to connect
what did i missed?
one more question - im using ccd folders with different push commands on my vpn server - this doesnt seem to work aswell.
Anyone could post stepby step iproute configuration for our devices?
thanks
Wojtek
I've been trying again and again.
I always get "FATAL: Linux ifconfig failed, could not start external program".
Anyone could post a complete tutorial ?
Thanks.
I did it!!!
I installed OpenVPN Installer, BusyBox Installer, OpenVPN Settings, copied tun.ko to modules folder (/system/lib/modules), then copied the configuration files of my VPN (ca.crt and client.ovpn) to /sdcard/openvpn.
I ran those commands with adb tools :
mount -o remount,rw /system
insmod /modules/tun.ko
mkdir /system/xbin/bb
ln -s /system/xbin/busybox /system/xbin/bb/ifconfig
ln -s /system/xbin/busybox /system/xbin/bb/route
In the advanced settings of OpenVPN Settings, the path to tun module is "/system/lib/modules/tu", the path to configurations is "/sdcard/openvpn" and the path to openvpn binary is "/system/xbin/openvpn".
Then i launched OpenVPN Settings, entered the username and password and it connected.
I hope it can help...
Which kernel are you using -- stock or ??
I'm running the stock kernel.
can you please tell me......
armavista said:
I installed OpenVPN Installer, BusyBox Installer, OpenVPN Settings, copied tun.ko to modules folder (/system/lib/modules), then copied the configuration files of my VPN (ca.crt and client.ovpn) to /sdcard/openvpn.
I ran those commands with adb tools :
mount -o remount,rw /system
insmod /modules/tun.ko
mkdir /system/xbin/bb
ln -s /system/xbin/busybox /system/xbin/bb/ifconfig
ln -s /system/xbin/busybox /system/xbin/bb/route
In the advanced settings of OpenVPN Settings, the path to tun module is "/system/lib/modules/tu", the path to configurations is "/sdcard/openvpn" and the path to openvpn binary is "/system/xbin/openvpn".
Then i launched OpenVPN Settings, entered the username and password and it connected.
I hope it can help...
Click to expand...
Click to collapse
You said you run stock kernel, but what rom are you on: kmb, kme?
Also, can you please point me to the tun.ko file or a pointer of where I can get it.(the one that you have working)
Much thanks.
The version of my kernel is [email protected] #1.
ROM : HMJ37.UEKF3 P7510UEKF3
I attached the tun.ko file i used for you.
Keep me updated...
I managed to make openvpn work.
I am using openvpn setting software.
For galaxy tab 10.1, the openvpn binary and the associated lib liblzo.so is missing, so you just need to copy those two files from , say cm7 sources.
Simply download the attachment and extract it, there are two files:
openvpn : copy it to /system/xbin/openvpn ( don't forget chmod 755 to it )
liblzo.so: copy it to /system/lib/liblzo.so ( don't forget chmod 644 to it )
I have tested it on my galaxy tab 10.1 P7510, works great.
Hoping this would help.
Sorry to mention, i am using starburst kernel which already have tun support in the kernel.
For stock kernel, maybe you need to have matched tun.ko copied from elsewhere.
I get this message
[email protected]:/ # insmod /modules/tun.ko
insmod: can't open '/modules/tun.ko
I pushed tun.ko to /system/lib/modules via adb , though I cant see it with root explorer
If it's there tou should be able to see it with root explorer
I run GT-P7500, Kernel 2.6.36.3, [email protected] #1, buildnr HMJ37 P7500XXWKG9, baseband XXKG7, ).
I have seen statements that there is no tun.ko in the kernel and the available versions of tun.ko do not work with the 3.1 Honeycomb kernel, I have.
I do not have a folder called modules under /system/lib, shall I create one.
The directory modules I have is /lib/modules/...
insmode did not work.
I run openvpn from the shell and it stops after establishing the TCP connection, this is just before establishing the tun...clearly I am still missing the tun.
Does anyone else experienced same problem or have a solution?
Hi I'm having a nightmare trying to get openvpn installed.
When I do the insmod /modules/tun.ko i get
the following
[email protected]:/ # insmod /modules/tun.ko
insmod: can't open '/modules/tun.ko'
255|[email protected]:/ #
any idea what I'm doing wrong
Hey everybody.
I also have some problem with openvpn connection.
At first i turn on openvpn the start the configuration (at the same time i started a ping on my server: ping 300.300.300.300 -t)
After that my ping works for 12 - 14 times. After the 12 + 14 times then it shows "out of time" error message.
What have i done wrong? (Every 5 seconds at the bottom of my tab it shows "myvpn.openvpn: Connected"
Preferences:
Samsung Galaxy Tab 10.1 Rooted
Android 3.1
Newest Busybox
Done everything from the tutorial of this topic
Update: When i turn the tun module on then the ping only works for about 9 times.
After about 20 failed pings, the pink works again for the amount i wrote.

Can this be helpful for wifi isues?

Hello everyone, i was looking on the net for things about wifi etc. And found this wall of text about wifi. I just copied the text. Maybe its helpfull for the devs i saw some things which my int.rc dont have etc. Here it is.
0. Understand how Android WiFi works. 1. Enable building of wpa_supplicant in your BoardConfig.mk 2. (Optional) Enable debug for wpa_supplicant. 3. Provide a proper wpa_supplicant.conf for your device 4. Have the correct paths and permissions created from init.rc 5. Make sure your wpa_supplicant and dhcpcd (optional) are starting from init.rc 6. Provide your driver either as a module or built in kernel and proper kernel support for it and modify Android source code accordingly. 7. Provide a firmware if your module needs it. 8. Make your driver work with Android custom wpa_supplicant commands and SIOCSIWPRIV ioctl
Now onto details.
0. Understand how Android WiFi works. Android uses a modified wpa_supplicant ( external/wpa_supplicant ) daemon for wifi support which is controlled through a socket by hardware/libhardware_legacy/wifi/wifi.c (WiFiHW) that gets controlled from Android UI through android.net.wifi package from frameworks/base/wifi/java/android/net/wifi/ and it's corresponding jni implementation in frameworks/base/core/jni/android_net_wifi_Wifi.cpp Higher level network management is done in frameworks/base/core/java/android/net
1. Enable building of wpa_supplicant in your BoardConfig.mk This is by simply adding: BOARD_WPA_SUPPLICANT_DRIVER := WEXT to your BoardConfig.mk . This will set WPA_BUILD_SUPPLICANT to true in external/wpa_supplicant/Android.mk enabling building of driver_wext.c If you have a custom wpa_supplicant driver (like madwifi or my custom android private commands emulation - see last paragraph) you can replace WEXT with AWEXT or your driver name (MADWIFI, PRISM etc).
2. (Optional) Enable debug for wpa_supplicant. By default wpa_supplicant is set to MSG_INFO that doesn't tell much. To enable more messages: 2.1 modify common.c and set wpa_debug_level = MSG_DEBUG 2.2 modify common.h and change #define wpa_printf from if ((level) >= MSG_INFO) to if ((level) >= MSG_DEBUG)
3. Provide a proper wpa_supplicant.conf for your device Providing a wpa_supplicant.conf it's important because the control socket for android is specified in this file (ctrl_interface= ). This file should be copied by your AndroidBoard.mk to $(TARGET_OUT_ETC)/wifi (usually /system/etc/wifi/wpa_supplicant.conf ). This location will be used on wpa_supplicant service from init.rc. There are two different ways in which wpa_supplicant can be configured, one is to use a "private" socket in android namespace, created by socket_local_client_connect() function in wpa_ctrl.c and another is by using a standard unix socket.
Minimum required config options in wpa_supplicant.conf : - Android private socket
ctrl_interface=wlan0 update_config=1
- Unix standard socket
ctrl_interface=DIR=/data/system/wpa_supplicant GROUP=wifi update_config=1
Depending on your driver you might also want to add: ap_scan=1
If you have AP association problems with should change to ap_scan=0 to let the driver do the association instead of wpa_supplicant. If you want to let wpa_supplicant connect to non-WPA or open wireless networks (by default it skips these kind) add:
network={ key_mgmt=NONE }
4. Have the correct permissions and paths created from init.rc Incorrect permisions will result in wpa_supplicant not being able to create/open the control socket and libhardware_legacy/wifi/wifi.c won't connect. Since Google modified wpa_supplicant to run as wifi user/group the directory structure and file ownership should belong to wifi user/group (see os_program_init() function in wpa_supplicant/os_unix.c ).
Otherwise errors like: E/WifiHW ( ): Unable to open connection to supplicant on "/data/system/wpa_supplicant/wlan0": No such file or directory will appear.
Also wpa_supplicant.conf should belong to wifi user/group because wpa_supplicant will want to modify this file. If your system has /system as read-only use a location like /data/misc/wifi/wpa_supplicant.conf and modify wpa_supplicant service in init.rc with new location. Make sure the paths are correctly created in 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 (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
If you use a Unix standard socket in wpa_supplicant.conf (see above) add:
# wpa_supplicant socket (unix socket mode) mkdir /data/system/wpa_supplicant 0771 wifi wifi chmod 0771 /data/system/wpa_supplicant chown wifi wifi /data/system/wpa_supplicant
Do not add these if you use Android private socket because it will make wpa_supplicant non-functional, because hardware/libhardware_legacy/wifi/wifi.c check for existence of the /data/system/wpa_supplicant folder and will pass a wrong interface name to wpa_ctrl_open() function.
5. Make sure your wpa_supplicant and dhcpcd are starting from init.rc
For wpa_supplicant the init.rc startup like should be depending on which path you chosen: - Android private socket:
service wpa_supplicant /system/bin/wpa_supplicant -dd -Dwext -iwlan0 -c /system/etc/wifi/wpa_supplicant.conf socket wpa_wlan0 dgram 660 wifi wifi group system wifi inet disabled oneshot
- Unix standard socket:
service wpa_supplicant /system/bin/wpa_supplicant -dd -Dwext -iwlan0 -c /system/etc/wifi/wpa_supplicant.conf group system wifi inet disabled oneshot
If your wifi driver creates a wifi interface with other name than wlan0 you will have to modify the above line accordingly. You also should have dhcpcd starting from init.rc
service dhcpcd /system/bin/dhcpcd wlan0 group system dhcp disabled oneshot
Newer AOSP versions after Gingerbread use dhcpcd_wlan0 as service name.
6. Provide your driver either as a module or built in kernel and proper kernel support for it. First make sure that CONFIG_PACKET and CONFIG_NET_RADIO (wireless extensions) are enabled in your kernel. The driver can be built as module (default android way) or built in kernel (if you want to rely in kernel auto probing to support multiple driver eg. USB wifi) but will require source code modifications (see below). - As kernel module: Define in your BoardConfig.mk : 1. WIFI_DRIVER_MODULE_PATH := path to the module to be loaded You need to specify module name in that path too, usually should look something like /system/lib/modules/wlan.ko 2. WIFI_DRIVER_MODULE_NAME:= the name of the network interface that the driver creates, for example wlan0 3. WIFI_DRIVER_MODULE_ARG:= any arguments that you want to pass to the driver on insmod, for example nohwcrypt
Make sure you copy your kernel module when building android to the correct location. - As built in kernel: - First init.rc needs to be modified to inform hardware/libhardware_legacy/wifi/wifi.c about the name of the interface, that the driver is already loaded and set the status of wpa_supplicant to running:
setprop wifi.interface "wlan0" setprop wlan.driver.status "ok"
Do NOT add setprop init.svc.wpa_supplicant "running" as I previously mentioned as it will prevent wpa_supplicant from starting from init. - Secondly hardware/libhardware_legacy/wifi/wifi.c need to be modified so the functions insmod() and rmmod() return 0 (simply add return 0; as the first line in functions since they are not needed when driver is built in kernel) and return before checking for /proc/modules in check_driver_loaded() function. You might encounter problems with WifiHW module not being able to connect to wpa_supplicant socket even with the correct permisions. Try to turn off / turn on Wifi from the GUI.
7. Provide a firmware if your driver needs it
If your driver needs a firmware you will have to copy this firmware file to /etc/firmware on your android build. Android doesn't use a standard hotplug binary (although there is an implementation available on android-x86 system/code/toolbox/hotplug.c ) instead the init process takes care of firmware events and loads the firmware file from /etc/firmware (see: system/core/init/devices.c handle_firmware_event() function). Firmware file name is defined by the driver and might also contain a folder like: RTL8192SU/rtl8192sfw.bin, entire file path should be available in /etc/firmware
8. Make your driver work with Android custom wpa_supplicant commands and SIOCSIWPRIV ioctl.
Android uses SIOCSIWPRIV ioctl to send commands to modify driver behaviour and receive information like signal strength, mac address of the AP, link speed etc. This ioctl is usually not implemented in any known wireless drivers except bcm4329 which is in google msm kernel branch . The errors from not having this ioctl implemented will look like: E/wpa_supplicant( ): wpa_driver_priv_driver_cmd failed wpa_driver_priv_driver_cmd RSSI len = 4096 E/wpa_supplicant( ): wpa_driver_priv_driver_cmd failed D/wpa_supplicant( ): wpa_driver_priv_driver_cmd LINKSPEED len = 4096 E/wpa_supplicant( ): wpa_driver_priv_driver_cmd failed I/wpa_supplicant( ): CTRL-EVENT-DRIVER-STATE HANGED
After 4, WEXT_NUMBER_SEQUENTIAL_ERRORS errors, android will abort using the device.
To quickly test your wifi from interface you can disable error checking in external/wpa_supplicant/driver_wext.c by simply making ret = 0; in wpa_driver_priv_driver_cmd() function after the SIOCSIWPRIV ioctl call. This will make all access points in android UI appear without signal or MAC address. To proper implement the ioctl you will need to modify your kernel driver to reply to SIOCSIWPRIV ioctl with RSSI (signal strength) and MACADDR commands being the most important. A better way is to add a custom driver_xxx.c to google external/wpa_supplicant/ implementing wpa_driver_priv_driver_cmd() function that will take care of RSSI, MACADDR and others, through calls to SIOCGIWSTATS, SIOCGIFHWADDR ioctls, with the rest of the functions being called from driver_wext.c.
I hope that this post is usefull to anyone. Greets Danny
Sent from my Xperia X10 using xda app-developers app

Reverse Tether

I currently run Paranoid Android on my SG5, which works well enough for my tastes. One thing I've wanted to play with is reverse tethering. Since I charge my player via the computer's usb connection, I figured it'd make sense to disable wifi and save a little power to speed up the slow usb charging and just use the pc's internet connection via usb. I also have a few apps like calibre and the compantion app which don't work correctly when I'm on a wifi connection that's been firewalled to prevent devices from communicating with each other. This bypasses the wifi connection and gives me a nice secure connection between devices.
I got it working ... mostly. I don't expect many people to find this useful, but I thought it might be an entertaining hack to poke at.
The following script sits on my linux netbooks' ~/bin directory as reverse-tether.sh
Code:
#!/bin/sh
# We need root on the host to mess with networking
if [[ $(whoami) != "root" ]]; then
echo "You must be root to run this script!"
exit 1
fi;
# We need root on the Player to mess with networking
echo 'Enabling adb root access...'
adb -d root
# Turn on usb networking
echo 'Enabling usb network interface on the Galaxy Player...'
adb -d shell 'sh /storage/sdcard0/reverse_tether.sh up &'
# adb disconnects, so we wait for the network on the player to settle before continuing on.
sleep 2
# Rename device interface as ArchLinux has annoying device names (becomes player)
IF=`ifconfig -a | grep "enp" | cut -d ':' -f 1`
ip link set dev $IF down
/usr/sbin/ifrename -i $IF -n player
ip link set dev player up
echo 'Setting Computer IP Address ...'
ifconfig player 192.168.200.1 netmask 255.255.255.0
ifconfig player up
echo 'Enabling NAT and IP Forwarding on Computer...'
# Start forwarding and nat (use existing default gw)
iptables -F -t nat
iptables -A POSTROUTING -t nat -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 'Starting dnsmasq on Computer...'
dnsmasq --interface=player --no-dhcp-interface=player
echo
echo 'Connection is ready! Press any key to shutdown.'
echo
read
echo 'Shutting down reverse tethering'
# SSH server is always running on player, with public rsa key imported for passwordless logins
# This hackery is required as adb seems to be disabled with rndis active.
# I use dropbear server II, but any of the ssh servers would probably work.
ssh [email protected] 'sh /storage/sdcard0/reverse_tether.sh down &'
killall dnsmasq
ifconfig player down
iptables -F -t nat
echo 0 > /proc/sys/net/ipv4/ip_forward
And the following script is simply stashed on the sdcard of the player. as /storage/sdcard0/reverse_tether.sh
Code:
#!/system/bin/sh
if [ "$1" = "up" ]; then
echo 1 > /sys/class/usb_composite/rndis/enable
ip addr add 192.168.200.2/24 dev usb0
ip link set usb0 up
ip route delete default
ip route add default via 192.168.200.1
setprop net.dns1 192.168.200.1
fi
if [ "$1" = "down" ]; then
sleep 2
ip route delete default
ip link set usb0 down
echo 0 > /sys/class/usb_composite/rndis/enable
fi
When I finish, sometimes I need to restart wifi on the player to get networking to work again.
The only real problem I've had is that some apps require or want wifi/3g active in order to fully function. For example, the play store works fine until you try and download an actual update. Google Maps works fine, although you get lots of warnings about having wifi turned off. I have no idea how to "emulate" 3g or wifi which I think would solve that problem.
This was fun getting running. Hope you enjoyed...
I know this is an old thread but I found this really really useful. Going to give it a try after work today. Great job.
Sent from my YP-G70 using xda app-developers app

[Q] configuring wifi connection under recovery

hello i wonder if i can get some help
i am in recovery mode under my smartphone rooted with adb shell
i can mount android /system and /data
i am able to use linux located on external sd
(see my script http://jeanmichel.gens.free.fr/etc/install copied before in /system/bin )
i just want to activate the wifi connection
first i load module 80211 with insmod ok
when i run wpa_suplicant with my /data/misc/wifi/wpa_suplicant.conf -i wlan0 -Dnl80211 -c/data/misc/wifi/wpa_suplicant.conf
it tells that my wlan0 interface is not set
i wonder if i must run log/wapper ... dhcp before,
under android looks run after in the process numbers
how the wlanO is set ?

[Q] configuring wifi connection under recovery

hello i wonder if i can get some help
i am in recovery mode under my smartphone rooted with adb shell
i can mount android /system and /data
i am able to use linux located on external sd
(see my script http://jeanmichel.gens.free.fr/etc/install copied before in /system/bin )
i just want to activate the wifi connection
first i load module 80211 with insmod ok
when i run wpa_suplicant with my /data/misc/wifi/wpa_suplicant.conf -i wlan0 -Dnl80211 -c/data/misc/wifi/wpa_suplicant.conf
it tells that my wlan0 interface is not set
i wonder if i must run log/wapper ... dhcp before,
under android looks run after in the process numbers
how the wlanO is set ?

Categories

Resources