Enabling / disabling wlan via command line


rohezal

Advanced Member
Joined
Oct 18, 2009
Messages
1,712
hi is there a way to enabling / disbling wlan via command line an connect to a specific wlan? would come handy with the new telegram desktop client.
 
Last edited by a moderator:
Played a bit with nmcli thank you notaz. But I can't figure out how to enable or disable the wlan0 interface. It is done differently right? Ifconfig wlan0 up doesnt work, I think I must load the kernel module via modprobe right?

Can you give me the necessary commands or tell me where I can find them? Looked at the Pandora wiki and googled for ifconfig wlan0 no such device.
 
I have here "wl1251_sdio" and "wl1251", those two modules enable/disable it.

Load/unload them via modprobe.

Careful they have an order: the sdio goes first.
 
Last edited by a moderator:
why do you not go the easy Way to enable/disable Wlan?


sudo /usr/pandora/scripts/op_wlan.sh or near.


This (or nearly the Same) Command activate the internal Wlan or deactivate the internal Wlan.


I have no Pandora here in my work,just see in the


/usr/pandora/scripts/


Directory for the right sh File ;)


And when you once connected to that Wlan normaly then will your Pandora save the Wlankey and use it next Time automatic.
 
Thank you, all of you. I will try this. If I can just start telegram and wlan starts automaticly, this would be great :) .
 
ah that is your Goal?


That should be no Problem,in the Pandora Settings(activate/deactivate Bootservices)


can you easy activate Wlan @ Boot,no Terminal Magic is needed for that. ;)


Good Idea,maybe i make that too ;)
 
That should be no Problem,in the Pandora Settings(activate/deactivate Bootservices)
But I don't want to waste power when I don't use telegram. I also tunnel the telegram connection via ssh to avoid password sniffing. This starts also automaticly (via sshpass, ugly but works).
 
Funny Idea from you.


For the SSH tunneling is maybe the Telegram Cli Version from the Repo better for you ;)
 
Oh I should have told you, I allready use prescript and postscript to start the ssh client and kill it. And it allready works. I am just missing a way to enable wlan0. But it looks like I got even two solutions for this problem :) .
 
Last edited by a moderator:
Ok I have the scripts running, they are working great. Just my lcd cable is dying so my pandora will be send back to ED.

Prescript:


#!/bin/bash
localcount=`ifconfig | grep wlan | wc -l`
if [ $localcount -lt 1 ]
    then
    /home/rohezal/wlan.sh&
    echo "first wait"
    sleep 8
    localcount=`ping -c1 8.8.8.8 | grep "1 received" | wc -l`
    if [ $localcount -lt 1 ]
        then
        echo "second wait"
        sleep 3
        localcount=`ping -c1 8.8.8.8 | grep "1 received" | wc -l`
            if [ $localcount -lt 1 ]
                 then
                echo "third wait"
                sleep 5
            fi
    fi
fi

/home/rohezal/proxy.sh&
sleep 1
Postscript:


#!/bin/bash
killall sshpass
wlan.sh:

just toogles the wifi state:


sudo /usr/pandora/scripts/op_wifi.sh
added a rule to sudoers.d/50_rohezal.sh to avoid entering a password (not sure if this is necessary or i just could call sudo /usr/pandora/scripts/op_wifi.sh directly from the prescript ):

Code:
ALL ALL=NOPASSWD: /home/rohezal/wlan.sh
 
Last edited by a moderator:
The problem with NetworkManager is that it sometimes asks for the network key. The key is already in the dialog, but you have to click OK to reconnect, and nmcli is unable to bypass it.

I'm currently testing a script which uses wpa_supplicant to connect to WIFI, it is working great so far.
 
I used a blank keyring (no password for it), to avoid entering a password.
 
I used a blank keyring (no password for it), to avoid entering a password.
Me too.

Try taking your pandora for a walk while it is connected to your home wifi. With some luck it won't reconnect automatically when you come back.

Or try to reboot your router a couple of times and check if pandora reconnects automatically every time.
 
Last edited by a moderator:
Oh ok, I never do that. Thats probably why I didn't notice it.
 
Back
Top