The Connection refused problem with transplantation of wifi - Samsung Galaxy Nexus

I write a android program to control wifi with java code.The app catch the necessary informations like 'ssid' or 'password',and send them to the 'wpa' to start the wifi network.There are some native methods to achieve functional,and the app call them with JNI.
At first,when calling the wifi_start_supplicant(in wifi.c) method there are some logs show " Cannot set RW to "/data/misc/wifi/wpa_supplicant.conf': Permission denied '.First I just give the wpa_supplicant.conf 777 permission,but the error was still happened.Then I all the folder on the Path 777 permission,the error disappeared after that.
But there's another error came: Failed to start supplicant daemon. No such file or directory.Then I search the source code of android 4.0.1.r1,and find that there's a code segment(in wifi.c):pi = __system_property_find(SUPP_PROP_NAME);and the SUPP_PROP_NAME is " init.svc.wpa_supplicant ".I found the init.svc.wpa_supplicant is a service,so I use the adb shell to set it "running" with command "setprop init.svc.wpa_supplicant 'running'"before I run the program.After this step the error was disappear.
But there's a new error came,logs show: Unable to open connection to supplicant on "/data/system/wpa_supplicant/wlan0": Connection refused.And I find some ways to solve this problem on the link:
blog.linuxconsulting.ro/2010/04/porting-wifi-drivers-to-android. html
I follow all the steps on this link,except so change about the wifi.c,because compiled the wifi.c will get a libhardware_legacy.so,and this so file will crash my phone while it push into /system/lib.
I try both android private socket and unix standard socket to connect to supplicant,but all I try just had a same result: Unable to open connection to supplicant on "/data/system/wpa_supplicant/wlan0": Connection refused
In this step I make sure the wap_supplicant and dhcpcd were starting from init.rc with the interface of wlan0,and setprop the wifi.interface as "wlan0".I had seen the file in /proc/net/dev,and I sure the wlan0 is mark on the file(dev).
Above is all my work and procedure with my transplantation of wifi,the problem of"Unable to open connection to supplicant .... Connection refused " is still confused me,is there some ways can solve that?
Thanks a lot anyway!

Any updates
Hi, were you able to find the cause of this problem. I am facing the similar issue now.
Thanks

Related

Connect an HTC desire to an ad-hoc network

Ok, i found this tutorial.
ott.net/knowledge/htc-desire-adhoc/
Installed apk and trying to terminal adb shell command and getting error
abd: not found
what is wrong?
this terminal i runned from phone not from pc..
You have to run adb from pc. A guide for installing it can be found in my signature.
TouchPaled from Oxygen with Transparent XDA App
I started adb shell and when enter:
insmod /system/lib/modules/bcm4329.ko
I have this error:
insmod: init_module '/system/lib/modules/bcm4329.ko' failed (Operation not permitted)
atlantisu21 said:
I started adb shell and when enter:
insmod /system/lib/modules/bcm4329.ko
I have this error:
insmod: init_module '/system/lib/modules/bcm4329.ko' failed (Operation not permitted)
Click to expand...
Click to collapse
I have spent some time yesterday trying the exact same thing, I didn't succeed.
For your question:
Try using the command "su" before starting insmod.
Also remember to assign execute permissions to iwconfig, else it will not work either!
I probably did something wrong (or it just doesn't work on my ROM (I'm on redux2)) because i couldnt get it to work.
Also the app ad-hoc (follow the links on his page i think) fails for me. Wifi will go to error state and only reboot makes it work again.
If you succeed please tell us how you did it because I'm veeery interested!
Doesn't work with su command...
I trying to change bcm4329.ko permission with root explorer but nothing happening.
Maybe this is the problem?
And where is located iwconfig file?
Can I change file permission from adb shell and how?
Finaly WORKS!!!!!!!!!!!!!!
Because, I cant enable ad hoc on my Desire (I try many ways and nothinhg...),
I found another way to share wifi internet from pc to android phone.
This is my way:
Download VirtualRouter
Download fresh wifi drivers for Windows 7 64bit/32bit
Disable IP6 (if you have Windows 7 64bit)
After install VirtualRouter, reset your PC and VirtualRouter will start with your Windows in system tray.
In Network Connections, enable Microsoft Virtual WiFi Miniport Adapter if disabled.
Go to Local Area Connection (your default internet connection), properties -> sharing and check all box. Select home network connection -> Microsoft Virtual WiFi Miniport Adapter or Wireless Network Connection 2.
Run cmd as admin and type this:
netsh wlan set hostednetwork mode=allow ssid=Test key=password
netsh wlan start hostednetwork
VR automaticly write ssid and key and starting virtual network.
Desire CAN SEE this network, and you CAN CONNECT!
If you have problems go here.
atlantisu21 said:
Finaly WORKS!!!!!!!!!!!!!!
Because, I cant enable ad hoc on my Desire (I try many ways and nothinhg...),
I found another way to share wifi internet from pc to android phone.
[
Click to expand...
Click to collapse
I work in the same way (with connectify)>
Too bad you couldn't get ad-hoc to work, i would like to have that solution, it is more elegant.

Wifi doesn't work anymore, for no reason

[I didn't realize there is this HTC Desire specific subforum, so I'm copypasting my question from General Q&A forum].
I've been running Miui happily for over a year on my HTC Desire, just to notice last week that wifi works only right after power-up (not reboot!) and until switched off. After that, it won't start again. I've tried different things, roms, clean installs, just to confirm the same behaviour, regardless of the rom installed. Detailed explanation is available here:
[EDIT: Being a new member, I'm not allowed to post links. So here it is, 'unlinked': http is.gd slash pZ1TDo ]
(includes logs and everything).
Please help, what to do next?
Thanks,
MB
When you have the error, open a terminal and type dmesg.
Please paste the output here.
You can redirect the output by typing "dmesg > /sdcard/file.txt" ( Without quotes )
dqb said:
When you have the error, open a terminal and type dmesg.
Please paste the output here.
You can redirect the output by typing "dmesg > /sdcard/file.txt" ( Without quotes )
Click to expand...
Click to collapse
Hello, thanks for reply.
Here's the output (too big for copypaste here):
http ge.tt (slash) 3nqEYdF/v/0?c
Sorry, still not allowed to paste links.
The bcm4329 module seems ok.
Sometimes when i use the widget to power on/off wifi, it won't connect.
To get wifi working, I go into wifi settings and power on the wifi here.
Could you try like this and tell us if this working ?
dqb said:
The bcm4329 module seems ok.
Sometimes when i use the widget to power on/off wifi, it won't connect.
To get wifi working, I go into wifi settings and power on the wifi here.
Could you try like this and tell us if this working ?
Click to expand...
Click to collapse
I tried all of the combinations - settings/wireless, status bar, specific widgets - nothing works. At least I have consistent behaviour
This is my original post on miui forum (when I thougt it was miui related). It explains what actions I performed while trying to nail the problem. Still no luck.
Code:
Hello,
Recently I've noticed that wifi on my HTC Desire is acting very strangely - it connects just the first time after reboot, every other time I get "Error" message in Wifi settings. Where I can check what actually went wrong?
After looking in the logs, I hope to have more information on this issue, but for now I believe it's hardware related, since the same problem appears even with the fresh install of the latest MIUI or after restoring a backup.
Thanks.
mblenton, Monday at 9:59 PM Edit Report
#1 Reply
Google Adsense
Pele
Admin
Message Count:
278
You can use the MIUI Android Logcat miuiandroid.com / community/link-forums/logcat.82/
Or you could try a fresh download install again : reboot into cwm, factory reset > wipe dalvik > clear cache partition install rom
But try the logcat and also check you router etc and other things that may influence.
Regards
If you require more help speak to ibotpeaches as he is a HTC expert : join the miui irc chat :)
MIUI Android Logcat System
MIUI Android Statistics
...Im all about the end user
Samsung Galaxy S I9000 & I9100 Expert
Black Android Theme Developer Website & Twitter
Pele, Monday at 11:34 PM Report
#2 Like Reply
mblenton
Members
Message Count:
7
Hello Pele,
Thanks for the reply.
I've tried already clean install with wiping everything, even restored an old bkp which for sure is correct, but all without luck. I don't think it's a router thing, since the same problem appears regardless of my location (at home, at work... all the same). I'll join the miui irc chat, good idea, thanks!
Regarding the logcat - the link you sent is just a form for pasting logs - am I seeing it correctly?. Is there some specific miui logcal app? I've installed 'aLogcat' which seems good, but I couldn't find anything on *wifi* or *wpa* which could indicate some sort of error in any of the logs aLogcat is displaying.
Cheers,
mblenton
mblenton, Tuesday at 9:30 AM Edit Report
#3 Reply
Pele
Admin
Message Count:
278
Hi,
Try to restore your back up without wifi settings. Failing that yes come to irc chat for about 12pm GMT+0 and chat with ibotpeaches
Regards
MIUI Android Logcat System
MIUI Android Statistics
...Im all about the end user
Samsung Galaxy S I9000 & I9100 Expert
Black Android Theme Developer Website & Twitter
Pele, Tuesday at 10:31 AM Report
#4 Like Reply
mblenton
Members
Message Count:
7
Hello Pele,
I've tried several combinations of rom/backup flashing, titanium backup restore etc. but the problem persists, even on a clean installation with just one accesspoint defined.
mblenton, Tuesday at 3:09 PM Edit Report
#5 Reply
mblenton
Members
Message Count:
7
Update: I've updated to the newest radio, but the problems are still there.
mblenton, Tuesday at 3:51 PM Edit Report
#6 Reply
iBotPeaches
Admin
Message Count:
569
Yes, you need a logcat to further figure this out.
developer.android.com / guide/developing/tools/logcat.html
Freenode #miuiandroid
iBotPeaches, Tuesday at 6:51 PM Report
#7 Like Reply
mblenton
Members
Message Count:
7
Hello iBotPeaches, thanks for the link, I didn't realize Pele's refering to that logcat. I'll have to set up abd, though.
In the mean time, I've tried the following (plus the actions described earlier):
- Format system and boot partitions (since Wipe Data/Factory Reset doesn't do that) and clean latest miui install
- Clean Cyanogenmod install
Nothing's changed, I still can connect to wifi network the first time after power up, and then all I get is 'Error' msg. Interesting, but reboot doesn't actually help, just power off/power on.
mblenton, Tuesday at 9:04 PM Edit Report
#8 Reply
mblenton
Members
Message Count:
7
Hello again,
I've installed adb and used logcat to generate this file: ge.tt /9UkgUaF/v/0?c
I'm not quite sure what would be interesting for debugging purposes, so I performed the following procedure:
0. Wifi is enabled, but not working; power down the device; start adb logcat - waiting for device -
1. Power on (wifi will be enabled and connected to SSID Hotspot)
2. Open browser, open google (everything works)
3. Close browser, turn off wifi (via status bar, but it doesn't make any difference)
4. Open settings, try to turn on wifi
5. Wifi couldn't be turned on, 'Error' message is displayed
6. Power down the phone
Thanks in advance!
mblenton, Yesterday at 10:36 AM Edit Report
#9 Reply
mblenton
Members
Message Count:
7
Yet another update, not I'm pretty sure this issue is not miui related.
I've installed Gingerbread RUU and performed the power-on/wifi-on--works/wifi-off--won't-start-anymore procedure with the same results. Here are the logs: ge.tt /9sOVXbF/v/0?c
Where I should look for help?
Ok, after you got the error, go in a terminal and type lsmod ( list loaded modules )
If you see the bcm4329 loaded ( wifi module ), go in a terminal and type modprobe -r bcm4329 ( unload module )
Verify with lsmod if the module is unload.
After that, try to activate the wifi in settings/wireless. Twice if the first gives you an error, it should "unload" the first time, and the second time it should load.
I just tested by inducing an error.
Tell us is this work !
Hello again,
I've tried what you suggested, and this is the result:
Issuing lsmod while wireless is OK:
bcm4329 200131 0 - Live 0xbf000000
After turning off wireless, lsmod doesn't display anything.
After trying to turn wireless back on, lsmod also doesn't display anything, regardless of the times I tried to turn wireless on (and getting Error every time is Settings)
modprobe bcm4329 returns
modprobe: 'bcm4329.ko': invalid parameter
insmod bcm4329 or bcm4329.ko says it can't open bcm4329 (.ko)
So, the linux system under the android seems to be working ok.
Hi,
Ok, after power off/on wifi, the driver doesn't load :/
With some tests and by inducing an error, it works on my side
When you have the error, try this as root :
Code:
su
lsmod ( if bcm4329 is loaded then rmmod bcm4329 )
svc wifi enable ( it's to turn on wifi manually, I waited a few seconds, and everything was properly unloaded ! And wifi off.. idk why )
svc wifi enable ( if the first time it didn't work, it worked for me, it might work for you )
svc wifi disable
but I've intentionally caused an error, not you. And i think that svc is the same as widget/settings..
BTW, for insmod you need to give the full path of the module : /system/lib/modules/bcm4329.ko and the fw path, but it will not work like that you need to set/config interface etc.. I'll try to do it manually.
I just looked quickly one of your old logcat because i'm tired and i'm going to sleep, I'll look more in detail this night if we can find the most important thing : what causes this problem.
dqb said:
Hi,
Ok, after power off/on wifi, the driver doesn't load :/
With some tests and by inducing an error, it works on my side
When you have the error, try this as root :
Code:
su
lsmod ( if bcm4329 is loaded then rmmod bcm4329 )
svc wifi enable ( it's to turn on wifi manually, I waited a few seconds, and everything was properly unloaded ! And wifi off.. idk why )
svc wifi enable ( if the first time it didn't work, it worked for me, it might work for you )
svc wifi disable
but I've intentionally caused an error, not you. And i think that svc is the same as widget/settings..
BTW, for insmod you need to give the full path of the module : /system/lib/modules/bcm4329.ko and the fw path, but it will not work like that you need to set/config interface etc.. I'll try to do it manually.
I just looked quickly one of your old logcat because i'm tired and i'm going to sleep, I'll look more in detail this night if we can find the most important thing : what causes this problem.
Click to expand...
Click to collapse
Hello,
Thank you for attepts to help me, unfortunatelly none of your advices haven't succeeded to turn on wifi once it was turned off. I don't know what to do next. I actually keep it turned on all the time, and it works OK. Not quite happy with that
Hi mblenton,
Ok
I just found how to really turn on the wifi manually.
First, in a root terminal run : getprop wifi.interface, I have eth0, if you have another interface, replace the following by yours.
After error, make sure your eth0 interface is down by running in a root terminal "netcfg" you'll not find eth0 interface, or "ifconfig eth0" must return " eth0: No such device " same for "iwconfig eth0".
If eth0 is up, run as root : "ifconfig eth0 down" and retry to turn on wifi as usual.. maybe it will work.
If not, make sure bcm4329 module isn't loaded ( lsmod ), make sure eth0 is down and try this :
Code:
su
modprobe bcm4329 firmware_path=/system/vendor/firmware/fw_bcm4329_apsta.bin
start wpa_supplicant
dhcpcd -BKL eth0 &
If "modprobe bcm4329 firmware_path=/system/vendor/firmware/fw_bcm4329_apsta.bin" return you an error, try this :
Code:
insmod /system/lib/modules/bcm4329.ko firmware_path=/system/vendor/firmware/fw_bcm4329_apsta.bin
But it's better to load a module with modprobe.
What the commands do :
1) Be root
2) Is for loading module and firmware properly
3) Start wpa_supplicant as service with right user, and load your wireless config
4) Run dhcpcd on background for getting an ip by dhcp ( which implies not have configured the ip manually )
If the wireless icon is not activated in notification bar, it's normal.
ping -c2 google.com or open a browser and try a google search, it worked for me..
If it work for you, cool, we can make a bash script to get the wifi works temporarily, the time to found the cause of the malfunction !
A guy that I helped had a problem with bluetooth, it was a permission problem.. he found a fix :
Daiksi said:
with rom manager i did fix permission and IT WORKED!!!!!!!!YATTA!!!
Click to expand...
Click to collapse
Try that, it can only do good things !
Hello,
I've tried what you suggested, including permission fixing, and the situation remained the same. I'm surprized there's nothing in the logs, though.
Thank you once more.

[Q] adb over bluetooth

Any one know how to use adb over bluetooth in this device ??
I tried 'pand' command from terminal and this doesn't work.
impossible...
try this, for linux pc.
http://fomori.org/blog/blog/2011/12/05/android-adb-over-bluetooth/
nfs1mw said:
try this, for linux pc.
http://fomori.org/blog/blog/2011/12/05/android-adb-over-bluetooth/
Click to expand...
Click to collapse
I already tried this but didn't work
pand gave some error "Failed to open control socket: Address family not supported.........."
then I thought this error may be due to lack of bluetooth module.so I compiled "bluetooth.ko" and loaded.
then the error disappeared but the thing didn't worked..
I think my bluetooth device is not detected by the module because '/sys/class/bluetooth' directory was empty
So still now i am seeking for a solution....
harish2704 said:
I already tried this but didn't work
pand gave some error "Failed to open control socket: Address family not supported.........."
then I thought this error may be due to lack of bluetooth module.so I compiled "bluetooth.ko" and loaded.
then the error disappeared but the thing didn't worked..
I think my bluetooth device is not detected by the module because '/sys/class/bluetooth' directory was empty
So still now i am seeking for a solution....
Click to expand...
Click to collapse
Well it actually is not impossible. I already had it working.
But your phone shouldn't have any issues with BLUETOOTH PAN profile. If having any issues maybe don't expect this to work. And it need not have mobile internet for both phone or PC. Its just phone-to-pc direct connection, no need for internet access point. Lets think there is no mobile internet enabled for the below HOW-to.
Ok here u go. Pair your phone and PC. Initiate BT PAN connection from PC to phone (right click on bluetooth device and select connect-via-access-point). This creates a local connection. Now u need to know local IP address on phone side. Install terminal emulator application and issue the command "netcfg" which lists all connections active. Note the IP address of the connection bnep0 (say ww.xx.yy.zz)
Now open your PC Command prompt and type the command
adb connect ww.xx.yy.zz:5555
it says connected. Enjoy.
Same goes for wireless connection through LOCAL WIFI (WLAN) without internet access point.
Lets think mobile internet is off.
Turn on the portable Wifi Hotspot on the android device and make ur PC to connect to that hotspot. Note down the local ip address of the connection. Then open pc command prompt and type same command as above
adb connect ww.xx.yy.zz:5555
connected . enjoy.
IMPORTANT: First of all u need to enable ADB OVER NETWORK option in phone. This option is present in latest roms like cm7.2 or cm9 or ics roms. If this option is not available u need to find terminal alternatives for this.
Noob here.
Is there any detail guide to do this ???

Will this work for VPN...?

Install openvpn and then place your edited client vpn config files and certificate files on the storage of FireTV similar to the raspberry pi method in the thread below:
h**p xbmchub.com/forums/threads/24769-How-to-set-up-your-VPN-on-raspberry-pi-using-Brain-Hornsby-Openvpn-for-XBMC
Thanks for anyone that may know more than me that could maybe get this to work...
Hmm would be nice if that worked. Did u get a chance to try it?
Sent from my Nexus 5 using XDA Free mobile app
tdfsu said:
h**p xbmchub.com/forums/threads/24769-How-to-set-up-your-VPN-on-raspberry-pi-using-Brain-Hornsby-Openvpn-for-XBMC
Click to expand...
Click to collapse
I'm working on something like this just now. Here's the thing: in my logs for the simplest openvpn app to install (not straight openvpn, it turns out, as there's a windowing issue there that makes it difficult / impossible to navigate through setup, even with a keyboard and Droidmote) once I have a config, I get errors in logcat informing me
"Your image does not support the VPNService API, sorry "
There is a manually installable openvpn binary that I've looked at a bit but not yet configured. It is going to require adding a binary to /system/xbin directly, as the installer (at least on my phone) does not understand where /system/xbin really lives and issues a remount command to a nonexistent partition.
If you're running dd-wrt or similar configurable firewall, another option is to get an account with a provider who is set up to let you do a firewall to firewall connection, and then route either all of your traffic or the traffic from your firetv through that firewall-to-firewall connection.
I have a Private Internet Access vpn account.
Installed openvpn on FireTV--
http play.google.com/store/apps/details?id=de.schaeuffelhut.android.openvpn.installer&hl=en
Installed busybox on FireTV--
http play.google.com/store/apps/details?id=stericson.busybox&hl=en
I created a pass.txt file with my PIA username on the first line and password on the second line, nothing else, then saved the file as a text file (pass.txt).
Download the following to PC--
http privateinternetaccess.com/openvpn/openvpn.zip
Extracted the zip file.
Edited the location specific .ovpn file (see below), changing the 'remote', 'ca', 'crl' and 'auth' lines to the following--
client
dev tun
proto udp
remote us-florida.privateinternetaccess.com 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca /storage/sdcard0/openvpn/ca.crt
tls-client
remote-cert-tls server
auth-user-pass /storage/sdcard0/openvpn/pass.txt
comp-lzo
verb 1
reneg-sec 0
crl-verify /storage/sdcard0/openvpn/crl.pem
Then, save the USFlorida.ovpn file.
Upload ca.crt, crl.pem, pass.txt, and .ovpn file to FireTV to /storage/sdcard0/openvpn/
Open terminal on FireTV. I use jackpal's terminal app below, but you can also use adb.
http play.google.com/store/apps/details?id=jackpal.androidterm
In terminal, type the following--
su
openvpn cd /storage/sdcard0/openvpn/USFlorida.ovpn
But I get several errors. Anyway, that's where I'm at. Maybe someone else more knowledgeable than me can figure it out. Sorry about the links, my low post-count will not allow me to post url's.
Also, you can sideload the following app to verify your external ip address, and it works great with the FireTV remote--
http play.google.com/store/apps/details?id=igit.WhatIsMyIp
The approach you've taken is where I'd be headed next on the client side.
One thing you might want to try is to do the same setup a less locked-down device and confirm that the config files work as expected there.
There's also a good discussion of the hardware approach (setting up a tunnel from your edge to a VPN provider) in the other VPN thread, http://forum.xda-developers.com/showthread.php?t=2797005
also, private internet access will sell a preconfigured router for this purpose!

Pree configuring Wifi in android rom

hello mates
i am customizing a ROM for TV sticks and i need to pre configure (hardcoded) ssid and password for the wifi.
so that if i flashed another or same device with the rom it should take that same ssid and passwd in that network.
so what i did is i connected the device to a wifi network gave ssid and passwd and pull the /data/misc/wifi/wpa_supplicant.conf(which will conatain the network ssid and pass) using "adb shell"
now "forget" the wifi network and pushed the file using 'adb shell' as soon as i pushed and turn on the wifi it took the ssid and paswd and connected to the network .
but the problem occure when i reboot the device and tried to turn on the wifi it stucks in "Turning on wifi" and in advance settings the MAC is also unavailable.
its like some permission is preventing to start the wifi..
i have tried : rm wpa_supplicant.conf and push new wpa_supplicant.conf
/*###############################*/
this is my wpa_supplicant incase you need to see
ctrl_interface=wlan0
update_config=1
eapol_version=1
ap_scan=1
fast_reauth=1
device_name=rk31sdk
manufacturer=rockchip
model_name=MK908II
model_number=MK908II
serial_number=V8GCU6JBJL
device_type=10-0050F204-5
config_methods=physical_display virtual_push_button keypad
network={
ssid='airtel'
psk='randomwifipasswd'
key_mgmt=WPA-PSK
scan_ssid=1
priority=1
}
/*##############################################*/
ps:urgent help needed..
Hi there,
Please wait until mods will move this thread to the device specific forum for more relevant answers.
Stand by
Solved it ...
hey i actually solved the problem...
The problem was when i was pushing the file it was not having particular permission..
the above problem can be solved by using 2 commands
after pushing the custome wpa_supplicant.conf file
those are
adb shell chown system:wifi /data/misc/wifi/wpa_supplicant.conf
adb shell chmod 0644 /data/misc/wifi/wpa_supplicant.conf
I did this. Now my fire stick still shows "Scanning for networks" after a ROM install / factory reset, but is actually connected to my network!? How do I skip into the home screen after a factory reset?

Categories

Resources