Add support for the X52 (non-Pro model)

This uses the published device IDs for the Saitek X52 (non-Pro) model.
However, based on my knowledge, the X52 uses single color LEDs compared
to the X52 Pro's tri-color LEDs (Red/Amber/Green). For the time being,
until we can determine the actual control messages being sent to the
X52, setting the LED state will not be supported.

This commit also operates on the assumption that the other controls are
the same as the X52 Pro, specifically the following:
- Setting MFD/LED brightness
- Setting MFD text
- Setting blink and shift
- Seting time and date on the MFD clock

Issue: #11
feature/alt_lookup_engine
nirenjan 2017-01-10 22:03:13 -08:00
parent 793cd519a2
commit e053e1ac1c
2 changed files with 22 additions and 1 deletions

View File

@ -21,12 +21,16 @@
#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)
{
if (idVendor == VENDOR_SAITEK) {
switch (idProduct) {
case X52_PROD_X52_1:
case X52_PROD_X52_2:
case X52_PROD_X52PRO:
return 1;
}

View File

@ -39,7 +39,7 @@ int libx52_set_text(libx52_device *x52, uint8_t line, const char *text, uint8_t
return 0;
}
int libx52_set_led_state(libx52_device *x52, libx52_led_id led, libx52_led_state state)
static int x52pro_set_led_state(libx52_device *x52, libx52_led_id led, libx52_led_state state)
{
if (!x52) {
return -EINVAL;
@ -100,6 +100,23 @@ int libx52_set_led_state(libx52_device *x52, libx52_led_id led, libx52_led_state
return 0;
}
int libx52_set_led_state(libx52_device *x52, libx52_led_id led, libx52_led_state state)
{
if (!x52) {
return -EINVAL;
}
if (tst_bit(&x52->flags, X52_FLAG_IS_PRO)) {
return x52pro_set_led_state(x52, led, state);
}
/*
* For now, we only support setting the LEDs on the X52 Pro model.
* Calling this API on a non-Pro model will return a not supported error.
*/
return -ENOTSUP;
}
int libx52_set_brightness(libx52_device *x52, uint8_t mfd, uint16_t brightness)
{
if (!x52) {