2014-03-05 04:40:35 +04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2014-03-13 06:36:31 +04:00
|
|
|
"github.com/coreos/coreos-cloudinit/third_party/github.com/guelfey/go.dbus"
|
2014-03-05 04:40:35 +04:00
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
conn, err := dbus.SessionBus()
|
|
|
|
if err != nil {
|
|
|
|
fmt.Fprintln(os.Stderr, "Failed to connect to session bus:", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, v := range []string{"method_call", "method_return", "error", "signal"} {
|
|
|
|
call := conn.BusObject().Call("org.freedesktop.DBus.AddMatch", 0,
|
|
|
|
"eavesdrop='true',type='"+v+"'")
|
|
|
|
if call.Err != nil {
|
|
|
|
fmt.Fprintln(os.Stderr, "Failed to add match:", call.Err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
c := make(chan *dbus.Message, 10)
|
|
|
|
conn.Eavesdrop(c)
|
|
|
|
fmt.Println("Listening for everything")
|
|
|
|
for v := range c {
|
|
|
|
fmt.Println(v)
|
|
|
|
}
|
|
|
|
}
|