From 853de1e2372037436a9aebb550e0f94cbfdd5a22 Mon Sep 17 00:00:00 2001 From: Matias Doyle Date: Wed, 15 Nov 2017 20:20:45 +0100 Subject: [PATCH] Emit non CTRL-* events as MESSAGE events And add a Line prop to the WPAEvent struct which contains the original line received from the wpa_supplicant. --- unixgram.go | 5 +++++ wpasupplicant.go | 1 + 2 files changed, 6 insertions(+) diff --git a/unixgram.go b/unixgram.go index 2795f80..5e187a6 100644 --- a/unixgram.go +++ b/unixgram.go @@ -178,12 +178,17 @@ func (uc *unixgramConn) readUnsolicited() { } if strings.Index(parts[0], "CTRL-") != 0 { + uc.wpaEvents <- WPAEvent{ + Event: "MESSAGE", + Line: data, + } continue } event := WPAEvent{ Event: strings.TrimPrefix(parts[0], "CTRL-EVENT-"), Arguments: make(map[string]string), + Line: data, } for _, args := range parts[1:] { diff --git a/wpasupplicant.go b/wpasupplicant.go index 5cd413c..cacaec9 100644 --- a/wpasupplicant.go +++ b/wpasupplicant.go @@ -165,6 +165,7 @@ func (s *statusResult) Address() string { return s.address } type WPAEvent struct { Event string Arguments map[string]string + Line string } // Conn is a connection to wpa_supplicant over one of its communication