Describe the bug
I have a wireless Logitech mouse with a dongle attached to the KVM. The mouse itself has a battery reporting capability. Switching KVM to another device might sporadically cause Waybar to crash, even if the device isn't used in config at all.
To reproduce
- Have an USB device with power reporting capability;
- Remove the device on the fly.
Expected behaviour
Gracefully handle removal of a device with a battery.
Environment
- Waybar version (
waybar --version): Waybar v0.15.0
- Installed from (distro package / source / other): Arch/extra repo
- Compositor and version (Sway, Hyprland, River, …): Hyprland 0.56.2
Debug output
<...>
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
Not charging
terminate called after throwing an instance of 'std::runtime_error'
what(): Could not watch events for /sys/class/power_supply/hidpp_battery_18
---gdb backtrace---
#0 0x00007ffff609a01c in ??? () at /usr/lib/libc.so.6
#1 0x00007ffff603e5d0 in raise () at /usr/lib/libc.so.6
#2 0x00007ffff6025685 in abort () at /usr/lib/libc.so.6
#3 0x00007ffff649ac54 in ??? () at /usr/lib/libstdc++.so.6
#4 0x00007ffff64b58ba in ??? () at /usr/lib/libstdc++.so.6
#5 0x00007ffff649a5ed in std::terminate() () at /usr/lib/libstdc++.so.6
#6 0x00007ffff64b5b76 in __cxa_throw () at /usr/lib/libstdc++.so.6
#7 0x000055555558696e in waybar::modules::Battery::refreshBatteries (this=0x5555558f2740) at /usr/include/c++/15.2.1/bits/allocator.h:189
#8 0x00005555556288e2 in operator() (__closure=0x55555596d8e0) at ../src/modules/battery.cpp:94
#9 std::__invoke_impl<void, waybar::modules::Battery::worker()::<lambda()>&> (__f=...) at /usr/include/c++/15.2.1/bits/invoke.h:63
#10 std::__invoke_r<void, waybar::modules::Battery::worker()::<lambda()>&> (__fn=...) at /usr/include/c++/15.2.1/bits/invoke.h:113
#11 std::_Function_handler<void(), waybar::modules::Battery::worker()::<lambda()> >::_M_invoke(const std::_Any_data &) (__functor=...) at /usr/include/c++/15.2.1/bits/std_function.h:292
#12 0x00005555555e63d6 in std::function<void()>::operator() (this=0x55555596d8e0) at /usr/include/c++/15.2.1/bits/std_function.h:593
#13 waybar::util::SleeperThread::operator=(std::function<void ()>)::{lambda()#1}::operator()() const (__closure=0x55555596d8d8) at ../include/util/sleeper_thread.hpp:48
#14 std::__invoke_impl<void, waybar::util::SleeperThread::operator=(std::function<void ()>)::{lambda()#1}>(std::__invoke_other, waybar::util::SleeperThread::operator=(std::function<void ()>)::{lambda()#1}&&) (__f=...) at /usr/include/c++/15.2.1/bits/invoke.h:63
#15 std::__invoke<waybar::util::SleeperThread::operator=(std::function<void ()>)::{lambda()#1}>(waybar::util::SleeperThread::operator=(std::function<void ()>)::{lambda()#1}&&) (__fn=...) at /usr/include/c++/15.2.1/bits/invoke.h:98
#16 std::thread::_Invoker<std::tuple<waybar::util::SleeperThread::operator=(std::function<void ()>)::{lambda()#1}> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) (this=0x55555596d8d8) at /usr/include/c++/15.2.1/bits/std_thread.h:303
#17 std::thread::_Invoker<std::tuple<waybar::util::SleeperThread::operator=(std::function<void ()>)::{lambda()#1}> >::operator()() (this=0x55555596d8d8) at /usr/include/c++/15.2.1/bits/std_thread.h:310
#18 std::thread::_State_impl<std::thread::_Invoker<std::tuple<waybar::util::SleeperThread::operator=(std::function<void ()>)::{lambda()#1}> > >::_M_run() (this=0x55555596d8d0) at /usr/include/c++/15.2.1/bits/std_thread.h:255
#19 0x00007ffff64ea919 in ??? () at /usr/lib/libstdc++.so.6
#20 0x00007ffff6097f42 in ??? () at /usr/lib/libc.so.6
#21 0x00007ffff611efac in ??? () at /usr/lib/libc.so.6
I might look deeper into this later myself.
Describe the bug
I have a wireless Logitech mouse with a dongle attached to the KVM. The mouse itself has a battery reporting capability. Switching KVM to another device might sporadically cause Waybar to crash, even if the device isn't used in config at all.
To reproduce
Expected behaviour
Gracefully handle removal of a device with a battery.
Environment
waybar --version): Waybar v0.15.0Debug output
I might look deeper into this later myself.