From 008ab6a9d7b2007de0442d9095d2f09a332b0fb7 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 26 Aug 2015 09:49:49 +1000 Subject: [PATCH] driver-hidpp10: hardcode button types for the G500s Signed-off-by: Peter Hutterer --- src/driver-hidpp10.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/driver-hidpp10.c b/src/driver-hidpp10.c index 839821a6..83cbad24 100644 --- a/src/driver-hidpp10.c +++ b/src/driver-hidpp10.c @@ -56,6 +56,29 @@ struct hidpp10drv_data { static void hidpp10drv_read_button(struct ratbag_button *button) { + enum ratbag_button_type type = RATBAG_BUTTON_TYPE_UNKNOWN; + + /* FIXME: this is valid for the G500s only */ + switch (button->index) { + case 0: type = RATBAG_BUTTON_TYPE_LEFT; break; + case 1: type = RATBAG_BUTTON_TYPE_MIDDLE; break; + case 2: type = RATBAG_BUTTON_TYPE_RIGHT; break; + case 3: type = RATBAG_BUTTON_TYPE_THUMB; break; + case 4: type = RATBAG_BUTTON_TYPE_THUMB2; break; + case 5: type = RATBAG_BUTTON_TYPE_THUMB3; break; + case 6: type = RATBAG_BUTTON_TYPE_WHEEL_LEFT; break; + case 7: type = RATBAG_BUTTON_TYPE_WHEEL_RIGHT; break; + case 8: type = RATBAG_BUTTON_TYPE_RESOLUTION_UP; break; + case 9: type = RATBAG_BUTTON_TYPE_RESOLUTION_DOWN; break; + case 10: + case 11: + case 12: /* these don't actually exist on the device */ + type = RATBAG_BUTTON_TYPE_NONE; break; + default: + break; + } + + button->type = type; } static int