3

I'm running retropie on my Raspberry Pi, and I want to figure out a way to use the GPIO to simulate keystrokes. Xdotool seems like my best bet, but it doesn't work locally or over ssh. When I enter xdotool key 'd' I get the error:
Error: Can't open display: (null) Failed creating new xdo instance
Every answer so far claims that to solve this issue I have to do some variation of export DISPLAY=":0" xdotool key 'd' but this doesn't do anything, it just goes to the next line. I'm pretty new to linux, so thanks in advance.

Minecat40
  • 41
  • 1
  • 5
  • 1
    Sorry for your frustration with getting this to work, but tThis Q is not about programming as defined for StackOverflow. It **may** be more appropriate on the related sites http://raspberrypi.stackexchange.com/ or http://unix.stackexchange.com (Unix & Linux) OR even http://superuser.com . Consider using the `flag` link at the bottom of your Q and ask the moderator to move it. Please don't post the same Q on 2 different sites. Thanks and Good Luck. – shellter Jun 25 '16 at 22:36

1 Answers1

6

I stumbled across an answer that worked for me. Simply running "xauth" as Pi at the command line told me which file was being used by xauthority (/home/pi/.Xauthority in this case.)

Hope this helps

export XAUTHORITY=/home/pi/.Xauthority; export DISPLAY=:0; xdotool key Return
ThreepE0
  • 96
  • 1
  • 5