Release WiFi Reconnector


PowerGod

Forum Addict!
Joined
Jun 20, 2011
Messages
4,419
Here a script to auto-reconnect to the access point, for all the people that have problems with the integrated WiFi.

Sometimes the driver doesn't recognise the disconnection, and this is the reason why I made this program.

- old script -

I'm new to this kind of things and lost many hours on man pages and google to make this, but it's not finished, I want to make at least a PND with an ON/OFF menu.

Anyway it just ping the router address until the message 'Destination Host Unreachable' comes, and then restart the same connection.

No parameters are needed, just launch it like this in a terminal:

sh /media/<YourSD>/wifirecon.shTo terminate the script use CTRL+C or kill it.

(You can also launch it "Executing" the file from Thunar, but better not for now, cause you can't see the messages and there are bugs)


BUGS:

- Sometimes the script start to replicate itself...at every reconnection... so better open it in a terminal, so closing it's window will kill all the instances


I'm actually using this script and posting from my Pandora, cause I'm able to reproduce the disconnecion problem simply turning on wifi on the other PC and make it download with some p2p software.
Now the Pandora is disconnecting every 1/3 minutes, but I don't mind cause it's reconnecting automatically :)

Tell me what you think and what you find wrong.

EDIT: Seems I can't upload a bash script... so here the content, copy it in a text editor and save as "wifirecon.sh"
 


#!/bin/bash
#
# WiFiRecon ver.0.1a
# Script for Pandora
# by PowerGod (06/09/2012)
#
# Auto-Reconnection to WiFi
# when the address is unreachable
#
# Pings the router to verify the status,
# in case of no answer it reconnects
# to the access point
#

# Find if there's already an instance running
vlockfile=/tmp/wifirecon-lock

# Find if exist the lock file
if [ -f "${vlockfile}" ]; then

# Read the ID in the lock file
# to confirm that is already running
vappid=$(head -n 1 "${vlockfile}")

vrunlrd=$(ps -p "${vappid}" | grep "${vappid}")

# If the PID is wrong will be updated
if [ -z "${vrunlrd}" ]; then
# Copy the PID in the lock file
echo $$ > "${vlockfile}"
else
echo
echo "wifirecon.sh is already running"
echo
exit 0
fi

else
# Create the lock file with the PID
echo $$ > "${vlockfile}"
fi

# Get the Router IP
vrouteip=$(ip route $1 | grep "via" | gawk '{print $3}')

# Find if there is a started connection
if [ -z "${vrouteip}" ] ; then echo ; echo "A connection must be started before launching this script !!" ; echo ; exit ; fi

echo
echo "Monitoring the IP:" "${vrouteip}"
echo
echo CTRL+C to Quit
echo

# Endless loop
while [ 1==1 ]; do

vuuid=$(ping -c 1 "${vrouteip}" | grep -o "Unreachable")

if [ -z "${vuuid}" ] ; then vuuid="null" ; fi

if [ "${vuuid}" == "Unreachable" ]; then

# Reconnect
echo
echo $(date +%x\ %X) : Reconnection to "${vrouteip}"
vuuid=$(nmcli -t -f UUID con status)
nmcli con up uuid "${vuuid}"

fi
done

In the new version I made a complete pnd structure with the menu to turn on and off the script.

It doesn't write anymore on the nand tmp dir but in his appdata.

It works well on my pandora, but I'm stuck on how to pack the directory into a PND...
I wanted to post at least the directory, cause it works like a pnd if put in the right path, but seems I can't post it here, maybe I need some permissions...

I made it ! Finally, here the pnd !!

I need to thank Slaeshjag's "swap tool" cause I studied how was working his app to make mine ;)

INSTRUCTIONS:

Works only with NetworkManager (the Default program on the Pandora)

1) Connect to the Access Point
2) Launch WiFiRecon (from System menu) and select "Activate autoreconnection"
3) To quit launch againg WiFiRecon and select "Deactivate autoreconnection"

FUTURE ADDICTIONS:

- Better Icon... maybe :D
- Slow down the ping rate
- Some code cleaning

EDIT (05 August 2012):
After installing SuperZaxxon Final I'm not anymore able to reproduce the problem, so it seems I don't need this anymore

EDIT (23 January 2013): 
I was wrong... and I still need to use this PND sometimes

wifirecon.pnd
 

Attachments

  • wifirecon.pnd
    5.7 KB · Views: 187
Last edited by a moderator:
Have you not tried the new wifi drivers? once installed the wifi becomes stable and this script is really no longer needed.








- Neelix
 
After I updated to SuperZaxxon Final I'm not able anymore to reproduce the problem... so I hope this is not needed anymore, at least to me.
 
After OpenPandora GmbH repaired my broken lcd-cable, i am not able to connect to my WLan-router anymore.

It works with the WLan-Hotspot-App on my HP Pre3, but that is not an option for big updates.

I tried to update to SuperZaxxonFinal, but it didnt help. WLan works only for a very short time with horrible low speed.

What could I do?
 
Shout at Askarus because he made a mistake when repairing the unit... well, not really the best option.


It could be because of two reasons:


1. He forgot to plug in the antenna. In that case, removing the backside of the Pandora and plugging it back in should do the trick.


2. The silver tape is shortcircuiting the antenna. The lid needs to be opened in that case.
 
Because you resumed the thread I'll add a thing, this problem I reported is still here but it verifies only when both my PC and the Pandora are connected to the router via Wi-Fi and the PC is downloading... if I connect the PC to the router with an ethernet cable then the Pandora has not anymore problems...

So I still use this application when my PC uses Wi-Fi...

@Palmiga: what does it do when it disconnects ? Does it tries to reconnect automatically or remain with the "connected" icon but it can't see the lan ? And in the second case, can you try to ping the router to see what message do you get ?
 
Last edited by a moderator:
Thanks for your answer.

@Evildragon: I dont think its the antenna-plug, because it works great with the Hotspotapp and now again with my router. :)

@PowerGod: You are right! :D Connect the PC to the router with an ethernet cable fix the problem. There are two more devices using the wifi-router (smartphone and tablet) and no problem using the Openpandora, but if I connect the PC to it, the Openpandora could not use the wifi anymore.

Strange problem. Didnt have this in ages using different devices and router in different places. Any suggestion to solve this problem?
 
Sometimes I learn something new on wifi connections but for now is still not enough to be able to debug the problem... anyway I'm still playing with the configuration when I'm in the mood, just to see if I find something new...

Here is another strange thing I found about the connection, and in some way seems to be related... but I'm far away to understand what the problem is...

I will post every strange thing I will found... maybe something will ring a bell to someone who knows better than me 

EDIT:

@Palmiga: just for curiosity do you have an ACER PC ?
 
Last edited by a moderator:
... I was hoping to blame the network adapter ACER Nplify, but seems not the case
 
Are you REALLY sure ?

I have problems with the PC only when it's using large bandwith downloading from internet or using p2p...

if it's just connected to the router (with wifi) but it's doing nothing heavy (normal internet browsing sessions, antivirus updates...) I have no problems at all, the Pandora remains connected.

This situation never changed for me from the first day I received the Pandora (April 2012, if I remember well), and every OS versions I tried never changed this situation...

So, if you are REALLY sure, it can be an hardware issue, maybe the things specified by EvilDragon, and maybe I have the same problem...

(but you must be REALLY sure !! ;) )
 
Yes, im sure.

Just tested. If my Lenovo is only connected to my router and didnt load anything via wlan (could see it in a graphical systemmonitor), the Pandora loads only very slow or nothing.

If i turn off the wlan-chip from the lenovo, everything works fine.

Im sure this didnt happend before, but I got some kernel-updates for the Lenovo. But all other devices here works great together with the Lenovo.
 
Then maybe I have too a problem with the antenna... 

By the way, nothing changed with the router ?
 
Well, I open my Pandora and take a look at the antenne. Looks good and connencted to the mainboard.

I test several wifi-router, no problem.
 
Back
Top