Code Monkey home page Code Monkey logo

rkvm's Introduction

rkvm

rkvm

rkvm is a tool for sharing keyboard and mouse across multiple Linux machines. It is based on a client/server architecture, where server is the machine controlling mouse and keyboard and relays events (mouse move, key presses, ...) to clients.

Switching between different clients is done by a configurable keyboard shortcut.

Features

  • TLS encrypted by default, backed by rustls
  • Display server agnostic (in fact, it doesn't require a display server at all)
  • Low overhead

Requirements

  • The uinput Linux kernel module, enabled by default in most distros. You can confirm that it's enabled in your distro by checking that /dev/uinput exists.
  • libevdev development files (sudo apt install libevdev-dev on Debian/Ubuntu)
  • Clang/LLVM (sudo apt install clang on Debian/Ubuntu)

Manual installation

If you can, it is strongly recommended to use the AUR package to install rkvm.
Note that the master branch can contain untested and breaking changes - for regular use, it is recommended to pick the latest release instead.

$ cargo build --release
# cp target/release/rkvm-client /usr/bin/
# cp target/release/rkvm-server /usr/bin/
# cp target/release/rkvm-certificate-gen /usr/bin/ # Optional
# cp systemd/rkvm-client.service /usr/lib/systemd/system/
# cp systemd/rkvm-server.service /usr/lib/systemd/system/

Configuration

After installation:

  • Generate a certificate and private key using the rkvm-certificate-gen tool or provide your own from other sources.

  • For server, place both the certificate and private key in /etc/rkvm/certificate.pem and /etc/rkvm/key.pem respectively.

  • For client, place the certificate to /etc/rkvm/certificate.pem.

  • Create a config if you haven't done so already.
    Server:

    # cp /usr/share/rkvm/examples/server.toml /etc/rkvm/server.toml
    

    Client:

    # cp /usr/share/rkvm/examples/client.toml /etc/rkvm/client.toml
    

    Do not edit the example configs, they will be overwritten by your package manager.

  • Change the password and optionally reconfigure the network listen address and key bindings for switching clients

  • Since rkvm-server grabs all input, i's a good idea to do a test run first to make sure you won't end up being unable to user your keyboard and/or mouse because your display server is not properly configured to receive input from rkvm.

    Run the following command to start rkvm-server for 15 seconds to test that your keyboard, mouse, etc. works properly:

    # rkvm-server /etc/rkvm/server.toml --shutdown-after 15
    
  • Enable and start the systemd service.
    Server:

    # systemctl enable rkvm-server
    # systemctl start rkvm-server
    

    Client:

    # systemctl enable rkvm-client
    # systemctl start rkvm-client
    

Why rkvm and not Barrier/Synergy?

The author of this program had a lot of problems with said programs, namely his keyboard layout (Czech) not being supported properly, which stems from the fact that the programs send characters which it then attempts to translate back into keycodes. rkvm takes a different approach to solving this problem and doesn't assume anything about your keyboard layout -- it sends raw keycodes only.

Additionally, rkvm doesn't even know or care about X, Wayland or any display server that might be in use, because it uses the uinput API with libevdev to read and generate input events.

Regardless, if you want a working and stable solution for crossplatform keyboard and mouse sharing, you should probably use either of the above mentioned programs for the time being.

Limitations

  • Linux only

Project structure

  • rkvm-server - server application code
  • rkvm-client - client application code
  • rkvm-input - handles reading from and writing to input devices
  • rkvm-net - network protocol encoding and decoding
  • rkvm-certificate-gen - certificate generation tool

Bincode is used for encoding of messages on the network and Tokio as an asynchronous runtime.

Contributions

All contributions, that includes both PRs and issues, are very welcome.

Donations

If you find rkvm useful, you can donate to the original author and maintainer using Ko-fi.

License

MIT

rkvm's People

Contributors

ckiee avatar colemickens avatar h4ssi avatar htrefil avatar jian-lin avatar kaapstorm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rkvm's Issues

Donation ?

Hey,

rkvm works brilliantly since the last update. It has no issue with trackpads anymore and even gestures work perfectly!

Is there any way I can make a donation? You solved a big headache of mine since input-leap isn't compatible with Sway, and your solution also works with login screens.

Many many thanks

rkvm-server not work on kde wayland

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

INFO rkvm_server::server: Listening on 0.0.0.0:5258 ERROR rkvm_server: Error: Input error: No such device (os error 19)

ls /dev/uinput 
crw------- 1 root root 10, 223 Dec 23 10:38 /dev/uinput

Installed from UAR on EndeavourOS
rkvm-server appears to be restarting and restarting, I think because PID changes every time I check status.
I believe the config files are correct. Firewalls are OK for selected port.

systemctl status rkvm-server
● rkvm-server.service - rkvm server
     Loaded: loaded (/usr/lib/systemd/system/rkvm-server.service; disabled; preset: disabled)
     Active: activating (auto-restart) (Result: exit-code) since Fri 2024-01-05 12:13:59 CST; 3s ago
    Process: 169854 ExecStart=/usr/bin/rkvm-server /etc/rkvm/server.toml (code=exited, status=1/FAILURE)
   Main PID: 169854 (code=exited, status=1/FAILURE)
        CPU: 6ms

OS: EndeavourOS Linux x86_64
Host: HP ProDesk 400 G5 Desktop Mini
Kernel: 6.6.7-arch1-1
WM: wayfire
x86_64 GNU/Linux

trigger script after switch?

very cool software, tried USB/IP prior, rkvm works nicely thus far.

so, I'd like to trigger script execution after switching, namely I'd like to use ddcutil to switch the monitor over (got two devices attached to same monitor), any pointers on how to accomplish it?

Consider moving config examples in `/usr/share` and make them readable by non-root users, and suggest putting config files in $XDG_CONFIG_HOME

Hello,

I see that the instructions suggest to put configuration files and certificates in /etc/ which is very confusing, and seems unnecessary? Especially the fact that the configuration file is not readable for non-root users.

I was wondering if there is a rationale behind this choice when Synergy/Input-Leap do just fine with configuration files in user directories. Maybe because you have a password in the configuration file but then why having a password when you could manage access using keys and certificates instead?

It's not like it's a deal breaker at all but config examples are conventionally located in directories like /usr/share/rkvm/examples or /usr/share/doc/rkvm/examples and readable by non-root users.

Anyway, thanks for the effort, really appreciate your work :)

Regards,
Jules

Enter key not working when software is running

Great little tool!

I have one small issue: As soon as I start the server, my enter key stops working. I can see that in the console, the output is scrolling, as if the enter key is always pressing down.

Connectivity issues after the server reboots, goes on sleep, etc.

Hi,

I noticed quite a few times that the client often fails to reconnect when a server comes back up after a reboot or being suspended. I often have to restart either or both the client and server for the system to work again. Could be a dangling socket or something like that, I'm not sure yet.

I don't have logs extracts yet but I'll produce them soon.

Regards,
Jules

invalid peer certificate: UnknownIssuer

Im probably doing something wrong, but when I attempt to connect to the server, the client gives the error: invalid peer certificate: UnknownIssuer and the server gives: received fatal alert: UnknownCA

As Im still learning all this, I believe I've probably messed up the cert gen side of things, but I'm not sure how and I've tried many different combos.

[ERROR server] Error: No such device (os error 19)

I keep getting this error. When trying to open a server with cargo run --bin server this is what the cli shows me. I have generated the certificates accordingly so I just don't know what im doing wrong. I'm on swaywm Wayland btw

switch keys remain pressed

I use rkvm (ec11f26) between my desktop (server) and laptop (client) and if I have recently toggled from the laptop back to the desktop the switch keys remain active on the client. This means whilst this is occuring, any attempt to use the physical keyboard on the laptop, those proxied keys are still active too.

I am sticking with the defaults (switch-keys = ["LeftAlt", "LeftCtrl"]) and by running evtest on the client as you do the switch the value of the key(s) remains set to one (ie. pressed).

Maybe return the switch keys back to a unset state after a switch is the solution here?

keyboard repeat in vterm not working

If i connect to a remote linux instance (fedora38, wayland) to a GUI, the keyboard connected to the server sends 'auto-repeat' characters if i press a key long enough (as totally expected).
But, if i switch to a vterm on the target (Ctrl-Alt-3, 4, ...) in text-only mode, the keyboard does not send repeats. Single key events are transported properly.

Any idea how to fix this?

Build fails due to missing OpenSSL

Either from AUR or when trying to build from source (same thing, I know), the package fails to be built.
It prints in stdout: Failed to find OpenSSL development header even though OpenSSL is installed.
System: Arch Linux
OpenSSL version: OpenSSL 3.0.8 7 Feb 2023 (Library: OpenSSL 3.0.8 7 Feb 2023)

Issues building on Ubuntu 22.04

Building this in a ubuntu:jammy docker image. After running apt-get update ; apt-get -y install cargo clang libevdev-dev build-essential pkg-config I get this error. Any ideas?

   Compiling futures-executor v0.3.28
   Compiling futures v0.3.28
   Compiling inotify v0.10.0
   Compiling tokio-rustls v0.24.0
   Compiling smallvec v1.10.0
   Compiling bincode v1.3.3
   Compiling toml v0.5.11
error[E0531]: cannot find unit struct, unit variant or constant `ABS_PROFILE` in module `glue`
  --> rkvm-input/src/abs.rs:84:19
   |
84 |             glue::ABS_PROFILE => Self::Profile,
   |                   ^^^^^^^^^^^ not found in `glue`

error[E0425]: cannot find value `ABS_PROFILE` in module `glue`
   --> rkvm-input/src/abs.rs:133:36
    |
133 |             Self::Profile => glue::ABS_PROFILE,
    |                                    ^^^^^^^^^^^ not found in `glue`

Some errors have detailed explanations: E0425, E0531.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `rkvm-input` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
root@016e282a05bf:/workspace# \

Add option for non-tls operation

I've been trying to set up a Linux server <=> Windows clients environment but every time I try to connect with a client I get:
Error: Failed to connect: The certificate's CN name does not match the passed value. (os error -2146762481)
(error constant name: CERT_E_CN_NO_MATCH)

I've already tried generating various certificates with different altNames (IP and DNS) but nothing worked.

I realize this is probably not an issue with this crate, but I'd still like to request an option to run the server without requiring a certificate.

For a quick and dirty workaround I disabled

rkvm/client/src/main.rs

Lines 34 to 37 in bf13366

let mut stream = connector
.connect(server, stream)
.await
.context("Failed to connect")?;
and

rkvm/server/src/main.rs

Lines 85 to 91 in bf13366

let stream = match acceptor.accept(stream).await {
Ok(stream) => stream,
Err(err) => {
log::error!("{}: TLS error: {}", address, err);
continue;
}
};
, but a proper configurable implementation would be obviously preferred.

Improve logging for "switched to client" message

This is mostly a usability issue, not a technical one.

Currently, I have to override RUST_LOG in order to see that the daemon detected my switch-keys and changed client. Compared to the other log messages, I believe this log message is equally important, and should be changed to a tracing::info.

Another change that would be nice, maybe the logs could use something more identifying than the client index? The hostname of the client would be optimal, but probably requires protocol changes. An alternative would be the clients IP address. It seems relatively trivial to store the address along with its mpsc sender. Not sure if this introduces any security risks though.

The relevant line:

tracing::debug!("Switched to client {}", current);

Current log output:

[INFO  rkvm_server::server] 192.168.50.230:42178: Connected
[DEBUG rustls::server::hs] decided upon suite TLS13_AES_256_GCM_SHA384
[INFO  rkvm_server::server] 192.168.50.230:42178: TLS connected
[INFO  rkvm_server::server] 192.168.50.230:42178: Authenticated successfully
[DEBUG rkvm_server::server] Switched to client 1
[DEBUG rkvm_server::server] Switched to client 0

I don't mind creating a PR if I'm given green lights!

Can I borrow some ideas?

You may recognise me from the Barrier project - the codebase is currently in C++, and I think it will remain so, but I'd still like it to be in Rust. My KVM - Hurdle - has been put on hold, but I'm thinking of restarting it again, perhaps to merge into Barrier, should things change. I doubt it though, but Hurdle is merely a hobbyist project right now.

Would you mind if I borrowed some ideas/concepts/code from rkvm? Hurdle is licensed under MIT - it's not in the repo yet, but it will be.

Thanks.

Touchpad, xbox controllers, and probably more input devices does not work

Something weird is happening when server uses touchpad or controllers.

Touchpad seams to not work at all, and controllers have messed up events (buttons do not work at all, axis work but messed up).

I'll try to debug this in spare time, but for now I want to raise awareness that those are not compatible, as I spend 2 days debugging drivers for controllers.

rkvm panics when starting the server on linux

[INFO  server] Listening on 0.0.0.0:50258
thread 'main' panicked at 'there is no timer running, must be called from the context of Tokio runtime', /build/rkvm-unstable-ec404c69b38f7feff5103f898612734ee8d7ee95-vendor.tar.gz/tokio-0.3.6/src/time/driver/handle.rs:50:18
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::option::expect_failed
   3: tokio::time::driver::handle::Handle::current
   4: tokio::time::driver::sleep::Sleep::new_timeout
   5: server::run::{{closure}}
   6: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   7: tokio::runtime::enter::Enter::block_on
   8: tokio::runtime::thread_pool::ThreadPool::block_on
   9: tokio::runtime::Runtime::block_on
  10: server::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

This is what I get if I try to start the server with a config file that looks very similar to the example one in this repo.

Hide mouse pointer on non-focused clients

There is currently no indication of which client the inputs will be directed at. I keep having to do circles with my mouse to know where I’m at. Synergy hides the cursor on all but the currently focused client, and that gives a nice visual hint, which is immediately understood as it behaves as if all screens were a connected to a single computer and focus is where I moved my mouse.

Cannot build on Ubuntu 22.04 LTS

Due to OpenSSL version differences, the rust compiler can't build against a default Ubuntu 22.04 installation with openssl installed.

Solution is to update openssl and openssl-sys dependencies of the project.

Mouse scrolling issue

Everything seems to work just fine except the wheel scrolling: when I switch to a client and I scroll with mouse wheel, the server receives the input, too.

I'm on Fedora 37 with Gnome 43 on Wayland.
Also, to make it work I followed what's reported here

Windows Server

When are you estimating Windows Server will be ready to test?

I have a windows gaming desktop paired with a linux desktop, and in order to use all the features of my mouse windows has to be the host.

I'm excited to test it out when it's ready for testing.

macOS support

This project sounds great, but I couldn’t use it without macOS support.

server failing to start with "kernel: uinput: invalid abs[28] min:0 max:-1" and "rkvm-server[4238]: [ERROR rkvm_server] Error: Input error: Invalid argument (os error 22)"

  • hardware is a Surface Pro 5
  • running arch linux with surface kernel
  • kde plasma wayland session
  • works fine as a client with another system as the server
  • when trying to run as server it fails to start, and will retry repeatedly

journalctl log:

Aug 23 21:45:50 archgen systemd[1]: rkvm-server.service: Scheduled restart job, restart counter is at 5.
Aug 23 21:45:50 archgen systemd[1]: Started rkvm server.
Aug 23 21:45:50 archgen rkvm-server[4238]: [INFO  rkvm_server::server] Listening on 0.0.0.0:5258
Aug 23 21:45:50 archgen rkvm-server[4238]: [INFO  rkvm_server::server] Registered new device 0 (name "Video Bus", vendor 0, product 6, version 0)
Aug 23 21:45:50 archgen rkvm-server[4238]: [INFO  rkvm_server::server] Registered new device 1 (name "IPTS 045E:001F", vendor 1118, product 31, version 0)
Aug 23 21:45:50 archgen kernel: input: Video Bus as /devices/virtual/input/input65
Aug 23 21:45:50 archgen kernel: input: IPTS 045E:001F as /devices/virtual/input/input66
Aug 23 21:45:50 archgen rkvm-server[4238]: [INFO  rkvm_server::server] Registered new device 2 (name "IPTS 045E:001F Touchscreen", vendor 1118, product 31, version 0)
Aug 23 21:45:50 archgen rkvm-server[4238]: [INFO  rkvm_server::server] Registered new device 3 (name "gpio-keys", vendor 1, product 1, version 256)
Aug 23 21:45:50 archgen kernel: input: IPTS 045E:001F Touchscreen as /devices/virtual/input/input67
Aug 23 21:45:50 archgen kernel: input: gpio-keys as /devices/virtual/input/input68
Aug 23 21:45:50 archgen kernel: input: gpio-keys as /devices/virtual/input/input69
Aug 23 21:45:50 archgen kernel: input: PC Speaker as /devices/virtual/input/input70
Aug 23 21:45:50 archgen rkvm-server[4238]: [INFO  rkvm_server::server] Registered new device 4 (name "gpio-keys", vendor 1, product 1, version 256)
Aug 23 21:45:50 archgen rkvm-server[4238]: [INFO  rkvm_server::server] Registered new device 5 (name "PC Speaker", vendor 31, product 1, version 256)
Aug 23 21:45:50 archgen kernel: uinput: invalid abs[28] min:0 max:-1
Aug 23 21:45:50 archgen systemd-logind[1080]: Watching system buttons on /dev/input/event24 (gpio-keys)
Aug 23 21:45:50 archgen rkvm-server[4238]: [ERROR rkvm_server] Error: Input error: Invalid argument (os error 22)
Aug 23 21:45:51 archgen systemd[1]: rkvm-server.service: Main process exited, code=exited, status=1/FAILURE
Aug 23 21:45:51 archgen systemd[1]: rkvm-server.service: Failed with result 'exit-code'.

Also thanks for the tool. With another system as the server where it works I'm impressed that touch and pen inputs work so well, even with multiple screens. I might rig up some video streaming to go with the key switch, and then it's a new and improved Weylus.

[issue] Running server kills all input

I have compiled the master branch with the instructions provided in readme.md. When I run ./server then it seems to start okay but my attached (Bluetooth) keyboards and mice stop registering keypresses and movement, except for the key to switch to another client and the laptop touchpad. Everything returns to normal once I kill the server.

Currently running up to date Arch install with Gnome 3.38.3 using Wayland.

Use of domain names in listen address of server config file

I can't use a domain name to specify the listen socket address in the config file of the server. For example when using the line listen = "foo:5258" in the file server.toml, rkvm-server exits with the following message:

Error parsing config: invalid socket address syntax for key `listen` at line 1 column 10

Even though foo is a valid socket address defined in the /etc/hosts file.
In contrast the line server = "foo:5258" in the file client.toml works without problems from a client machine with an identical entry for foo in /etc/hosts. Can this be considered a bug or is this intended behavior?

User-level uinput permissions

It just came to me that Sunshine emulates devices the same way rkvm does. However Sunshine doesn't require root permissions to do so, but instead requires user permission to access uinput through a udev rule.

It would be very nice to be able to run rkvm as a user as it would be more secure and make configuration much easier. I'll try to figure a way to do it.

Regards,
Jules

Noticeable stuttering in game

I've setup a pi to act as a "hub" for my mouse/keyboard/audio between my work and desktop computers. Everything so far works great EXCEPT when I play Overwatch 2. The motion in game is noticeably not smooth and there are consistent very short pauses that cause the mouse to momentarily stop. I can produce some videos if that would help, or what ever else is needed.

Are there any ways to tune rkvm for performance?

why does the rkvm server relay inputs to itself?

hello,

after some fiddling around with rkvm on the server side, i realized that inputs are passed to the host as a virtual mouse, at least on xorg. i'm wondering whether that is necessary, since it doesn't respect the settings of your input devices (such as left-handedness). is there a reason for this, or is it a different story on wayland?

Enter key inop when server running, new lines

I have been appreciating rkvm for a few months now, without issues.
Today when the server is running my enter key is inop.
I see older posts about this.
Whether rkvm-server is started using systemctl start or from the commandline the RETURN is inop until I kill the server via an ssh session. (I see you have a timeout option as well.)

When I start the server from a terminal new lines start and continue indefinitely.
If I start the server using systemctl or systemctl from a bash script the effect is the same.

I'm an experienced linux user, not a programmer. If there is any info I can provide let me know.

I tried it in an X session as well as wayland. Rebooted. Rebuilt from latest release tarball.

OS: openSUSE Tumbleweed x86_64
Kernel: 6.7.6-1-default
Shell: bash 5.2.26
WM: sway
Terminal: kitty
CPU: AMD Ryzen 5 2600 (12) @ 3.400GHz
GPU: NVIDIA GeForce GTX 1050 3GB

I have been very impressed with rkvm, especially being able to share the mouse and kb independent of the desktop environment.

[Noob] Can't make it work

After running $ sudo rkvm-server /etc/rkvm/server.toml --shutdown-after 15

I get:

[INFO rkvm_server::server] Listening on 0.0.0.0:5258 [INFO rkvm_input::event_reader] Registered helper for /dev/input/event22 at /dev/input/event23 [INFO rkvm_input::event_reader] Registered helper for /dev/input/event8 at /dev/input/event24 [INFO rkvm_input::event_reader] Registered helper for /dev/input/event7 at /dev/input/event25 [INFO rkvm_input::event_reader] Registered helper for /dev/input/event6 at /dev/input/event26 [INFO rkvm_input::event_reader] Registered helper for /dev/input/event5 at /dev/input/event27 [INFO rkvm_input::event_reader] Registered helper for /dev/input/event4 at /dev/input/event28 [INFO rkvm_input::event_reader] Registered helper for /dev/input/event3 at /dev/input/event29 [INFO rkvm_input::event_reader] Registered helper for /dev/input/event2 at /dev/input/event30 [INFO rkvm_input::event_reader] Registered helper for /dev/input/event1 at /dev/input/event31 [INFO rkvm_input::event_reader] Registered helper for /dev/input/event0 at /dev/input/event256 [INFO rkvm_input::event_writer] Registered virtual device at /dev/input/event257 [INFO rkvm_server] Shutting down as requested

Keyboard and mouse are unresponsive, nothing happens. I'm probably doing something wrong.

edit: Server is on a system with X11, Gnome 42.5 and Mutter.

Windows

Hi! I like the project and would absolutely be willing to contribute, but I was wondering if windows support is planned? I have a windows machine next to my linux machine on two seperate systems, and I would love to be able to use rkvm as barrier and synergy don't work well with wayland.

Feature Request: Tunnel over ssh

I'd really like to try to setup rkvm in my environment, but I'd really like to avoid the overhead of creating a certificate and key, copying the certificate to clients, and having a password set...

It seems obvious to me to tunnel this over an ssh connection, in order to take advantage of existing setups. I trust the security of my ssh setup.

I know I can listen on a local port only, and use ssh tunneling and I think I can make this work with that, but is it possible to avoid the overhead of setting up and syncing a certificate and of having a password? (I suppose the password isn't a big issue as I can just use anything without relying on it being secure.)

UnknownIssuer/UnknownCA TLS certificate errors

I've been trying to set up a server and client with my own self-signed certificates as per the README and I can't seem to get the handshake to succeed. These are self-signed certificates that I use in other parts of my setup, and have the root CA installed on both the client and server I'm trying to use. These certificates work with other parts of my setup I use them with, but with rkvm I get the following errors:

Server:

 INFO connection{addr=192.168.1.246:36724}: rkvm_server::server: Connected
ERROR connection{addr=192.168.1.246:36724}: rkvm_server::server: Disconnected: received fatal alert: UnknownCA

Client:

 INFO rkvm_client::client: Connected to server
ERROR rkvm_client: Error: Network error: invalid peer certificate: UnknownIssuer

I've tried generating certificates with the included rkvm-certificate-gen tool but I still get the same errors on both the server and client. Here's what I'm doing to generate the certificates. Can someone spot anything obvious with what I'm doing wrong?

Server:
rkvm-certificate-gen /etc/rkvm/certificate.pem /etc/rkvm/key.pem -d architect -i 192.168.0.45 -D 3650

Client:
rkvm-certificate-gen /etc/rkvm/certificate.pem /etc/rkvm/key.pem -d birdmachine -i 192.168.1.246 -D 3650

Is there any way to specify a CA certificate as well as a server certificate? If the root CA being unrecognized is the problem then I'd think telling it which root CA to verify the certificate's signature with would work.

Unable to start server: Input error: Device or resource busy (os error 16)

Hey, Barrier Refugee on wayland here. I wanna run the server on my desktop PC (device A) and connect my Laptop as client (device B).

I've used the AUR installation and installed the rkvm package. Running Manjaro Linux on both devices.

After creating certificate and Key and running sudo cp /etc/rkvm/server.example.toml /etc/rkvm/server.toml,

i can run the server start command by typing sudo rkvm-server /etc/rkvm/server.toml. After a few seconds the server stops, because of an Input Error. See the log:

sudo rkvm-server /etc/rkvm/server.toml                    
[sudo] Password for k1llerk3ks: 
[INFO  rkvm_server::server] Listening on 192.168.133.33:5258
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event10 at /dev/input/event4
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event9 at /dev/input/event27
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event8 at /dev/input/event28
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event7 at /dev/input/event29
[INFO  rkvm_input::event_reader] Registered helper for /dev/input/event6 at /dev/input/event30
[ERROR rkvm_server] Error: Input error: Device or resource busy (os error 16)

For testing purposes i tried running the server on the Laptop and using the Desktop PC as Client. This works well. The Desktop PC is running wayland, the Laptop is still on X11.

I am thankful for any assistance and help!

EDIT: Same outcome, if i use X11 on the Server/Desktop PC.

add `[[bin]] name` to Cargo.toml to output prefixed executables

In the course of packaging this, I noticed that the built binaries are called client, server, and certificate-gen.

For my Nix derivation, I simply prefix them all with rkvm- but I'm wondering if it would be more appropriate to just fix this in the various binaries' Cargo.toml files so that they're automatically named with a prefix.

What do you think?

Mouse cursor not moving on the client side

I've got a ubuntu 22.04 desktop (amd64, rkvm-server) and have a ubuntu 22.04 desktop vm (arm64, rkvm-client, running on apple macbook m1 pro running under UTM). rkvm connects successfully and am able to control the mouse/keyboard on the server and use the key sequence to change to the client. After switching to control the client, the cursor/pointer stays in one place though I can click (right/left) and see that things (windows/icons/can select txt/etc) in the direction I am moving the mouse towards get focused/highlights/etc. Any ideas?

Both client/server is running wayland. I compiled rkvm using ubuntu:lunar docker image otherwise I would get errors.

Client not working on Wayland (Swaywm)

Hey, thanks for sharing this project, it's exactly what I've wanted for a while.
Unfortunately it (both keyboard and mouse) doesn't currently work for me when using Wayland (Sway).
I've tested that it works for me using X (i3).

Have you tested rkvm on Wayland at all?

My setup:
Server: X (i3)
Client: Wayland (Sway)

Additionally, on Wayland I've tested that libinput is indeed receiving the events using libinput debug-events.
I'm not really sure where the problem lies, but when I was trying to reimplement barrier in rust (it's just a prototype) a while ago, I remember having lots of trouble with this. It's a little different because it uses absolute events for the mouse due to how barrier works, but seen as the keyboard also doesn't work with rkvm that difference probably doesn't matter too much. I just tested my barrier-rust prototype on a Wayland client and the mouse does work.

I think it might be with how you setup the virtual input devices because I remember it being really finicky, e.g. even though libinput receives the events, some other system (maybe Wayland or the specific compositor or something?) doesn't read the events if the device doesn't conform to some heuristic based on its capabilities, e.g. If you try create a mouse without a left button it will ignore mouse events from that device. Unfortunately I didn't document exactly what I found so I can't be sure.
In this case it might be that you created a single virtual device for both the keyboard and mouse, instead of separate virtual devices for each.

Do you have any thoughts on this?

IPv6 server config (ie. on the client side) reading fails

Hi,

I've been trying to configure RKVM to work over IPv6 but I can't specify a server address on the client side. I wrote the IPv6 address in the [1234:1234:2134::]:5258 format, and I see your parsing function splits using : as a separator. I suspect that's why IPv6 addresses aren't parsed correctly in the configuration.

Regards,
Jules

[ERROR server] Error: Invalid argument (os error 22)

Hello,

After spending whole day with compiling errors on fedora 36 i finally managed to compile the applications.
But i am still not able to run the server:

sudo cargo run --bin server

    [ERROR server] Error: Invalid argument (os error 22)
cargo run --bin server

    [ERROR server] Error: Permission denied (os error 13)
sudo systemctl status rkvm-server.service

    Process: 62046 ExecStart=/opt/rkvm/server (code=exited, status=203/EXEC)
    Nov 05 13:41:19 boffice systemd[1]: rkvm-server.service: Start request repeated too quickly.
    Nov 05 13:41:19 boffice systemd[1]: rkvm-server.service: Failed with result 'exit-code'.
    Nov 05 13:41:19 boffice systemd[1]: Failed to start rkvm-server.service - rkvm server.

certificate-gen command from README not working

I first tried, as offered in the README:

$ cargo run certificate-gen -- --help
error: `cargo run` could not determine which binary to run. Use the `--bin` option to specify a binary, or the `default-run` manifest key.
available binaries: client, server, certificate-gen

So then I tried

$ cargo run --bin certificate-gen -- --help

and this worked.

Should the README be updated or am I missing something?

[Feature Request] Clipboard synchronization

Feature summary

I would like to be able to synchronize clipboard contents (at least textual, if not binary also) between sessions, such that I can copy something from a client and paste it onto the server, or vice versa.

Design

I think that the synchronization should only occur on screen switch events, to prevent excessive communication. I do not know enough about rust libraries that would support the buffer for managing this data stream before interaction with the appropriate client libraries.

Anticipated problems

Wayland and xfree86 implement completely different clipboard mechanisms with different architectures and even behaviors. I believe a complete implementation would need an abstraction that sits between rkvm and the window system, which is a pattern you have managed to avoid for input between the two. I do not immediately know of a way to do it without relying on, for example, a third-party clipboard manager, that doesn't involve tackling this complexity.

Notes

You didn't have an issue template, so I just tried to keep this organized enough that I'd be happy with it :)

[Windows Support] Can't Compile, Also No Instructions

It appears that Windows support was added back in 0.2.x but the ReadMe was not updated with such instructions. Attempting to compile on Windows leads to a failure compiling inotify-sys due to issues with 'libc'.

error[E0425]: cannot find value 'O_CLOEXEC' in crate 'libc'
error[E0425]: cannot find value 'O_NONBLOCK' in crate 'libc'
could not compile 'inotify-sys' due to 2 previous errors
build failed, waiting for other jobs to finish...

If Windows is supported, what is the documented steps from the Windows (Client) side?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.