Terminate on either WiFi or eth0 connection #149
-
In my application, the Raspberry Pi (4B) can be connected either via WiFi or ethernet cable. I would like the comitup hotspot to terminate if there is a connection on eth0. Would there be some hints as to how to achieve this within the comitup code? My application listens on port 80, so therefore it will not start when comitup hotspot is running. I could have a shell script check for internet connection and then use I am a python programmer so I could modify the code, but I am not a networking guy. I would prefer to modify the comitup code so that if it found there was a connection on eth0, it would call the callback function with "CONNECTED". I could use some hints about doing this. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 19 replies
-
The place in the comitup code for that would be hotspot_start() and hotspot_timeout() in states.py. |
Beta Was this translation helpful? Give feedback.
-
Logically, the comitup fix might be best solved by adding another state, for "ethernet active and kill-comitup-activity-when-ethernet is set". |
Beta Was this translation helpful? Give feedback.
The place in the comitup code for that would be hotspot_start() and hotspot_timeout() in states.py.
... but that may not a particularly good place. Looking at the current code status, the timeout is sometimes called every 5 seconds, and sometimes every 3 minutes (if no AP connections are defined). I've done much fiddling with that number in the past - I'm not sure if setting it to 5 seconds always would be OK.
You could kill comitup externally, but you would also be responsible for tearing down the AP via nmcli.