diff options
author | Mattias Andrée <maandree@kth.se> | 2022-07-26 16:01:13 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-07-26 16:02:05 +0200 |
commit | 9de0de4d3d32ab97226fa9868de1fa2290120429 (patch) | |
tree | 292473831841529716f97565391303fb9b071c15 /libgamepad_get_relative_axis_name.c | |
parent | Update information about Sixaxis (diff) | |
download | libgamepad-9de0de4d3d32ab97226fa9868de1fa2290120429.tar.gz libgamepad-9de0de4d3d32ab97226fa9868de1fa2290120429.tar.bz2 libgamepad-9de0de4d3d32ab97226fa9868de1fa2290120429.tar.xz |
Do not relay on libevdev for button/axis names, an prepare for device specific names, and add reverse lookup functions
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | libgamepad_get_relative_axis_name.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libgamepad_get_relative_axis_name.c b/libgamepad_get_relative_axis_name.c index f3e4a46..5a16945 100644 --- a/libgamepad_get_relative_axis_name.c +++ b/libgamepad_get_relative_axis_name.c @@ -2,4 +2,12 @@ #include "common.h" -extern inline const char *libgamepad_get_relative_axis_name(uint16_t); +const char * +libgamepad_get_relative_axis_name(const struct libgamepad_device *device, uint16_t code) /* will not be pure */ +{ + if (device) + return NULL; + if ((size_t)code > ELEMSOF(libgamepad_relative_axis_names__)) + return NULL; + return libgamepad_relative_axis_names__[code]; +} |