1

Before I explain, I doubt this is possible

I want to be able to output the video from a pi zero over USB and have the PC its plugged into send keyboard/mouse inputs. Like USB ssh but actual video out, so access to the Raspbian desktop or other GUIs.

  • From a quick google search, I think the pi can output video though USB (possible)
  • I assume the PC would have to have some software to get the USB video out and display it on a window (which i doubt is possible) or at least treat it like a standard HDMI input and display it on the whole monitor (possible?)

  • Sharing the PC keyboard/mouse with the pi and also sending video through USB (impossible I assume)

I have a some spare time and I'm looking for a project, so if this is possible at all, it would be much appreciated.

EDIT: i don't know if it helps, i also have a pi model B

1 Answer 1

2

Take a different spin: the Pi Zero W supports Ethernet Gadget mode (which is not to be confused with OTG mode). Ethernet Gadget mode means that you can connect your PC to the Pi Zero W using a standard USB A-to-microB cable -- but not an OTG cable.

Note: with the Pi 2/3 you're out of luck, as they don't support the USB gadget mode. Only the Pi Zero and Zero W do.

In Ethernet Gadget mode, the Pi Zero W appears as a USB Ethernet link to the PC, so both sides get IPv4 addresses (and probably also IPv6). On top of this IP link you could now use VNC with the server running on the Pi Zero W and the client on your PC to see the Pi's desktop and to control it using the PC's keyboard and mouse.

You need to enable Ethernet gadget mode:

  • add dtoverlay=dwc2 to the end of /boot/config.txt.
  • edit /boot/cmdline.txt and insert modules-load=dwc2,g_ether after rootwait.

You may then configure /etc/network/interfaces to assign a static IPv4 address (such as 192.168.253.1/255.255.255.0) to the network interface usb0. On your PC, also assign a static IPv4 address to this specific "Pi" network (such as 192.168.253.2).

Don't forget to enable the VNC server using raspi-config. On your PC, install the offical VNC client. Other VNC clients may work, or may not work, depending on the VNC protocol variants they support. The official client is a sane start, and already your official VNC server and client are licensed as part of the money you paid for your Zero W.

7
  • I have already done this and setup ssh and network sharing to my pi zero with a USB cable. What i wanted to know was where should i go from here? I'm looking to get a video out from the pi through the USB, not just ssh which (obviously) doesn't support any sort of GUI like the Raspian desktop. Thanks
    – pineapple
    Jul 25, 2017 at 18:19
  • Did you read my answer in full? Why not using VNC? What would be against using VNC and trying to reinvent the wheel of capturing the VideoCore display plane back into memory, compressing it to stream it, then decompress it on the PC, and on top of this writing your own keyboard and mouse protocol? Even in industry, they use VNC for remote displays...
    – TheDiveO
    Jul 25, 2017 at 18:22
  • Try MobaXterm or similar to ssh. You can have the Pi start up window-based programs and transmit them via X-forwarding. Alternatively, use VNC to get a full desktop from the Pi
    – recantha
    Jul 25, 2017 at 18:23
  • sorry, i didn't read your answer fully, and i was not aware of VNC. I will look into it. Thanks for your help!
    – pineapple
    Jul 25, 2017 at 18:27
  • Another thing, would there be a way of doing this as a self contained unit? so little to no software on the PC? That is what i was originally planning.
    – pineapple
    Jul 25, 2017 at 18:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.