2024-10-08 09:30:40 +00:00
|
|
|
#
|
|
|
|
# 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 {
|
2024-10-07 15:16:18 +00:00
|
|
|
if {[lindex $n 4] == "yes"} {
|
|
|
|
append config " <explicit_scan ssid=\"[lindex $n 0]\"/>\n"
|
|
|
|
}
|
2024-10-08 09:30:40 +00:00
|
|
|
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 "/>\n"
|
|
|
|
}
|
|
|
|
append config "</wifi_config>\n"
|
|
|
|
|
|
|
|
return $config
|
|
|
|
}
|
|
|
|
|