Skip to content

Commit

Permalink
Merge pull request #5076 from bonzini/master
Browse files Browse the repository at this point in the history
udev input: support controlling the menu with a TV remote control
  • Loading branch information
inactive123 authored Jun 21, 2017
2 parents 59bfe30 + d5cdbca commit 8068bcc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 4 additions & 3 deletions input/drivers/udev_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ static void udev_input_handle_hotplug(udev_input_t *udev)
{
device_handle_cb cb;
enum udev_input_dev_type dev_type = UDEV_INPUT_KEYBOARD;
const char *val_keyboard = NULL;
const char *val_key = NULL;
const char *val_mouse = NULL;
const char *val_touchpad = NULL;
const char *action = NULL;
Expand All @@ -403,14 +403,15 @@ static void udev_input_handle_hotplug(udev_input_t *udev)
if (!dev)
return;

val_keyboard = udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD");
val_key = udev_device_get_property_value(dev, "ID_INPUT_KEY");
val_mouse = udev_device_get_property_value(dev, "ID_INPUT_MOUSE");
val_touchpad = udev_device_get_property_value(dev, "ID_INPUT_TOUCHPAD");
action = udev_device_get_action(dev);
devnode = udev_device_get_devnode(dev);

if (val_keyboard && string_is_equal_fast(val_keyboard, "1", 1) && devnode)
if (val_key && string_is_equal_fast(val_key, "1", 1) && devnode)
{
/* EV_KEY device, can be a keyboard or a remote control device. */
dev_type = UDEV_INPUT_KEYBOARD;
cb = udev_handle_keyboard;
}
Expand Down
9 changes: 9 additions & 0 deletions input/input_keymaps.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ const struct input_key_map input_config_key_map[] = {
{ "subtract", RETROK_KP_MINUS },
{ "kp_plus", RETROK_KP_PLUS },
{ "kp_minus", RETROK_KP_MINUS },
{ "volume-", RETROK_VOLUMEDOWN },
{ "volume+", RETROK_VOLUMEUP },
{ "f1", RETROK_F1 },
{ "f2", RETROK_F2 },
{ "f3", RETROK_F3 },
Expand Down Expand Up @@ -1087,6 +1089,13 @@ const struct rarch_key_map rarch_key_map_linux[] = {
{ KEY_EURO, RETROK_EURO },
#endif
{ KEY_UNDO, RETROK_UNDO },
{ KEY_VOLUMEDOWN, RETROK_VOLUMEDOWN },
{ KEY_VOLUMEUP, RETROK_VOLUMEUP },

/* Extra keys for remote controls. */
{ KEY_OK, RETROK_RETURN },
{ KEY_BACK, RETROK_BACKSPACE },

{ 0, RETROK_UNKNOWN },
};
#endif
Expand Down
3 changes: 3 additions & 0 deletions libretro-common/include/libretro.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@ enum retro_key
RETROK_EURO = 321,
RETROK_UNDO = 322,

RETROK_VOLUMEDOWN = 323,
RETROK_VOLUMEUP = 324,

RETROK_LAST,

RETROK_DUMMY = INT_MAX /* Ensure sizeof(enum) == sizeof(int) */
Expand Down

0 comments on commit 8068bcc

Please sign in to comment.