We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3236

Summary: No mouse or keyboard input recognized on Raspberry Pi 2 (Raspian without X)
Product: SDL Reporter: TheBuzzSaw <thebuzzsaw>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: josh, thebuzzsaw
Version: 2.0.4   
Hardware: ARM   
OS: Linux   
URL: http://raspberrypi.stackexchange.com/q/40891/38009
Attachments: patch to fix the issue

Description TheBuzzSaw 2016-01-11 04:15:57 UTC
I submitted this question to Stack Exchange.

http://raspberrypi.stackexchange.com/q/40891/38009

It turns out it is a duplicate of an unresolved question from a while ago.

http://raspberrypi.stackexchange.com/q/36329/38009

Basically, SDL 2.0.4 doesn't seem to capture any input on Raspberry Pi 2. I built SDL from source and then wrote the program shown in the first link above. (Lemme know if you want the code migrated here.) Did I code some part it wrong? It's a fairly minimal program.

As noted in the second link, if the program is terminated without properly exiting, the keyboard stops working entirely (despite never acknowledging any events). It doesn't respond in the Raspian terminal at all. I was able to reproduce that.
Comment 1 TheBuzzSaw 2016-01-11 04:19:51 UTC
To be clear, if the program exits normally, the keyboard resumes normal operation. So, I added the `int n` to get the program to exit even if there is no input detected. (I was sick of having to reboot the Pi to fix the problem.)
Comment 2 Joshua Bodine 2016-01-16 22:02:53 UTC
Make sure you have libudev development files installed. Try:

sudo apt-get install libudev-dev

Then, rebuild and reinstall SDL 2. Mouse/keyboard input started working for me after I did that.

There appears to be an issue with the makefile or configure.ac where it searches for libudev files, doesn't find them, but still says at the end that it will use libudev. ./configure --disable-libudev does appear to make it correctly show that libudev will not be used. Regardless, it appears that you do need libudev to get mouse/keyboard input to work on the Raspberry Pi.
Comment 3 TheBuzzSaw 2016-01-17 18:56:30 UTC
Thank you so much. That was indeed my problem. I thought I ensured `evdev` was there at least, but I forgot. Installing `libudev` fixed it. It does seem strange that one can compile SDL without input support, but whatever.
Comment 4 Joshua Bodine 2016-01-17 21:11:45 UTC
Created attachment 2367 [details]
patch to fix the issue

I'm going to reopen this because configure should still accurately report whether libudev will be used. Right now it just tests whether it's enabled as an argument, not whether configure was successful in finding it. Here's a patch that fixes the issue.
Comment 5 Joshua Bodine 2016-01-17 21:12:57 UTC
Reopening per comment 4.
Comment 6 Sam Lantinga 2016-11-01 17:43:00 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/fc1c463cfdae