holylobster / nuntius-linux

Nuntius delivers notifications from your phone or tablet to your computer
GNU General Public License v2.0
216 stars 25 forks source link

Spams journal if bluetooth if off #75

Open gcampax opened 6 years ago

gcampax commented 6 years ago

When bluetooth is off, nuntius produces a large number of messages of the form:

nuntius[2146]: application.vala:229: Error connecting to device 'XXX': GDBus.Error:org.bluez.Error.NotReady: Resource Not Ready

While ideally nuntius would be completely quiet when bluetooth is off, it would be nice at least to avoid the message, which adds noise to the logs (hiding other more important info) and causes useless disk wear.

nacho commented 6 years ago

Do we have any dbus message that we can hook into to understand when bluetooth is off?

gcampax commented 6 years ago

One option is to look at rfkill (either directly with /dev/rfkill, or by looking at org.gnome.SettingsDaemon.Rfkill)

On the system bus side, bluez esposes the Powered property on org.bluez1.Adapter, which is false if bluetooth is off. I don't know if property notifications are reliable for it though.

a2nt commented 5 years ago

I have the same issue with bluetooth on:

Sep 13 21:32:16 localhost bluetoothd[1362]: Unable to get Serial Port SDP record: Host is down
Sep 13 21:32:16 localhost nuntius[5856]: application.vala:397: Error connecting to device 'Dexp BT-280': GDBus.Error:org.bluez.Error.Failed: Host is down
Sep 13 21:32:22 localhost org.holylobster.nuntius[1617]: connect device: Mi A1
Sep 13 21:32:22 localhost nuntius[5856]: application.vala:397: Error connecting to device 'Mi A1': GDBus.Error:org.bluez.Error.InProgress: In Progress
Sep 13 21:32:22 localhost org.holylobster.nuntius[1617]: connect device: RAPOO BT3.0 Mouse
Sep 13 21:32:27 localhost bluetoothd[1362]: 6C:5D:63:76:9D:6C: error updating services: Host is down (112)
Sep 13 21:32:27 localhost nuntius[5856]: application.vala:397: Error connecting to device 'RAPOO BT3.0 Mouse': GDBus.Error:org.bluez.Error.Failed: Host is down

It tries to connect everything including BT headphones and mouse, I think it shall check if the phone is connected without spamming into syslog.