htrefil / rkvm

Virtual KVM switch for Linux machines
MIT License
386 stars 50 forks source link

rkvm-server not work on kde wayland #43

Closed I-Want-ToBelieve closed 11 months ago

I-Want-ToBelieve commented 11 months ago

Mouse and keyboard not responding to anything while running rkvm-server

terminal 1:

sleep 5; sudo -E ./rkvm-server ./server.toml --shutdown-after 30
[INFO  rkvm_server::server] Listening on 0.0.0.0:5258
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event31 at /dev/input/event256
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event30 at /dev/input/event257
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event18 at /dev/input/event258
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event11 at /dev/input/event259
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event10 at /dev/input/event260
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event9 at /dev/input/event261
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event8 at /dev/input/event262
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event7 at /dev/input/event263
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event6 at /dev/input/event264
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event5 at /dev/input/event265
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event4 at /dev/input/event266
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event3 at /dev/input/event267
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event2 at /dev/input/event268
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event1 at /dev/input/event269
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event0 at /dev/input/event270
[INFO  rkvm_input::event_writer] Registered virtual device at /dev/input/event271
[INFO  rkvm_server] Shutting down as requested

The virtual device actually works but kde wayland doesn't seem to recognize the newly added device

terminal 2:

 sleep 5; sudo -E evtest --grab /dev/input/event271
Input driver version is 1.0.1
Input device ID: bus 0x6 vendor 0x0 product 0x0 version 0x0
Input device name: "rkvm"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 1 (KEY_ESC)
    Event code 2 (KEY_1)
    Event code 3 (KEY_2)
    Event code 4 (KEY_3)
    Event code 5 (KEY_4)
    Event code 6 (KEY_5)
    Event code 7 (KEY_6)
    Event code 8 (KEY_7)
    Event code 9 (KEY_8)
    Event code 10 (KEY_9)
...
    Event code 720 (BTN_TRIGGER_HAPPY17)
    Event code 721 (BTN_TRIGGER_HAPPY18)
    Event code 722 (BTN_TRIGGER_HAPPY19)
    Event code 723 (BTN_TRIGGER_HAPPY20)
    Event code 724 (BTN_TRIGGER_HAPPY21)
    Event code 725 (BTN_TRIGGER_HAPPY22)
    Event code 726 (BTN_TRIGGER_HAPPY23)
    Event code 727 (BTN_TRIGGER_HAPPY24)
    Event code 728 (BTN_TRIGGER_HAPPY25)
    Event code 729 (BTN_TRIGGER_HAPPY26)
    Event code 730 (BTN_TRIGGER_HAPPY27)
    Event code 731 (BTN_TRIGGER_HAPPY28)
    Event code 732 (BTN_TRIGGER_HAPPY29)
    Event code 733 (BTN_TRIGGER_HAPPY30)
    Event code 734 (BTN_TRIGGER_HAPPY31)
    Event code 735 (BTN_TRIGGER_HAPPY32)
    Event code 736 (BTN_TRIGGER_HAPPY33)
    Event code 737 (BTN_TRIGGER_HAPPY34)
    Event code 738 (BTN_TRIGGER_HAPPY35)
    Event code 739 (BTN_TRIGGER_HAPPY36)
    Event code 740 (BTN_TRIGGER_HAPPY37)
    Event code 741 (BTN_TRIGGER_HAPPY38)
    Event code 742 (BTN_TRIGGER_HAPPY39)
    Event code 743 (BTN_TRIGGER_HAPPY40)
    Event code 744 (?)
    Event code 745 (?)
    Event code 746 (?)
 ...
    Event code 764 (?)
    Event code 765 (?)
    Event code 766 (?)
  Event type 2 (EV_REL)
    Event code 0 (REL_X)
    Event code 1 (REL_Y)
    Event code 2 (REL_Z)
    Event code 3 (REL_RX)
    Event code 4 (REL_RY)
    Event code 5 (REL_RZ)
    Event code 6 (REL_HWHEEL)
    Event code 7 (REL_DIAL)
    Event code 8 (REL_WHEEL)
    Event code 9 (REL_MISC)
    Event code 10 (?)
    Event code 11 (REL_WHEEL_HI_RES)
    Event code 12 (REL_HWHEEL_HI_RES)
    Event code 13 (?)
    Event code 14 (?)
    Event code 15 (?)
Properties:
Testing ... (interrupt to exit)
Event: time 1691915113.054801, type 1 (EV_KEY), code 32 (KEY_D), value 1
Event: time 1691915113.054801, -------------- SYN_REPORT ------------
Event: time 1691915113.234780, type 1 (EV_KEY), code 31 (KEY_S), value 1
Event: time 1691915113.234780, -------------- SYN_REPORT ------------
Event: time 1691915113.257703, type 1 (EV_KEY), code 32 (KEY_D), value 0
Event: time 1691915113.257703, -------------- SYN_REPORT ------------
Event: time 1691915113.324729, type 1 (EV_KEY), code 30 (KEY_A), value 1
Event: time 1691915113.324729, -------------- SYN_REPORT ------------
Event: time 1691915113.471711, type 1 (EV_KEY), code 30 (KEY_A), value 0
Event: time 1691915114.224812, -------------- SYN_REPORT ------------
Event: time 1691915114.235740, type 1 (EV_KEY), code 31 (KEY_S), value 1
...
Event: time 1691915136.070495, -------------- SYN_REPORT ------------
Event: time 1691915136.080387, type 2 (EV_REL), code 1 (REL_Y), value 1
Event: time 1691915136.080387, -------------- SYN_REPORT ------------
Event: time 1691915136.100382, type 2 (EV_REL), code 11 (REL_WHEEL_HI_RES), value -120
Event: time 1691915136.100382, -------------- SYN_REPORT ------------
Event: time 1691915136.121438, type 2 (EV_REL), code 1 (REL_Y), value 1
Event: time 1691915136.121438, -------------- SYN_REPORT ------------
...
Event: time 1691915136.328535, -------------- SYN_REPORT ------------
Event: time 1691915136.513581, type 2 (EV_REL), code 1 (REL_Y), value -1
Event: time 1691915136.513581, -------------- SYN_REPORT ------------
expected 24 bytes, got -1

evtest: error reading: No such device
I-Want-ToBelieve commented 11 months ago

It seems that kde still recognizes two new devices with the same name as the previous mouse and keyboard

But does not contain the Input device name: "rkvm"

Before: 2023-08-13_17-15

After: Screenshot_20230813_165356

I-Want-ToBelieve commented 11 months ago

I noticed that ydotool can work well, maybe refer to the implementation of ydotoold

https://github.com/ReimuNotMoe/ydotool/blob/57ba7d0af525e82da2de0e275d169477f293b197/Daemon/ydotoold.c#L104

rkvm on  master [!+?] via 🦀 v1.71.1 via ❄️  impure (rkvm-devel-env) 
❯ sudo -E sleep 5;sudo -E evtest --grab /dev/input/event29
Input driver version is 1.0.1
Input device ID: bus 0x6 vendor 0x2333 product 0x6666 version 0x1
Input device name: "ydotoold virtual device"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 1 (KEY_ESC)
    Event code 2 (KEY_1)
    Event code 3 (KEY_2)
    Event code 4 (KEY_3)
    Event code 5 (KEY_4)
I-Want-ToBelieve commented 11 months ago

The master branch is work well