0

In my setup I want to switch between my GoPro camera WLAN (to control GoPro camera) and my Home WLAN (to send recorded images by mail).

I tried to use the script described in How to switch back and forth between 2 WLANs, of which 1 hidden? but have no success. I always stick with my home network.

I have wpa_supplicant.conf with the following definitions:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=0
country=CH

network={
    ssid="UPC7529264"
    scan_ssid=1
    psk="passwordHome"
    key_mgmt=WPA-PSK
}

network={
    ssid="HERO7Black"
    psk="passwordGoPro"
    key_mgmt=WPA-PSK

I understand that network 0 is UPC7529264, while network 1 is HERO7Black. While beeing connected to UPC7529264 and executing switchnetwork.sh EXTERNAL I would have expected the network to switch to the GoPro Network. But nothing happens. I keep with UPC7529264:

$ sudo bash ./switchnetwork.sh EXTERNAL
SWITCHING TO NETWORK ID 1
Selected interface 'p2p-dev-wlan0'
OK
Selected interface 'p2p-dev-wlan0'
OK

$ iw dev wlan0 info
Interface wlan0
    ifindex 3
    wdev 0x1
    addr 76:2c:e4:30:f7:83
    ssid UPC7529264
    type managed
    wiphy 0
    channel 44 (5220 MHz), width: 40 MHz, center1: 5230 MHz
    txpower 31.00 dBm

Any ideas what configuration could prevent the switch?

@Ingo : Sorry for the bad formating in the comment. I see your point, but it seems I am in fact changing the wlan0 network:

pi@raspberrypi:~ $ ./switch2gopro.sh
WPA process killed 
PascalHERO7 connected 
pi@raspberrypi:~ $ wpa_cli -iwlan0 status 
bssid=06:41:69:d7:d1:d6 freq=2437 
ssid=PascalHERO7 
... 
pi@raspberrypi:~ $ ./switch2home.sh 
WPA process killed 
UPC Home connected 
pi@raspberrypi:~ $ wpa_cli -iwlan0 status 
bssid=38:43:7d:40:06:62 
freq=2462 
ssid=UPC7529264 
...
pi@raspberrypi:~ $ wpa_cli status 
Selected interface 'p2p-dev-wlan0' 
wpa_state=DISCONNECTED 
...

  • Have a look at the priority=nnn option in /etc/wpa_supplicant/wpa_supplicant.conf you can use that to choose a preferred network (bigger number is more preferred). Otherwise you'll have to kill wpa_supplicant and restart it with a new config file. – Dougie Apr 11 at 15:43
  • Priority is not an option, since I want to switch depending on the usage I have. There are two wpa_supplicant processes. ``` /sbin/wpa_supplicant -u -s -O /run/wpa_supplicant wpa_supplicant -B -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 -Dnl80211,wext ``` I killed both and restarted only a the 2nd with special wpa_gopro.conf or wpa_home.conf This works, but on the desktop another symbol is shown (up/down arrow instead of WLAN wave symbol) and "No AP found - scanning...". – P-ascii Apr 11 at 17:47
1

It seems you are selecting the wrong interface p2p-dev-wlan0 on your RasPi. This is an interface for a peer to peer connection, but your networks are managed. You can show all available interfaces with (example from my raspi):

rpi ~$ iw dev
phy#0
        Unnamed/non-netdev interface
                wdev 0x2
                addr 42:43:06:8d:8c:0e
                type P2P-device
                txpower 31.00 dBm
        Interface wlan0
                ifindex 4
                wdev 0x1
                addr 02:e1:05:80:97:72
                ssid TestNet
                type managed
                channel 6 (2437 MHz), width: 20 MHz, center1: 2437 MHz
                txpower 31.00 dBm

The first one is the virtual interface p2p-dev-wlan0 and selected first if no interface to manage is specified. Look where you have to select wlan0 in your setup. With wpa_cli you will see the difference using its option -iwlan0:

rpi ~$ wpa_cli status
Selected interface 'p2p-dev-wlan0'
wpa_state=DISCONNECTED
p2p_device_address=42:43:06:8d:8c:0e
address=42:43:06:8d:8c:0e
uuid=cf397134-9e90-5387-92f2-8995cb071d05

rpi ~$ wpa_cli -iwlan0 status
bssid=dc:a6:32:01:db:ed
freq=2437
ssid=TestNet
id=0
mode=station
pairwise_cipher=CCMP
group_cipher=TKIP
key_mgmt=WPA-PSK
wpa_state=COMPLETED
p2p_device_address=42:43:06:8d:8c:0e
address=02:e1:05:80:97:72
uuid=cf397134-9e90-5387-92f2-8995cb071d05
| improve this answer | |
  • I see your point, but it seems I am in fact changing the wlan0 network: pi@raspberrypi:~ $ ./switch2gopro.sh WPA process killed PascalHERO7 connected pi@raspberrypi:~ $ wpa_cli -iwlan0 status bssid=06:41:69:d7:d1:d6 freq=2437 ssid=PascalHERO7 ... pi@raspberrypi:~ $ ./switch2home.sh WPA process killed UPC Home connected pi@raspberrypi:~ $ wpa_cli -iwlan0 status bssid=38:43:7d:40:06:62 freq=2462 ssid=UPC7529264 pi@raspberrypi:~ $ wpa_cli status Selected interface 'p2p-dev-wlan0' wpa_state=DISCONNECTED ... – P-ascii Apr 13 at 10:24
  • @P-ascii Sorry, but your comment is unreadable. Please edit your question and add it there. – Ingo Apr 13 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.