drivers: do not declare defines that are used only once

There is no gain at declaring the PID of the mice we support in
libratbag-private.h
Make it per driver, and remove the extra declarations.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
Benjamin Tissoires
2015-08-20 19:57:41 -04:00
parent a0f76f18f8
commit f759cbdcef
3 changed files with 29 additions and 13 deletions

View File

@@ -414,10 +414,12 @@ etekcity_remove(struct ratbag_device *device)
free(ratbag_get_drv_data(device));
}
#define USB_VENDOR_ID_ETEKCITY 0x1ea7
static const struct ratbag_id etekcity_table[] = {
{.id = { .bustype = BUS_USB,
.vendor = USB_VENDOR_ID_ETEKCITY,
.product = USB_DEVICE_ID_ETEKCITY_SCROLL_ALPHA,
.product = 0x4011,
.version = VERSION_ANY },
.data = 1,
},

View File

@@ -140,11 +140,19 @@ unifying_init_feature(struct ratbag_device *device, uint16_t feature)
}
case HIDPP_PAGE_SPECIAL_KEYS_BUTTONS: {
struct hidpp20_control_id *controls;
// int i;
log_info(ratbag, "device has programmable keys/buttons\n");
rc = hidpp20_special_key_mouse_get_controls(device, &controls);
if (rc < 0)
return rc;
// for (i = 0; i < rc; i++) {
// log_info(ratbag,
// "device is at %d dpi (variable between %d and %d).\n",
// sensors[0].dpi,
// sensors[0].dpi_min,
// sensors[0].dpi_max);
// }
free(controls);
drv_data->capabilities |= HIDPP_CAP_BUTTON_KEY_1b04;
@@ -235,22 +243,37 @@ unifying_remove(struct ratbag_device *device)
free(ratbag_get_drv_data(device));
}
#define USB_VENDOR_ID_LOGITECH 0x046d
static const struct ratbag_id unifying_table[] = {
/* M705 */
{.id = { .bustype = BUS_USB,
.vendor = USB_VENDOR_ID_LOGITECH,
.product = USB_DEVICE_ID_LOGITECH_M705,
.product = 0x101b,
.version = VERSION_ANY },
.data = 1,
},
/* M570 */
{.id = { .bustype = BUS_USB,
.vendor = USB_VENDOR_ID_LOGITECH,
.product = USB_DEVICE_ID_LOGITECH_M570,
.product = 0x1028,
.version = VERSION_ANY },
.data = 1,
},
/* MX Master over unifying */
{.id = { .bustype = BUS_USB,
.vendor = USB_VENDOR_ID_LOGITECH,
.product = USB_DEVICE_ID_LOGITECH_MX_MASTER,
.product = 0x4041,
.version = VERSION_ANY },
.data = 1,
},
/* MX Master over bluetooth */
{.id = { .bustype = BUS_BLUETOOTH,
.vendor = USB_VENDOR_ID_LOGITECH,
.product = 0xb012,
.version = VERSION_ANY },
.data = 1,
},

View File

@@ -30,15 +30,6 @@
#include "libratbag.h"
#include "libratbag-util.h"
#define USB_VENDOR_ID_ETEKCITY 0x1ea7
#define USB_DEVICE_ID_ETEKCITY_SCROLL_ALPHA 0x4011
#define USB_VENDOR_ID_LOGITECH 0x046d
#define USB_DEVICE_ID_LOGITECH_M705 0x101b
#define USB_DEVICE_ID_LOGITECH_M570 0x1028
#define USB_DEVICE_ID_LOGITECH_MX_MASTER 0x4041
#define USB_DEVICE_ID_UNIFYING_RECEIVER 0xc52b
#define USB_DEVICE_ID_UNIFYING_RECEIVER2 0xc532
#define BUS_ANY 0xffff
#define VENDOR_ANY 0xffff
#define PRODUCT_ANY 0xffff