-
Notifications
You must be signed in to change notification settings - Fork 60
BUG - Can't change networks a second time #23
Comments
I am also experiencing this issue. The docs don't indicate whether there is an endpoint for disconnecting/reconnecting from a network. It's really important to be able to associate with different networks without completely killing the service. UPDATE: Just made a small pull request. It seems that initially enabling a network automatically associates the device, however, consecutive additions are only added to the config without connecting. I added a 5th step to the ConnectNetwork method that uses wpa_cli's As an aside, it might also be useful to create a |
I noticed a factor that can contribute to this. Over the course of testing, I've restarted the container many times and often found it would connect at first but subsequent attempts wouldn't work until I rebooted the device. It turns out the hardware device name had been incremented, so instead of As a workaround, I added a parameter to the diff --git a/iotwifi/commands.go b/iotwifi/commands.go
index 88fe8c7..ebd085c 100644
--- a/iotwifi/commands.go
+++ b/iotwifi/commands.go
@@ -36,7 +36,7 @@ func (c *Command) UpApInterface() {
// AddApInterface adds the AP interface.
func (c *Command) AddApInterface() {
- cmd := exec.Command("iw", "phy", "phy0", "interface", "add", "uap0", "type", "__ap")
+ cmd := exec.Command("iw", "phy", c.SetupCfg.HostApdCfg.Phy, "interface", "add", "uap0", "type", "__ap")
cmd.Start()
cmd.Wait()
}
diff --git a/iotwifi/types.go b/iotwifi/types.go
index b1074cb..04db1c9 100644
--- a/iotwifi/types.go
+++ b/iotwifi/types.go
@@ -20,6 +20,7 @@ type HostApdCfg struct {
WpaPassphrase string `json:"wpa_passphrase"` // wpa_passphrase=iotwifipass
Channel string `json:"channel"` // channel=6
Ip string `json:"ip"` // 192.168.27.1
+ Phy string `json:"phy"` // phy=phy0
}
// WpaSupplicantCfg configures wpa_supplicant and is used by SetupCfg This is a kludge and I don't recommend doing this, which is why I'm not submitting it as a pull request, but it may be helpful to someone. Ideally, the code would detect the current device name but I'm not sure what would be the best way to handle the case where multiple wireless devices are present. |
Bug: Unable to set network a second time.
Steps:
Expect to be able to set connection several times:
The text was updated successfully, but these errors were encountered: