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:
@@ -731,6 +731,7 @@ err:
|
||||
static void
|
||||
etekcity_remove(struct ratbag_device *device)
|
||||
{
|
||||
ratbag_close_hidraw(device);
|
||||
free(ratbag_get_drv_data(device));
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user