From f1d2a701407b1597c6096272343465f37bcc7c5d Mon Sep 17 00:00:00 2001 From: Thurston Stone Date: Wed, 8 Aug 2018 03:03:00 +0000 Subject: [PATCH 1/2] Add config for static ip addresses on wifi Changed S09wifi script to read ip address info from recalbox.conf and use it to write the appropriate connman settings. If any of the 3 new settings (wifi.ip, wifi.gateway, wifi.netmask) are missing, it reverts back to DHCP. Updated recalbox.conf files to document new settings. --- CHANGELOG.md | 1 + board/recalbox/fsoverlay/etc/init.d/S09wifi | 16 +++++++++++++++- package/recalbox-system/c2/recalbox.conf | 8 ++++++++ package/recalbox-system/rpi1/recalbox.conf | 8 ++++++++ package/recalbox-system/rpi2/recalbox.conf | 8 ++++++++ package/recalbox-system/rpi3/recalbox.conf | 8 ++++++++ package/recalbox-system/x86/recalbox.conf | 8 ++++++++ package/recalbox-system/x86_64/recalbox.conf | 8 ++++++++ package/recalbox-system/xu4/recalbox.conf | 8 ++++++++ 9 files changed, 72 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 529456ccee..f8df97cf8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - N64 GlideN64 and other plugins: also fix blank screen - pifba: make sure it's only available for systems supporting it - Set the recalbox tag for netplay elsewhere +- Add configuration for static ip addresses on wifi interfaces ## [18.06.27] - 2018-06-27 - Adding introRecalboxEASports.mp4 diff --git a/board/recalbox/fsoverlay/etc/init.d/S09wifi b/board/recalbox/fsoverlay/etc/init.d/S09wifi index 2b12ce4cff..4afd47ae40 100755 --- a/board/recalbox/fsoverlay/etc/init.d/S09wifi +++ b/board/recalbox/fsoverlay/etc/init.d/S09wifi @@ -9,8 +9,22 @@ rb_wifi_boot_configure() { settings_file="/var/lib/connman/recalbox_wifi${X}.config" [ "$1" = "1" ] && settings_name="default" || settings_name="${X}" + + settings_ip=`egrep "^wifi${X}.ip" /boot/recalbox-backup.conf|sed "s/wifi${X}.ip=//g"` + settings_gateway=`egrep "^wifi${X}.gateway" /boot/recalbox-backup.conf|sed "s/wifi${X}.gateway=//g"` + settings_netmask=`egrep "^wifi${X}.netmask" /boot/recalbox-backup.conf|sed "s/wifi${X}.netmask=//g"` + + settings_manual_section="" + if [[ "$settings_ip" != "" ]] && \ + [[ "$settings_gateway" != "" ]] && \ + [[ "$settings_netmask" != "" ]] ;then + settings_manual_section=" +IPv4=${settings_ip}/${settings_netmask}/${settings_gateway}" + fi if [[ "$settings_ssid" != "" ]] ;then + recallog "Recovering wifi for SSID: $settings_ssid" + mkdir -p "/var/lib/connman" cat > "${settings_file}" < \$ ;wifi.key=new key +## Wifi - static IP +## if you want a static IP address, you must set all 3 values (ip, gateway, and netmask) +## if any value is missing or all lines are commented out, it will fall back to the +## default of DHCP +;wifi.ip=manual ip address +;wifi.gateway=new gateway +;wifi.netmask=new netmask + # secondary wifi (not configurable via the user interface) ;wifi2.ssid=new ssid ;wifi2.key=new key diff --git a/package/recalbox-system/rpi1/recalbox.conf b/package/recalbox-system/rpi1/recalbox.conf index 08b1cdc844..10a8b28e6f 100644 --- a/package/recalbox-system/rpi1/recalbox.conf +++ b/package/recalbox-system/rpi1/recalbox.conf @@ -114,6 +114,14 @@ wifi.region=US ## Escape your special chars (# ; $) with a backslash : $ => \$ ;wifi.key=new key +## Wifi - static IP +## if you want a static IP address, you must set all 3 values (ip, gateway, and netmask) +## if any value is missing or all lines are commented out, it will fall back to the +## default of DHCP +;wifi.ip=manual ip address +;wifi.gateway=new gateway +;wifi.netmask=new netmask + # secondary wifi (not configurable via the user interface) ;wifi2.ssid=new ssid ;wifi2.key=new key diff --git a/package/recalbox-system/rpi2/recalbox.conf b/package/recalbox-system/rpi2/recalbox.conf index e9ed1f430d..c771827679 100644 --- a/package/recalbox-system/rpi2/recalbox.conf +++ b/package/recalbox-system/rpi2/recalbox.conf @@ -114,6 +114,14 @@ wifi.region=US ## Escape your special chars (# ; $) with a backslash : $ => \$ ;wifi.key=new key +## Wifi - static IP +## if you want a static IP address, you must set all 3 values (ip, gateway, and netmask) +## if any value is missing or all lines are commented out, it will fall back to the +## default of DHCP +;wifi.ip=manual ip address +;wifi.gateway=new gateway +;wifi.netmask=new netmask + # secondary wifi (not configurable via the user interface) ;wifi2.ssid=new ssid ;wifi2.key=new key diff --git a/package/recalbox-system/rpi3/recalbox.conf b/package/recalbox-system/rpi3/recalbox.conf index 7edc2ba181..c5ca3d1e09 100644 --- a/package/recalbox-system/rpi3/recalbox.conf +++ b/package/recalbox-system/rpi3/recalbox.conf @@ -114,6 +114,14 @@ wifi.region=US ## Escape your special chars (# ; $) with a backslash : $ => \$ ;wifi.key=new key +## Wifi - static IP +## if you want a static IP address, you must set all 3 values (ip, gateway, and netmask) +## if any value is missing or all lines are commented out, it will fall back to the +## default of DHCP +;wifi.ip=manual ip address +;wifi.gateway=new gateway +;wifi.netmask=new netmask + # secondary wifi (not configurable via the user interface) ;wifi2.ssid=new ssid ;wifi2.key=new key diff --git a/package/recalbox-system/x86/recalbox.conf b/package/recalbox-system/x86/recalbox.conf index bd0e2bccb9..fe27d14e79 100644 --- a/package/recalbox-system/x86/recalbox.conf +++ b/package/recalbox-system/x86/recalbox.conf @@ -81,6 +81,14 @@ wifi.region=US ## Escape your special chars (# ; $) with a backslash : $ => \$ ;wifi.key=new key +## Wifi - static IP +## if you want a static IP address, you must set all 3 values (ip, gateway, and netmask) +## if any value is missing or all lines are commented out, it will fall back to the +## default of DHCP +;wifi.ip=manual ip address +;wifi.gateway=new gateway +;wifi.netmask=new netmask + # secondary wifi (not configurable via the user interface) ;wifi2.ssid=new ssid ;wifi2.key=new key diff --git a/package/recalbox-system/x86_64/recalbox.conf b/package/recalbox-system/x86_64/recalbox.conf index ca74b9fea6..0f5063abe6 100644 --- a/package/recalbox-system/x86_64/recalbox.conf +++ b/package/recalbox-system/x86_64/recalbox.conf @@ -81,6 +81,14 @@ wifi.region=US ## Escape your special chars (# ; $) with a backslash : $ => \$ ;wifi.key=new key +## Wifi - static IP +## if you want a static IP address, you must set all 3 values (ip, gateway, and netmask) +## if any value is missing or all lines are commented out, it will fall back to the +## default of DHCP +;wifi.ip=manual ip address +;wifi.gateway=new gateway +;wifi.netmask=new netmask + # secondary wifi (not configurable via the user interface) ;wifi2.ssid=new ssid ;wifi2.key=new key diff --git a/package/recalbox-system/xu4/recalbox.conf b/package/recalbox-system/xu4/recalbox.conf index d31a007c3d..1285c3c582 100644 --- a/package/recalbox-system/xu4/recalbox.conf +++ b/package/recalbox-system/xu4/recalbox.conf @@ -94,6 +94,14 @@ wifi.region=US ## Escape your special chars (# ; $) with a backslash : $ => \$ ;wifi.key=new key +## Wifi - static IP +## if you want a static IP address, you must set all 3 values (ip, gateway, and netmask) +## if any value is missing or all lines are commented out, it will fall back to the +## default of DHCP +;wifi.ip=manual ip address +;wifi.gateway=new gateway +;wifi.netmask=new netmask + # secondary wifi (not configurable via the user interface) ;wifi2.ssid=new ssid ;wifi2.key=new key -- GitLab From 5dda6e31d15d5d33c1411f6f88d541f23c71c94c Mon Sep 17 00:00:00 2001 From: Thurston Stone Date: Thu, 9 Aug 2018 05:06:57 +0000 Subject: [PATCH 2/2] Adding wifi2 and wifi3 static ip text Adding text to the wifi2 and wifi3 sections to explain how DHCP and static ip addresses are available. --- package/recalbox-system/c2/recalbox.conf | 8 ++++++++ package/recalbox-system/rpi1/recalbox.conf | 8 ++++++++ package/recalbox-system/rpi2/recalbox.conf | 8 ++++++++ package/recalbox-system/rpi3/recalbox.conf | 8 ++++++++ package/recalbox-system/x86/recalbox.conf | 8 ++++++++ package/recalbox-system/x86_64/recalbox.conf | 8 ++++++++ package/recalbox-system/xu4/recalbox.conf | 8 ++++++++ 7 files changed, 56 insertions(+) diff --git a/package/recalbox-system/c2/recalbox.conf b/package/recalbox-system/c2/recalbox.conf index a59234c92d..a34e15801c 100644 --- a/package/recalbox-system/c2/recalbox.conf +++ b/package/recalbox-system/c2/recalbox.conf @@ -105,10 +105,18 @@ wifi.region=US # secondary wifi (not configurable via the user interface) ;wifi2.ssid=new ssid ;wifi2.key=new key +# defaults to dhcp. uncomment for static ip +;wifi2.ip=manual ip address +;wifi2.gateway=new gateway +;wifi2.netmask=new netmask # third wifi (not configurable via the user interface) ;wifi3.ssid=new ssid ;wifi3.key=new key +# defaults to dhcp. uncomment for static ip +;wifi3.ip=manual ip address +;wifi3.gateway=new gateway +;wifi3.netmask=new netmask ## Samba share system.samba.enabled=1 diff --git a/package/recalbox-system/rpi1/recalbox.conf b/package/recalbox-system/rpi1/recalbox.conf index 10a8b28e6f..ea76c6d080 100644 --- a/package/recalbox-system/rpi1/recalbox.conf +++ b/package/recalbox-system/rpi1/recalbox.conf @@ -125,10 +125,18 @@ wifi.region=US # secondary wifi (not configurable via the user interface) ;wifi2.ssid=new ssid ;wifi2.key=new key +# defaults to dhcp. uncomment for static ip +;wifi2.ip=manual ip address +;wifi2.gateway=new gateway +;wifi2.netmask=new netmask # third wifi (not configurable via the user interface) ;wifi3.ssid=new ssid ;wifi3.key=new key +# defaults to dhcp. uncomment for static ip +;wifi3.ip=manual ip address +;wifi3.gateway=new gateway +;wifi3.netmask=new netmask ## Samba share system.samba.enabled=1 diff --git a/package/recalbox-system/rpi2/recalbox.conf b/package/recalbox-system/rpi2/recalbox.conf index c771827679..a54dd4b33b 100644 --- a/package/recalbox-system/rpi2/recalbox.conf +++ b/package/recalbox-system/rpi2/recalbox.conf @@ -125,10 +125,18 @@ wifi.region=US # secondary wifi (not configurable via the user interface) ;wifi2.ssid=new ssid ;wifi2.key=new key +# defaults to dhcp. uncomment for static ip +;wifi2.ip=manual ip address +;wifi2.gateway=new gateway +;wifi2.netmask=new netmask # third wifi (not configurable via the user interface) ;wifi3.ssid=new ssid ;wifi3.key=new key +# defaults to dhcp. uncomment for static ip +;wifi3.ip=manual ip address +;wifi3.gateway=new gateway +;wifi3.netmask=new netmask ## Samba share system.samba.enabled=1 diff --git a/package/recalbox-system/rpi3/recalbox.conf b/package/recalbox-system/rpi3/recalbox.conf index c5ca3d1e09..69a510bb76 100644 --- a/package/recalbox-system/rpi3/recalbox.conf +++ b/package/recalbox-system/rpi3/recalbox.conf @@ -125,10 +125,18 @@ wifi.region=US # secondary wifi (not configurable via the user interface) ;wifi2.ssid=new ssid ;wifi2.key=new key +# defaults to dhcp. uncomment for static ip +;wifi2.ip=manual ip address +;wifi2.gateway=new gateway +;wifi2.netmask=new netmask # third wifi (not configurable via the user interface) ;wifi3.ssid=new ssid ;wifi3.key=new key +# defaults to dhcp. uncomment for static ip +;wifi3.ip=manual ip address +;wifi3.gateway=new gateway +;wifi3.netmask=new netmask ## Samba share system.samba.enabled=1 diff --git a/package/recalbox-system/x86/recalbox.conf b/package/recalbox-system/x86/recalbox.conf index fe27d14e79..7755b9d791 100644 --- a/package/recalbox-system/x86/recalbox.conf +++ b/package/recalbox-system/x86/recalbox.conf @@ -92,10 +92,18 @@ wifi.region=US # secondary wifi (not configurable via the user interface) ;wifi2.ssid=new ssid ;wifi2.key=new key +# defaults to dhcp. uncomment for static ip +;wifi2.ip=manual ip address +;wifi2.gateway=new gateway +;wifi2.netmask=new netmask # third wifi (not configurable via the user interface) ;wifi3.ssid=new ssid ;wifi3.key=new key +# defaults to dhcp. uncomment for static ip +;wifi3.ip=manual ip address +;wifi3.gateway=new gateway +;wifi3.netmask=new netmask ## Samba share system.samba.enabled=1 diff --git a/package/recalbox-system/x86_64/recalbox.conf b/package/recalbox-system/x86_64/recalbox.conf index 0f5063abe6..206cb91c3d 100644 --- a/package/recalbox-system/x86_64/recalbox.conf +++ b/package/recalbox-system/x86_64/recalbox.conf @@ -92,10 +92,18 @@ wifi.region=US # secondary wifi (not configurable via the user interface) ;wifi2.ssid=new ssid ;wifi2.key=new key +# defaults to dhcp. uncomment for static ip +;wifi2.ip=manual ip address +;wifi2.gateway=new gateway +;wifi2.netmask=new netmask # third wifi (not configurable via the user interface) ;wifi3.ssid=new ssid ;wifi3.key=new key +# defaults to dhcp. uncomment for static ip +;wifi3.ip=manual ip address +;wifi3.gateway=new gateway +;wifi3.netmask=new netmask ## Samba share system.samba.enabled=1 diff --git a/package/recalbox-system/xu4/recalbox.conf b/package/recalbox-system/xu4/recalbox.conf index 1285c3c582..a0b3a8b39b 100644 --- a/package/recalbox-system/xu4/recalbox.conf +++ b/package/recalbox-system/xu4/recalbox.conf @@ -105,10 +105,18 @@ wifi.region=US # secondary wifi (not configurable via the user interface) ;wifi2.ssid=new ssid ;wifi2.key=new key +# defaults to dhcp. uncomment for static ip +;wifi2.ip=manual ip address +;wifi2.gateway=new gateway +;wifi2.netmask=new netmask # third wifi (not configurable via the user interface) ;wifi3.ssid=new ssid ;wifi3.key=new key +# defaults to dhcp. uncomment for static ip +;wifi3.ip=manual ip address +;wifi3.gateway=new gateway +;wifi3.netmask=new netmask ## Samba share system.samba.enabled=1 -- GitLab