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.
This commit is contained in:
Matias Doyle 2017-11-15 20:20:45 +01:00
parent 676121199d
commit 853de1e237
2 changed files with 6 additions and 0 deletions

View File

@ -178,12 +178,17 @@ func (uc *unixgramConn) readUnsolicited() {
} }
if strings.Index(parts[0], "CTRL-") != 0 { if strings.Index(parts[0], "CTRL-") != 0 {
uc.wpaEvents <- WPAEvent{
Event: "MESSAGE",
Line: data,
}
continue continue
} }
event := WPAEvent{ event := WPAEvent{
Event: strings.TrimPrefix(parts[0], "CTRL-EVENT-"), Event: strings.TrimPrefix(parts[0], "CTRL-EVENT-"),
Arguments: make(map[string]string), Arguments: make(map[string]string),
Line: data,
} }
for _, args := range parts[1:] { for _, args := range parts[1:] {

View File

@ -165,6 +165,7 @@ func (s *statusResult) Address() string { return s.address }
type WPAEvent struct { type WPAEvent struct {
Event string Event string
Arguments map[string]string Arguments map[string]string
Line string
} }
// Conn is a connection to wpa_supplicant over one of its communication // Conn is a connection to wpa_supplicant over one of its communication