Better HN
topnewbestaskshowjobs
Log inSign up

feschber

3 karma · joined Jan 2, 2024 (2y ago) · 8 submissions

Submissions

comment 2y ago · link · parent

udp is supported everywhere and also in the rust standard library as well as tokio. zmq and nng from what I can tell are both implemented on top of the transportation layer and use tcp under the hood.

Udp also has other advantages besides speed. - Its session less, so any device going offline can simply come back online without needing to reestablish a tcp handshake. - The udp header is also substantially smaller than a tcp segment header (8 Bytes vs >= 20 Bytes). Not a huge difference but adds up to at least 12 KiB/s with a packet rate of 1000Hz and that is without the (potential) overhead of additional protocols like zmq or nng on top.

In this particular scenario the reliability of tcp is also not really necessary in my opinion.

I think overall it may be worth investigating if there is a noticeable difference.

comment 2y ago · link · parent

way ahead of you :)

comment 2y ago · link · parent

Yes, absolutely. I have not gotten round to implementing that but its on the roadmap. The plan is to use https://crates.io/crates/webrtc-dtls. I dont think timing sidechannel attacks are a huge concern and they could be somewhat mitigated through phantom events.

comment 2y ago · link · parent

Definitely going to take a look! I wanted to have the seemless movement to different PCs experience so that's why I can't read events directly from evdev. For emulating it would probably be quite useful! And maybe also in conjunction with the current methods...

As for encryption I'm planning to use https://crates.io/crates/webrtc-dtls.

Udp also has the advantage of not needing to reconnect, which already makes it possible to switch between Wi-Fi and Ethernet seamlessly.

comment 2y ago · link · parent

Yeah I was planning to do some RTT measurements at some point but have not gotten round to implementing it. Would be great to have that directly in the ui as well!

As you said, I was thinking to get capture->send latency and receive->emulate latency and subtracting that from the RTT to get an estimate of both network and system latency (without the compositing / presentation latency of course which is likely the largest part without some 500hz monitor).

comment 2y ago · link · parent

Yes, you are right. I probably should have stated that more clearly. (I did mention input-leap though, which is a fork of synergy 1.x as far as I'm aware)

comment 2y ago · link · parent

Developer of lan-mouse here: I initially started working on this project with only wlroots compositors in mind or more precisely - any compositor that supports the layer-shell protocol could be used for capturing input - any compositor that supports wlr-virtual-pointer and virtual-keyboard could be used for input emulation

The main motivation was really to learn more about wayland at that point.

Then later I started to expand the project to support additional backends for e.g. Windows and MacOS (which currently only support input emulation) and of course Libei to get Gnome working as well (and likely KDE in the future).

For input emulation there is also support for the xdg-remote-desktop-portal which seems to be the only option for emulating input on KDE wayland until libei is supported there.

Input Capture using Libei is WIP since the whole project and particularly also the Rust bindings are in a pretty early state right now (thank you so much ids1024 for providing the reis libei bindings, if you are reading this!)

I agree, it's a shame that Wayland is so fragmented among the different DEs. Especially wlr-layer-shell support would be very nice to see on the Gnome Side (it was much easier to work with than libei!...) but I'm pretty sure that's not going to happen.

On the other hand I must also say that supporting wayland through the mentioned interfaces was a more pleasant experience than supporting Xorg with hacks like Xtst (Except for the broken implementation of the remote desktop interface in xdg-desktop-portal-kde maybe, which left me with permanently stuck keys several times...) and I'm still figuring out input capture which is likely also going to rely on more hacks than the wayland side of things.

I have also played with the idea of writing some sort of wlroots -> libei bridge that implements an eis server using the mentioned wlroots specific protocols. This would reduce the amount of backends required in lan-mouse but add an additional layer of indirection between the application and the compositor, so I'm not sure its such a great idea. For the foreseeable future, I will definitely keep support for everything within lan-mouse itself.

comment 2y ago · link · parent

Yes, it's meant satirical (mostly). Simply because its rust and people say rust is "blazingly fast".

It still is quite fast though I would say (I have not compared it to anything else though).

While moving a 1000Hz polling rate mouse, the cpu usage is about 2% of a single core on my machine (according to htop). It also uses udp to get the lowest possible latency (which e.g. barrier / input-leap does not afaik).