From f963991161fa9461f19c73abc9952f90e3638553 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Sat, 4 Jul 2020 23:29:25 -0700 Subject: [PATCH] Save PID in libx52_device structure This will support a parser interface which will parse the HID report from the X52, but given that the device has different PIDs, the parser will need to behave differently depending on the PID. --- lib/libx52/x52_common.h | 6 ++++++ lib/libx52/x52_core.c | 6 +----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/libx52/x52_common.h b/lib/libx52/x52_common.h index c3e8533..978be49 100644 --- a/lib/libx52/x52_common.h +++ b/lib/libx52/x52_common.h @@ -14,6 +14,11 @@ #include #include "libx52.h" +#define VENDOR_SAITEK 0x06a3 +#define X52_PROD_X52PRO 0x0762 +#define X52_PROD_X52_1 0x0255 +#define X52_PROD_X52_2 0x075C + /* * The X52 MFD supports the following: * - 3 lines of 16 characters each @@ -33,6 +38,7 @@ struct x52_mfd_line { struct libx52_device { libusb_context *ctx; libusb_device_handle *hdl; + uint16_t pid; uint32_t update_mask; uint32_t flags; diff --git a/lib/libx52/x52_core.c b/lib/libx52/x52_core.c index 8a0470d..576d6ca 100644 --- a/lib/libx52/x52_core.c +++ b/lib/libx52/x52_core.c @@ -18,11 +18,6 @@ #include "x52_common.h" #include "gettext.h" -#define VENDOR_SAITEK 0x06a3 -#define X52_PROD_X52PRO 0x0762 -#define X52_PROD_X52_1 0x0255 -#define X52_PROD_X52_2 0x075C - /* Check if the USB device is supported by this library */ static int libx52_check_product(uint16_t idVendor, uint16_t idProduct) { @@ -101,6 +96,7 @@ int libx52_connect(libx52_device *dev) } dev->hdl = hdl; + dev->pid = desc.idProduct; if (libx52_device_is_x52pro(desc.idProduct)) { set_bit(&(dev->flags), X52_FLAG_IS_PRO);