diff options
Diffstat (limited to 'libgamepad_open_device.c')
-rw-r--r-- | libgamepad_open_device.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libgamepad_open_device.c b/libgamepad_open_device.c index 5b32658..87868cb 100644 --- a/libgamepad_open_device.c +++ b/libgamepad_open_device.c @@ -16,6 +16,7 @@ libgamepad_open_device(struct libgamepad_device *devicep, int dirfd, const char devicep->buttons = NULL; devicep->absolute_axes = NULL; devicep->relative_axes = NULL; + memset(devicep->force_feedback_support, 0, sizeof(devicep->force_feedback_support)); if (path && *path) { devicep->fd = openat(dirfd, path, mode); @@ -63,6 +64,10 @@ libgamepad_open_device(struct libgamepad_device *devicep, int dirfd, const char devicep->relative_axis_map[i] = (int16_t)devicep->nrelative_axes++; } + for (i = 0; i < FF_CNT; i++) + if (libevdev_has_event_code(devicep->dev, EV_FF, i)) + devicep->force_feedback_support[i / 8] |= (uint8_t)(1 << (i & 7)); + if (devicep->nbuttons) { devicep->buttons = calloc(devicep->nbuttons, sizeof(*devicep->buttons)); if (!devicep->buttons) |