aboutsummaryrefslogtreecommitdiffstats
path: root/libgamepad_close_device.c
blob: edb8361683bce183f3442e85ebe5e6bfd33e48d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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;
	}
}