MiloSobral commited on
Commit
dcdc8bd
1 Parent(s): 4cda71a

Fixes to wifi intallation instructions

Browse files
Files changed (1) hide show
  1. PortiloopV2.md +23 -12
PortiloopV2.md CHANGED
@@ -44,23 +44,32 @@ First, we can create a script to create the interface using `sudo nano /usr/loca
44
  ```bash
45
  #!/bin/bash
46
 
47
- # Delete the existing p2p0 interface
48
- sudo iw dev p2p0 del
49
 
50
- # Reload the Network Manager utility
51
- sudo systemctl restart NetworkManager
 
 
 
 
 
52
 
53
- # Create a new ap0 interface in AP mode
54
- sudo iw phy phy1 interface add ap0 type __ap
55
 
56
- # Disable power management for the ap0 interface
57
- sudo iw dev ap0 set power_save off
58
 
59
- # Reload the Network Manager utility again
60
- sudo systemctl restart NetworkManager
61
 
62
- # Get an IPV4 address for the server
63
- sudo ifconfig ap0 192.168.4.1 up
 
 
 
 
64
  ```
65
 
66
  To be able to run this file like a script, run `sudo chmod +x /usr/local/bin/create_ap0.sh`
@@ -78,6 +87,8 @@ To make sure this starts works everytime we turn the Portiloop on, we need to cr
78
  [Unit]
79
  Description=Create The Access Point for the coral
80
  Before=hostapd.service dnsmasq.service
 
 
81
 
82
  [Service]
83
  Type=simple
 
44
  ```bash
45
  #!/bin/bash
46
 
47
+ # Get the name of the interface on phy1
48
+ phy1_interface=$(sudo iw dev | awk '/phy#1/ {getline; print $2}')
49
 
50
+ # Check if the interface name is p2p0
51
+ if [[ $phy1_interface == "ap0" ]]; then
52
+ echo "ap0 already set up, not running script..."
53
+ else
54
+ echo $phy1_interface
55
+ # Delete the existing p2p0 interface
56
+ /sbin/iw dev $phy1_interface del
57
 
58
+ # Reload the Network Manager utility
59
+ systemctl restart NetworkManager
60
 
61
+ # Create a new ap0 interface in AP mode
62
+ /sbin/iw phy phy1 interface add ap0 type __ap
63
 
64
+ # Disable power management for the ap0 interface
65
+ /sbin/iw dev ap0 set power_save off
66
 
67
+ # Reload the Network Manager utility again
68
+ systemctl restart NetworkManager
69
+
70
+ # Get an IPV4 address for the server
71
+ ifconfig ap0 192.168.4.1 up
72
+ fi
73
  ```
74
 
75
  To be able to run this file like a script, run `sudo chmod +x /usr/local/bin/create_ap0.sh`
 
87
  [Unit]
88
  Description=Create The Access Point for the coral
89
  Before=hostapd.service dnsmasq.service
90
+ After=network-online.target
91
+ Wants=network-online.target
92
 
93
  [Service]
94
  Type=simple