1
0
forked from drath/libratbag

hidraw: add ratbag_close_hidraw

Better to clean up the hidraw node too.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
This commit is contained in:
Benjamin Tissoires
2015-09-07 12:29:19 -04:00
parent 4333a8d9c3
commit a8e592e1bc
5 changed files with 19 additions and 0 deletions

View File

@@ -731,6 +731,7 @@ err:
static void
etekcity_remove(struct ratbag_device *device)
{
ratbag_close_hidraw(device);
free(ratbag_get_drv_data(device));
}

View File

@@ -247,6 +247,8 @@ hidpp10drv_remove(struct ratbag_device *device)
struct hidpp10drv_data *drv_data;
struct hidpp10_device *dev;
ratbag_close_hidraw(device);
drv_data = ratbag_get_drv_data(device);
dev = drv_data->dev;

View File

@@ -478,6 +478,8 @@ hidpp20drv_remove(struct ratbag_device *device)
{
struct hidpp20drv_data *drv_data = ratbag_get_drv_data(device);
ratbag_close_hidraw(device);
free(drv_data->controls);
free(drv_data->sensors);
free(drv_data);

View File

@@ -69,6 +69,13 @@ err:
return -errno;
}
void
ratbag_close_hidraw(struct ratbag_device *device)
{
ratbag_close_fd(device, device->hidraw_fd);
device->hidraw_fd = -1;
}
int
ratbag_hidraw_raw_request(struct ratbag_device *device, unsigned char reportnum,
uint8_t *buf, size_t len, unsigned char rtype, int reqtype)

View File

@@ -43,6 +43,13 @@
*/
int ratbag_open_hidraw(struct ratbag_device *device);
/**
* Close the hidraw device associated with the device.
*
* @param device the ratbag device
*/
void ratbag_close_hidraw(struct ratbag_device *device);
/**
* Send report request to device
*