Can this be helpful for wifi isues? - XPERIA X10 Q&A, Help & Troubleshooting

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

Related

working OpenVpn Galaxy S WI-FI G70

model number yp-G70CB
firmware 2.3.5
kernel version 2.6.35.7-G70XWKP2-CL580645
[email protected] #2
after 10h testing and reading manuals....
i present you openvpn startup script:
(requiements : root, busybox v1.19.3-stericson, optional Script Manager ads)
VPN.sh
------------------------------------------------------------
su -c "PATH=/system/xbin:$PATH" - # path for ifconfig
su -c "mkdir /dev/net" - # fixing tunctl problems
su -c "ln -s /dev/tun /dev/net/tun" - # linking tunctl for new location
su -c "tunctl" - # create tap0 device
su -c "ifconfig tap0 192.168.1.222" - # set manual IP for tap0 device
su -c "openvpn /sdcard/openvpn/config/FlamcoNet.ovpn" - # openvpn config
------------------------------------------------------------
only problem is DHCP
for unkown reason openvpn does not assing IP address to tap0
if someone know anythink about this please write me on this post
enjoy OpenVpn on you samsung
Thanks for this.
What problems with the lack of DHCP cause?
if you dont set manual IP for tap0 device
then tap0 device doesnt have ip address
it looks like that DHCP doesn't assing ip for it
but i have many computers on VPN and on everyone is working correctly
if you like i can post you logs from tab and vpn server / client
Probably failing due to lack of tunnelling support in the kernel - it's rare for a stock kernel to support it.
Entropy512 said:
Probably failing due to lack of tunnelling support in the kernel - it's rare for a stock kernel to support it.
Click to expand...
Click to collapse
Looking at the defconfigs, it seems that tunneling support is enabled in stock kernel.
rumirand said:
Looking at the defconfigs, it seems that tunneling support is enabled in stock kernel.
Click to expand...
Click to collapse
It isn't in venturi_usa_defconfig...

[Q] My code doesn't run in init.rc

how can I solve that problem?
I write the code in init.rc:
Code:
mv /com.anddoes.launcher_preferences.xml /data/data/com.anddoes.launcher/shared_prefs/
it returns such error:
<3>[ 0.640121] init: /init.rc: 351: invalid command 'mv'​
I tried both to write a script and to move toolbox with mv to the system root, but it returns the same error.
All the necessary folders exist
MaxiManBW said:
how can I solve that problem?
I write the code in init.rc:
Code:
mv /com.anddoes.launcher_preferences.xml /data/data/com.anddoes.launcher/shared_prefs/
it returns such error:
<3>[ 0.640121] init: /init.rc: 351: invalid command 'mv'​
I tried both to write a script and to move toolbox with mv to the system root, but it returns the same error.
All the necessary folders exist
Click to expand...
Click to collapse
init.rc is not a shell script, but a command language for the init process. Use can use the "exec" command to execute the mv command, see the docs below. Remember to use full paths.
Code:
Android Init Language
---------------------
The Android Init Language consists of four broad classes of statements,
which are Actions, Commands, Services, and Options.
All of these are line-oriented, consisting of tokens separated by
whitespace. The c-style backslash escapes may be used to insert
whitespace into a token. Double quotes may also be used to prevent
whitespace from breaking text into multiple tokens. The backslash,
when it is the last character on a line, may be used for line-folding.
Lines which start with a # (leading whitespace allowed) are comments.
Actions and Services implicitly declare a new section. All commands
or options belong to the section most recently declared. Commands
or options before the first section are ignored.
Actions and Services have unique names. If a second Action or Service
is declared with the same name as an existing one, it is ignored as
an error. (??? should we override instead)
Actions
-------
Actions are named sequences of commands. Actions have a trigger which
is used to determine when the action should occur. When an event
occurs which matches an action's trigger, that action is added to
the tail of a to-be-executed queue (unless it is already on the
queue).
Each action in the queue is dequeued in sequence and each command in
that action is executed in sequence. Init handles other activities
(device creation/destruction, property setting, process restarting)
"between" the execution of the commands in activities.
Actions take the form of:
on <trigger>
<command>
<command>
<command>
Services
--------
Services are programs which init launches and (optionally) restarts
when they exit. Services take the form of:
service <name> <pathname> [ <argument> ]*
<option>
<option>
...
Options
-------
Options are modifiers to services. They affect how and when init
runs the service.
critical
This is a device-critical service. If it exits more than four times in
four minutes, the device will reboot into recovery mode.
disabled
This service will not automatically start with its class.
It must be explicitly started by name.
setenv <name> <value>
Set the environment variable <name> to <value> in the launched process.
socket <name> <type> <perm> [ <user> [ <group> ] ]
Create a unix domain socket named /dev/socket/<name> and pass
its fd to the launched process. <type> must be "dgram", "stream" or "seqpacket".
User and group default to 0.
user <username>
Change to username before exec'ing this service.
Currently defaults to root. (??? probably should default to nobody)
Currently, if your process requires linux capabilities then you cannot use
this command. You must instead request the capabilities in-process while
still root, and then drop to your desired uid.
group <groupname> [ <groupname> ]*
Change to groupname before exec'ing this service. Additional
groupnames beyond the (required) first one are used to set the
supplemental groups of the process (via setgroups()).
Currently defaults to root. (??? probably should default to nobody)
oneshot
Do not restart the service when it exits.
class <name>
Specify a class name for the service. All services in a
named class may be started or stopped together. A service
is in the class "default" if one is not specified via the
class option.
onrestart
Execute a Command (see below) when service restarts.
Triggers
--------
Triggers are strings which can be used to match certain kinds
of events and used to cause an action to occur.
boot
This is the first trigger that will occur when init starts
(after /init.conf is loaded)
<name>=<value>
Triggers of this form occur when the property <name> is set
to the specific value <value>.
device-added-<path>
device-removed-<path>
Triggers of these forms occur when a device node is added
or removed.
service-exited-<name>
Triggers of this form occur when the specified service exits.
Commands
--------
exec <path> [ <argument> ]*
Fork and execute a program (<path>). This will block until
the program completes execution. It is best to avoid exec
as unlike the builtin commands, it runs the risk of getting
init "stuck". (??? maybe there should be a timeout?)
export <name> <value>
Set the environment variable <name> equal to <value> in the
global environment (which will be inherited by all processes
started after this command is executed)
ifup <interface>
Bring the network interface <interface> online.
import <filename>
Parse an init config file, extending the current configuration.
hostname <name>
Set the host name.
chdir <directory>
Change working directory.
chmod <octal-mode> <path>
Change file access permissions.
chown <owner> <group> <path>
Change file owner and group.
chroot <directory>
Change process root directory.
class_start <serviceclass>
Start all services of the specified class if they are
not already running.
class_stop <serviceclass>
Stop all services of the specified class if they are
currently running.
domainname <name>
Set the domain name.
insmod <path>
Install the module at <path>
mkdir <path> [mode] [owner] [group]
Create a directory at <path>, optionally with the given mode, owner, and
group. If not provided, the directory is created with permissions 755 and
owned by the root user and root group.
mount <type> <device> <dir> [ <mountoption> ]*
Attempt to mount the named device at the directory <dir>
<device> may be of the form [email protected] to specify a mtd block
device by name.
<mountoption>s include "ro", "rw", "remount", "noatime", ...
setkey
TBD
setprop <name> <value>
Set system property <name> to <value>.
setrlimit <resource> <cur> <max>
Set the rlimit for a resource.
start <service>
Start a service running if it is not already running.
stop <service>
Stop a service from running if it is currently running.
symlink <target> <path>
Create a symbolic link at <path> with the value <target>
sysclktz <mins_west_of_gmt>
Set the system clock base (0 if system clock ticks in GMT)
trigger <event>
Trigger an event. Used to queue an action from another
action.
write <path> <string> [ <string> ]*
Open the file at <path> and write one or more strings
to it with write(2)
Properties
----------
Init updates some system properties to provide some insight into
what it's doing:
init.action
Equal to the name of the action currently being executed or "" if none
init.command
Equal to the command being executed or "" if none.
init.svc.<name>
State of a named service ("stopped", "running", "restarting")
Example init.conf
-----------------
# not complete -- just providing some examples of usage
#
on boot
export PATH /sbin:/system/sbin:/system/bin
export LD_LIBRARY_PATH /system/lib
mkdir /dev
mkdir /proc
mkdir /sys
mount tmpfs tmpfs /dev
mkdir /dev/pts
mkdir /dev/socket
mount devpts devpts /dev/pts
mount proc proc /proc
mount sysfs sysfs /sys
write /proc/cpu/alignment 4
ifup lo
hostname localhost
domainname localhost
mount yaffs2 [email protected] /system
mount yaffs2 [email protected] /data
import /system/etc/init.conf
class_start default
service adbd /sbin/adbd
user adb
group adb
service usbd /system/bin/usbd -r
user usbd
group usbd
socket usbd 666
service zygote /system/bin/app_process -Xzygote /system/bin --zygote
socket zygote 666
service runtime /system/bin/runtime
user system
group system
on device-added-/dev/compass
start akmd
on device-removed-/dev/compass
stop akmd
service akmd /sbin/akmd
disabled
user akmd
group akmd
Debugging notes
---------------
By default, programs executed by init will drop stdout and stderr into
/dev/null. To help with debugging, you can execute your program via the
Andoird program logwrapper. This will redirect stdout/stderr into the
Android logging system (accessed via logcat).
For example
service akmd /system/bin/logwrapper /sbin/akmd
kuisma said:
init.rc is not a shell script, but a command language for the init process. Use can use the "exec" command to execute the mv command, see the docs below. Remember to use full paths.
Code:
Android Init Language
---------------------
The Android Init Language consists of four broad classes of statements,
which are Actions, Commands, Services, and Options.
All of these are line-oriented, consisting of tokens separated by
whitespace. The c-style backslash escapes may be used to insert
...........................................
Click to expand...
Click to collapse
I created script and put it to /system folder
Then call it with:
Code:
service my_script /system/my_script.sh
class main
oneshot
and again received an error: <3>[ 61.921627] init: cannot find '/system/my_script.sh', disabling 'my_script'
MaxiManBW said:
I created script and put it to /system folder
Then call it with:
Code:
service my_script /system/my_script.sh
class main
oneshot
and again received an error: <3>[ 61.921627] init: cannot find '/system/my_script.sh', disabling 'my_script'
Click to expand...
Click to collapse
Is you script executable and begins with the line "#!/system/bin/sh"?
kuisma said:
Is you script executable and begins with the line "#!/system/bin/sh"?
Click to expand...
Click to collapse
Yes!
just in case, I used chmod 777 and first line begins with the line "#!/system/bin/sh".
Error no longer appears, but script doesn't work:
Code:
#!/system/bin/sh
if [-a /com.anddoes.launcher_preferences.xml]
cp /com.anddoes.launcher_preferences.xml /data/data/com.anddoes.launcher/shared_prefs/
rm /com.anddoes.launcher_preferences.xml
fi
I may be wrong calling service?
Code:
service my_script /system/my_script.sh
class main
oneshot
MaxiManBW said:
Yes!
just in case, I used chmod 777 and first line begins with the line "#!/system/bin/sh".
Error no longer appears, but script doesn't work:
Code:
#!/system/bin/sh
if [-a /com.anddoes.launcher_preferences.xml]
cp /com.anddoes.launcher_preferences.xml /data/data/com.anddoes.launcher/shared_prefs/
rm /com.anddoes.launcher_preferences.xml
fi
I may be wrong calling service?
Code:
service my_script /system/my_script.sh
class main
oneshot
Click to expand...
Click to collapse
I guess cp works, but not rm? Root is remounted read-only quite early in init.rc
Edit: Also, I've told you to use full paths. And that if-syntax...? It's sure not standard shell test syntax.
MaxiManBW said:
how can I solve that problem?
I write the code in init.rc:
Code:
mv /com.anddoes.launcher_preferences.xml /data/data/com.anddoes.launcher/shared_prefs/
it returns such error:
<3>[ 0.640121] init: /init.rc: 351: invalid command 'mv'​
I tried both to write a script and to move toolbox with mv to the system root, but it returns the same error.
All the necessary folders exist
Click to expand...
Click to collapse
Did it work?
I think init.rc only understands absolute paths... I mean, replacing mv with the below might work.
/system/bin/mv XXX YYY
-pradeep.
---------- Post added at 03:41 PM ---------- Previous post was at 03:16 PM ----------
kuisma said:
I guess cp works, but not rm? Root is remounted read-only quite early in init.rc
Edit: Also, I've told you to use full paths. And that if-syntax...? It's sure not standard shell test syntax.
Click to expand...
Click to collapse
I have a similar question regarding init.rc.
I am trying to run a native application (which downloads the wifi firmware to dongle). I need this to be done before the wifi driver module is insmod'ed. Accordingly, I have an entry in init.rc with 'exec' command to run it -- at the end of "on init" section.
exec /system/bin/downloader -n /system/etc/wifi/xyz.nvm /system/etc/wifi/fake.trx
This command doesn't seem to run although I don't see any errors in the boot log.
I also tried a combination of 'service' commands like:
service downloader /system/bin/downloader -n /system/etc/wifi/xyz.nvm /system/etc/wifi/fake.trx
disabled
oneshot
Same result: no error in the bootlog but firmware not downloaded.
Any idea what might be wrong with the commands here? I am on JB-MR1.
-pradeep.
Gurumath said:
Did it work?
I think init.rc only understands absolute paths... I mean, replacing mv with the below might work.
/system/bin/mv XXX YYY
-pradeep.
---------- Post added at 03:41 PM ---------- Previous post was at 03:16 PM ----------
I have a similar question regarding init.rc.
I am trying to run a native application (which downloads the wifi firmware to dongle). I need this to be done before the wifi driver module is insmod'ed. Accordingly, I have an entry in init.rc with 'exec' command to run it -- at the end of "on init" section.
exec /system/bin/downloader -n /system/etc/wifi/xyz.nvm /system/etc/wifi/fake.trx
This command doesn't seem to run although I don't see any errors in the boot log.
I also tried a combination of 'service' commands like:
service downloader /system/bin/downloader -n /system/etc/wifi/xyz.nvm /system/etc/wifi/fake.trx
disabled
oneshot
Same result: no error in the bootlog but firmware not downloaded.
Any idea what might be wrong with the commands here? I am on JB-MR1.
-pradeep.
Click to expand...
Click to collapse
So here is the thing I read somewhere that exec are just added for show and they don't actually work
I am not entirely sure of the above statement, but what I am sure of is that you can write a script and add it to the init.rc to get your work done
---------- Post added at 10:26 AM ---------- Previous post was at 10:16 AM ----------
kuisma said:
I guess cp works, but not rm? Root is remounted read-only quite early in init.rc
Edit: Also, I've told you to use full paths. And that if-syntax...? It's sure not standard shell test syntax.
Click to expand...
Click to collapse
It is not about the wrong service being called.
It is the fact that the service has been defined but you need to call the service at some instant by adding the command
'start yourServiceName'
That is if you want to start your service at boot time, you will need to add the following lines
on property:sys.boot_completed=1
start my_script
Here is a full version of a script that I wrote, this was to toggle wifi at regular interval of time
My Shell Script - init.custom.sh
#!/system/bin/sh
while true; do
svc wifi disable
sleep 10
svc wifi enable
sleep 60
done
My Code inside init.rc
service custom /system/bin/init.custom.sh
user root
oneshot
on property:sys.boot_completed=1
write /sys/block/mmcblk0/queue/scheduler cfq ## This was already present
start custom
I know this is a very late reply, but I started exploring these things recently.
Hope this helps someone.

USB WiFi OTG - wpa_supplicant / android issue

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

[HELP TO DEV] Quick start for Wi-Fi configuration

Quick start for Wi-Fi configuration*​After spend some days on CM11 Wi-Fi I want share with the community my new knowledge in order to simplify the life to who develop after me
For make it (very) simple, Wi-Fi envirorment in CM11 is structured in driver (make hardware exploitable) + Android system + wpa_supplicant (used by Android for communicate with driver).
In order to configure drivers is necessary modify BoardConfig.mk. It set the drivers and some related flag userfull for build CM system and wpa_supplicant. WARNING: Usually is not necessay specify any flags (e.g. XXXXX := true) because wpa_supplicant's Android.mk load all the correct configurations from android.config.
Before explain how to configure wpa_supplicant is needed introduce some concepts. For communicate wpa_supplicant and CM use sockets (is not importat that you know precisly what they are, you can image them as files). There are 2 kind of sockets in Andoid: Unix socket and Android private socket. At function level they are equivalent but your configuration must be coerent and use only one type.
In order to configure wpa_supplicant is necessary modify 2 files:
- init.xxxxx.rc: this file create the directory needed by wpa_supplicant and lunch it.
#Common socket dirs
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
#Android socket dirs
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
#Unix socket dirs
mkdir /data/system/wpa_supplicant 0771 wifi wifi
chmod 0771 /data/system/wpa_supplicant
chown wifi wifi /data/system/wpa_supplicant ​And then wpa_supplicant must be lunched like this:
#Android socket
service wpa_supplicant /system/bin/wpa_supplicant \
-iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
-e/data/misc/wifi/entropy.bin -ddd
class main
socket wpa_wlan0 dgram 660 wifi wifi #<- With this line you specify that is an Android socket, note the keyword "socket"
disabled
oneshot
#Unix socket
service wpa_supplicant /system/bin/wpa_supplicant \
-iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
disabled
oneshot ​
- wpa_supplicant.conf: this file give to wpa_supplicant the correct settings for run.
#(Minimum) Configuration for Android socket
ctrl_interface=wlan0 #<- With this line you specify that is an Android socket, note the relative path
update_config=1
#(Minimum) Configuration for Unix socket
ctrl_interface=DIR=/data/system/wpa_supplicant GROUP=wifi
update_config=1​
That is all. As usual if something not work use adb shell, adb logcat, google and your brain :good:.
*It is litte more than a copy/past of my thread here.
Reference:
- http://blog.linuxconsulting.ro/2010/04/porting-wifi-drivers-to-android.html
- http://processors.wiki.ti.com/index.php/TI-Android-JB-PortingGuide

[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