Only grab input devices if they are keyboards #737
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The current evdev input implementation attempts to grab (EVIOCGRAB) every device it finds. This is required for the CTRL+C combo to not interrupt Moonlight when streaming. However, other devices that are not keyboards, i.e. gamepads, do not require this grabbing, and doing so prevent other external applications from using them concurrently. This situation can happen for example when monitoring the gamepad for activity with the purpose of turning it off as done in WIP work in RetroPie for DS3 controllers.
This PR makes the grabbing code to be more specific and only grab keyboard-type devices in
evdev_create()
. Furthermore, theis_keyboard
boolean is promoted to theinput_device
struct so it can be used inevdev_start()
as well. These are the only two places where EVIOCGRAB is issued.Tested using a real keyobard, a DS3 controller and a simple button input device on a Raspberry Pi 3 B+.
Purpose
Prevent Moonlight from grabbing input devices that are not keyboards, allowing them to be used by other external applications concurrently.