PixlOne / logiops

An unofficial userspace driver for HID++ Logitech devices
GNU General Public License v3.0
3.38k stars 269 forks source link

Logid v0.3.2 crashes if a device disappears during startup #373

Closed S-trace closed 1 year ago

S-trace commented 1 year ago

Hi. I'd built the latest logiops (be840b3) and it's crashes on startup if a device (K850 Performance Wireless Keyboard) disappears during logid initialization:

sudo ./logid -v
[DEBUG] Unsupported device /dev/hidraw0 ignored
[INFO] Device found: Wireless Mouse MX Master 3 on /dev/hidraw1:255
[WARN] ScrollDown is not a direction
[WARN] ScrollUp is not a direction
[WARN] ScrollDown is not a direction
[WARN] ScrollUp is not a direction
[DEBUG] /dev/hidraw1:255 remappable buttons:
[DEBUG] CID  | reprog? | fn key? | mouse key? | gesture support?
[DEBUG] 0x50 |         |         | YES        | 
[DEBUG] 0x51 |         |         | YES        | 
[DEBUG] 0x52 | YES     |         | YES        | YES
[DEBUG] 0x53 | YES     |         | YES        | YES
[DEBUG] 0x56 | YES     |         | YES        | YES
[DEBUG] 0xc3 | YES     |         | YES        | YES
[DEBUG] 0xc4 | YES     |         | YES        | YES
[DEBUG] 0xd7 | YES     |         |            | YES
[DEBUG] Thumb wheel detected (0x2150), capabilities:
[DEBUG] timestamp | touch | proximity | single tap
[DEBUG] YES       | YES   | YES       | YES       
[DEBUG] Thumb wheel resolution: native (18), diverted (120)
terminate called after throwing an instance of 'std::runtime_error'
  what():  udev_device_new_from_syspath failed
zsh: IOT instruction  sudo ./logid -v

This can be triggered in the following way:

  1. Connect two devices (K850 Performance Wireless Keyboard and Wireless Mouse MX Master 3 in my case) over bluetooth.
  2. Run sudo ./logid -v
  3. Quickly turn off the keyboard
  4. Watch how logid crashes after initializing the mouse.

My good old logid v0.2.2-79-g7383c6f build works fine in this situation:

sudo logid -v
[DEBUG] Unsupported device /dev/hidraw0 ignored
[INFO] Device found: Wireless Mouse MX Master 3 on /dev/hidraw1:255
[WARN] Line 42: target is true but no up action was set, using default
[WARN] Line 42: target is true but no down action was set, using default
[WARN] Error adding device /dev/hidraw2: std::exception
[DEBUG] /dev/hidraw1:255 remappable buttons:
[DEBUG] CID  | reprog? | fn key? | mouse key? | gesture support?
[DEBUG] 0x50 |         |         | YES        | 
[DEBUG] 0x51 |         |         | YES        | 
[DEBUG] 0x52 | YES     |         | YES        | YES
[DEBUG] 0x53 | YES     |         | YES        | YES
[DEBUG] 0x56 | YES     |         | YES        | YES
[DEBUG] 0xc3 | YES     |         | YES        | YES
[DEBUG] 0xc4 | YES     |         | YES        | YES
[DEBUG] 0xd7 | YES     |         |            | YES
[DEBUG] Thumb wheel detected (0x2150), capabilities:
[DEBUG] timestamp | touch | proximity | single tap
[DEBUG] YES       | YES   | YES       | YES       
[DEBUG] Thumb wheel resolution: native (18), diverted (120)