mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-18 21:27:56 +00:00
pc_wifi: use wifi_config.inc helper
Introduce helper that does away with the redundant config generation snippets. Issue #5356.
This commit is contained in:
parent
31f9d414a3
commit
40f2b58098
70
repos/dde_linux/run/wifi_config.inc
Normal file
70
repos/dde_linux/run/wifi_config.inc
Normal file
@ -0,0 +1,70 @@
|
||||
#
|
||||
# This file includes snippets to generate the 'wifi_config' for the
|
||||
# various wireless LAN driver for each test run-script.
|
||||
#
|
||||
|
||||
proc wifi_ssid { } {
|
||||
return $::env(GENODE_WIFI_SSID)
|
||||
}
|
||||
|
||||
proc wifi_psk { } {
|
||||
return $::env(GENODE_WIFI_PSK)
|
||||
}
|
||||
|
||||
proc wifi_wpa { } {
|
||||
if {![info exists ::env(GENODE_WIFI_WPA)]} {
|
||||
return WPA2
|
||||
}
|
||||
return $::env(GENODE_WIFI_WPA)
|
||||
}
|
||||
|
||||
proc wifi_verbose { } {
|
||||
if {![info exists ::env(GENODE_WIFI_VERBOSE)]} {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
#
|
||||
# wifi-driver config generator (supporting a network list)
|
||||
#
|
||||
# You may script your tests with this function in the dynamic_rom config below.
|
||||
# The syntax for the networks parameter is
|
||||
#
|
||||
# { ssid protection passphrase auto_connect explicit_scan }
|
||||
#
|
||||
# Example dynamic_rom config:
|
||||
#
|
||||
# {<inline description="auto-connect both networks">
|
||||
# } [wifi_config 5 no [list "net1 WPA2 net1_psk yes no" "net2 WPA2 net2_psk yes no"]] {
|
||||
# </inline>
|
||||
# <inline description="aquto-connect both, but net2 explicitly">
|
||||
# } [wifi_config 5 no [list "net1 WPA2 net1_psk yes no" "net2 WPA2 net2_psk yes yes"]] {
|
||||
# </inline>}
|
||||
#
|
||||
|
||||
set wifi_verbose false
|
||||
|
||||
proc wifi_config { scan_interval update_quality_interval rfkill networks } {
|
||||
global wifi_verbose
|
||||
|
||||
set config "<wifi_config"
|
||||
append config " verbose=\"[wifi_verbose]\""
|
||||
append config " scan_interval=\"$scan_interval\""
|
||||
append config " update_quality_interval=\"$update_quality_interval\""
|
||||
append config " rfkill=\"$rfkill\""
|
||||
append config ">\n"
|
||||
foreach n $networks {
|
||||
append config " <network"
|
||||
append config " ssid=\"[lindex $n 0]\""
|
||||
append config " protection=\"[lindex $n 1]\""
|
||||
append config " passphrase=\"[lindex $n 2]\""
|
||||
append config " auto_connect=\"[lindex $n 3]\""
|
||||
append config " explicit_scan=\"[lindex $n 4]\""
|
||||
append config "/>\n"
|
||||
}
|
||||
append config "</wifi_config>\n"
|
||||
|
||||
return $config
|
||||
}
|
||||
|
@ -5,67 +5,7 @@
|
||||
#
|
||||
set debug_driver false
|
||||
|
||||
#
|
||||
# Configure wireless lan
|
||||
#
|
||||
|
||||
proc wifi_ssid { } {
|
||||
return $::env(GENODE_WIFI_SSID)
|
||||
}
|
||||
|
||||
proc wifi_psk { } {
|
||||
return $::env(GENODE_WIFI_PSK)
|
||||
}
|
||||
|
||||
proc wifi_wpa { } {
|
||||
if {![info exists ::env(GENODE_WIFI_WPA)]} {
|
||||
return WPA2
|
||||
}
|
||||
return $::env(GENODE_WIFI_WPA)
|
||||
}
|
||||
|
||||
#
|
||||
# wifi-driver config generator (supporting a network list)
|
||||
#
|
||||
# You may script your tests with this function in the dynamic_rom config below.
|
||||
# The syntax for the networks parameter is
|
||||
#
|
||||
# { ssid protection passphrase auto_connect explicit_scan }
|
||||
#
|
||||
# Example dynamic_rom config:
|
||||
#
|
||||
# {<inline description="auto-connect both networks">
|
||||
# } [wifi_config 5 no [list "net1 WPA2 net1_psk yes no" "net2 WPA2 net2_psk yes no"]] {
|
||||
# </inline>
|
||||
# <inline description="aquto-connect both, but net2 explicitly">
|
||||
# } [wifi_config 5 no [list "net1 WPA2 net1_psk yes no" "net2 WPA2 net2_psk yes yes"]] {
|
||||
# </inline>}
|
||||
|
||||
set wifi_verbose false
|
||||
|
||||
proc wifi_config { scan_interval update_quality_interval rfkill networks } {
|
||||
global wifi_verbose
|
||||
global wifi_verbose_state
|
||||
|
||||
set config "<wifi_config"
|
||||
append config " verbose=\"$wifi_verbose\""
|
||||
append config " scan_interval=\"$scan_interval\""
|
||||
append config " update_quality_interval=\"$update_quality_interval\""
|
||||
append config " rfkill=\"$rfkill\""
|
||||
append config ">\n"
|
||||
foreach n $networks {
|
||||
append config " <network"
|
||||
append config " ssid=\"[lindex $n 0]\""
|
||||
append config " protection=\"[lindex $n 1]\""
|
||||
append config " passphrase=\"[lindex $n 2]\""
|
||||
append config " auto_connect=\"[lindex $n 3]\""
|
||||
append config " explicit_scan=\"[lindex $n 4]\""
|
||||
append config "/>\n"
|
||||
}
|
||||
append config "</wifi_config>\n"
|
||||
|
||||
return $config
|
||||
}
|
||||
source ${genode_dir}/repos/dde_linux/run/wifi_config.inc
|
||||
|
||||
#
|
||||
# Restrict platforms
|
||||
|
Loading…
Reference in New Issue
Block a user