diff options
Diffstat (limited to '')
-rw-r--r-- | libgamepad_close_device.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libgamepad_close_device.c b/libgamepad_close_device.c new file mode 100644 index 0000000..edb8361 --- /dev/null +++ b/libgamepad_close_device.c @@ -0,0 +1,22 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + + +void +libgamepad_close_device(struct libgamepad_device *device) +{ + if (device) { + if (device->close_fd) + close(device->fd); + if (device->dev) + libevdev_free(device->dev); + free(device->buttons); + free(device->absolute_axes); + free(device->relative_axes); + device->close_fd = 0; + device->dev = NULL; + device->buttons = NULL; + device->absolute_axes = NULL; + device->relative_axes = NULL; + } +} |