jmd pushed a commit to branch wip-installer
in repository guix.
commit 98d0b24a68457c3840a1dbe773bd84e29ebeedf2
Author: John Darrington <[email protected]>
Date: Wed Jan 18 15:01:53 2017 +0100
installer: Distinguish between Wifi encryption methods.
* gnu/system/installer/wireless.scm (get-wifi): Return a symbol in
the encryption field to indicaate the encryption type.
---
gnu/system/installer/wireless.scm | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/gnu/system/installer/wireless.scm
b/gnu/system/installer/wireless.scm
index e26b257..5c47d22 100644
--- a/gnu/system/installer/wireless.scm
+++ b/gnu/system/installer/wireless.scm
@@ -136,9 +136,10 @@
#:disp-proc
(lambda (d _)
(format #f "~30a ~a" (assq-ref d 'essid)
- (if (assq-ref d 'encryption)
- (M_ "Encr.")
- (M_ "Clear")))))))
+ (or
+ (and=> (assq-ref d 'encryption)
+ symbol->string)
+ (M_ "clear")))))))
(addstr* text-window (format #f
(gettext
@@ -197,9 +198,20 @@
(cons
(append (car prev)
(list `(encryption .
- ,(string-suffix? "on" x))))
+ ;; Assume WEP encryption until we
know
+ ;; otherwise.
+ ,(if (string-suffix? "on" x) 'wep
#f))))
(cdr prev)))
+ ((string-match "^IE: *IEEE 802.11i" x)
+ ;; If we find the above string, and encryption is on, then the
encrpytion
+ ;; type is probably WPA2
+ (let ((current-ap (car prev)))
+ (if (assq-ref current-ap 'encryption)
+ (cons (assq-set! current-ap 'encryption 'wpa2)
+ (cdr prev))
+ prev)))
+
((string-prefix? "Quality=" x)
(let ((lvl (string-match "level=(-?[0-9][0-9]*) dBm" x)))
(if lvl