If you have a cheap laptop and you realize you can’t connect a second monitor to it, what do you do? Well, if you are [Pierre Couy], you grab a Raspberry Pi and put together a virtual screen solution.
Like all good projects, this one started with some goals and requirements:
- Low latency
- Redable text
- At least 10 frames per second
- Fast catch up if the remote screen falls behind
- Low-bitrate encoding; no hardware acceleration
- A DHCP server on the Pi to manage the network
- Power control for the attached monitor
Since Linux has such flexibility, it was possible to stitch the system together using existing components. The versatile ffmpeg handled the streaming. There was, however, a fair amount of troubleshooting necessary to track down some issues using Wireshark.
If you want to try something like this yourself, the files are on GitHub. Honestly, though, the best part of this project is seeing how the tools interact and the troubleshooting steps. For most laptops, this isn’t necessary and that’s obviously the best solution.
If you have the opposite problem of wanting to stream the Pi’s video over the network, you can do that or just leverage X11. Then again, if you have a Pi, do you even need the laptop?
Pretty sure there’s a kernel module since 5.13 to do this over USB: https://github.com/notro/gud/wiki
But over Ethernet has its own advantages, of course.
To add to this, there have been commercially available USB-as-video external monitors available for years. I’ve used the AOC one. The commercial ones are not a hack (I very much appreciate this solution in the article above and do not wish to put it down), but these are very handy and it’s good to have one around. I wonder what else can be done with them?
Hey there ! I’m the author of the original post. The key point that drove me away from commercial USB as video adapters or monitors you mention is that they usually require proprietary software installed on the host laptop. I’m really glad I came up with something open source, ans as a bonus I had a lot of fun hacking on a Raspberry pi :)
Open source DisplayLink(TM) drivers seem to be available. -> https://wiki.archlinux.org/title/DisplayLink
but maybe not with the required stability/performance/compatibility. :-/
Somehow, I only learnt about GUD after my post got seen and people started mentioning it in the comments on HN. This looks a lot cleaner than what I did, and when I have time it will be really interesting to look into it and see how I could have went a totally different way.
In thinking more about this, there’s a big potential advantage to doing it over Ethernet: 100 meter max cable length. GUD is cool, but this is also a neat trick to have in the bag of fun, too.
Yes, Ethernet is very much a winner. I have some server machines with DPMI support where I can connect using just a web browser and get access to monitor + keyboard of the remove machine that may be in a different building.
But not all motherboards have DPMI – so any software solution that can do some similar function over longer distances is good. Even best would be a solution that emulates DPMI. There are some DPMI-emulating variant of RPi somewhere on the net, with a RPi Compute Module accessing USB (keyboard/mouse) + a PCIe slot to totally remote a computer.
USB over ethernet is a thing too.
There’s this really cool app called [Superdisplay](superdisplay.app) that lets you use an Android tablet as a USB monitor with touch / drawing pen input. Basically turns my Samsung Galaxy tab s6 lite into a Wacom pen display. Wouldn’t work for Pierre here I think, but the biggest downside is it only works on a Windows host. I’ve looked for a program that can do the same on Linux, but no success so far.
Try KDE Connect as a starting point. It certainly lets you use your phone as a remote keyboard and mouse amongst other things.
I tried that, but it’s something completely different that’ll never work like what I’m looking for. For one, it works over the web and not USB. It doesn’t have pen support, doesn’t allow you to use the android device as a second screen. Frankly I don’t understand why you’re even suggesting it; it’s clearly not like what I described.
Why not using x2x?
https://help.ubuntu.com/community/X2xHowto
https://www.reddit.com/r/linuxquestions/comments/119xz4u/waylandcompatible_alternative_to_x2x/
This looks really nice to know about, but itโs quite different from what I need.
If I understand the article you shared, this is used to make the cursor and keyboard focus switch between two computers, each running their own X server and applications. What I did is different because the Pi is used to display a virtual screen that is managed by the host laptopโs X server. No GUI or applications running on the Pi, except whatโs needed to receive and play the stream
I used to do something similar with a virtual display and vnc.
I want to do this the other way around. I want to have applications running on a Pi and have the screen exported (and mouse/keyboard imported) over a serial null modem (a pair of back to back FT232R adapters) and be able to use the Pi through a window on my Windows laptop. This is fairly easy if one runs a ppp link over serial but this would break the security policy of my employer (who owns the laptop), whereas, an app that renders a screen from serial to a window probably wouldn’t.
Could this be adapted to run a third monitor from a 13″ MacBook Pro?