Re: dbus-monitor shows irrelevant lines

Thiago Macieira <[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Message-ID <6013414.veazbkxay0@tjmaciei-mobl1>
On Sunday, 5 April 2020 07:22:50 -03 Jaakko Luttinen wrote:
> ```
> dbus-monitor: unable to enable new-style monitoring:
> org.freedesktop.DBus.Error.AccessDenied: "Rejected send message, 1
> matched rules; type="method_call", sender=":1.277" (uid=1000 pid=27124
> comm="dbus-monitor --system --profile interface=org.free"
> label="kernel") interface="org.freedesktop.DBus.Monitoring"
> member="BecomeMonitor" error name="(unset)" requested_reply="0"
> destination="org.freedesktop.DBus" (bus)". Falling back to eavesdropping.
> Received the following signal:
> #type timestamp serial sender destination path interface member
> Received the following signal:
> # in_reply_to
> Received the following signal:
> sig 1586080954.876039 2 org.freedesktop.DBus :1.277
> /org/freedesktop/DBus org.freedesktop.DBus NameAcquired
> ```
> 
> These signals have nothing to do with the signals I told dbus-monitor to
> watch. So, why am I receiving them?

Because those were received by dbus-monitor. Those are directed signals 
(signals with a destination) and were sent by the bus itself the moment dbus-
monitor connected. That happens to ALL connections.

>  How can I not receive them?

You cannot. They are always sent.

> If I
> would put actual screenlocking code inside that while loop, my screen
> would have been locked three times when I just start monitoring locking
> signals - that doesn't make sense. So, how can I make dbus-monitor to
> only show lines that I'm asking it to show?

You cannot. It displays everything that the bus sent in the connection. 
Directed messages (method calls, errors, replies and signals with destination) 
do not require filters.

You need to parse the lines output to determine what was received.

> Or if you have better solutions for the original goal in the first
> place, I'm eager to hear.

Write a proper script or application. Don't abuse dbus-monitor.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.