Closed frankheckenbach closed 9 years ago
Thanks I'll give it a testrun and apply the patch later. I'm aware of the portability issues. Even with sizes and endianess of values defined it will still only work as long as the values mean the same on both ends. As I'm using ArchBSD on my desktop now, which has no uinput and no evdev, I currently actually lack a use case which is why I haven't touched the code in a long time.
For me it was mostly a convenience tool while having laptop and desktop with both running ArchLinux x8_64 ;)
Sorry for the delay. As I said I don't have the setup anymore where I need it.
No problem. Thanks for applying it!
Thanks for netevent!
A couple of notes and suggestions:
I tried to use it between a PC (amd64) and a Raspberry Pi (armv6l). It didn't work out of the box. I think the problematic line was
if (!cin.read(evreadpos, sizeof(ev))) {
which should read only strsz[1] bytes if the sizes don't match.Instead of changing that, I made the following change to make the code a bit more flexible (and not much longer):
Even after this change, I don't think it's fully portable. Even if sizeof(dev) matches, its layout or padding may be different. And different endianness is not handled. It also may not be fully thread-safe; at least atomic access should be used for the shared variables. And maybe more ... But it works for me now.(tm) ;)
Additionally I changed:
Also I found it easier to use socat instead of netcat as suggested, especially on the receiver side, because with "fork" it can handle several connections with one command (and one port). With the following command, you can forward keyboard and mouse (and whatever else you want) all to port 1955. It also works automatically if you restart netevent on the sending side, without a need to restart anything on the other side:
socat tcp-listen:1955,fork exec:"/usr/local/bin/netevent -write"