mirror of
https://github.com/taigrr/golang-wpasupplicant
synced 2025-01-18 04:43:18 -08:00
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:
parent
676121199d
commit
853de1e237
@ -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:] {
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user