I'm trying to send keystrokes from my android to my Retropie using ssh. After a lot of searching I found that I have to use ssh with the -X flag which was already a hassle as most apps don't support flags. I fond one now (VX ConnectBot) and when I echo $DISPLAY I get localhost:10 so x11 forwarding seems properly enabled. But when I try to do anything with xdotool like DISPLAY=':0' xdotool ... I always get the error

Error: Can't open display: (null).

Any ideas why? Or any other ideas on how I can control the keyboard from my android?


If $DISPLAY is localhost:10 when you're connecting from Android to Retropie, it indicates that X forwarding is in effect for X11 programs on the Retropie to the screen on Android.

When you specify DISPLAY=':0', the command after that would be connecting to Retropie's local X display, not the remote display of the Android. In effect, you would be undoing the X forwarding to access the local display of the system that's running the command. To do that successfully, you would also need the local display's session cookie in your ~/.Xauthority file (or in a file pointed to by the $XAUTHORITY environment variable).

Now, have you confirmed that Retropie actually has an X server running? The programs in it could be using the framebuffer device directly, eliminating the overhead of the X11 protocol. In a device like Retropie, that would make a great deal of sense.

  • Well okay... I think I'm just gonna buy a keyboard. I've been digging through guides for hours now and apparently they're all not working. Thanks a lot for the effort, but it seems its not as straightforward as I thought to press a simple key on the remote machine. – Aram Becker Jan 26 '18 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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