Based on upstream commit 4f05f37232706912885eb9c076344d85dc6d7663

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 src/2.6.16/wacom_sys.c |   61 +++++++++++++++++++++++++++++++++++++++++-------
 src/2.6.30/wacom_sys.c |   61 +++++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 106 insertions(+), 16 deletions(-)

diff --git a/src/2.6.16/wacom_sys.c b/src/2.6.16/wacom_sys.c
index c32fa6a..9d58c84 100644
--- a/src/2.6.16/wacom_sys.c
+++ b/src/2.6.16/wacom_sys.c
@@ -409,20 +409,36 @@ static int wacom_retrieve_hid_descriptor(struct 
usb_interface *intf,
 static int wacom_led_control(struct wacom *wacom)
 {
        unsigned char *buf;
-       int retval, led = wacom->led.select[0] | 0x4;
+       int retval;
 
        buf = kzalloc(9, GFP_KERNEL);
        if (!buf)
                return -ENOMEM;
 
-       if (wacom->wacom_wac.features.type == WACOM_21UX2 ||
-           wacom->wacom_wac.features.type == WACOM_24HD)
-               led |= (wacom->led.select[1] << 4) | 0x40;
+       if (wacom->wacom_wac.features.type >= INTUOS5S &&
+           wacom->wacom_wac.features.type <= INTUOS5L) {
+               /* Touch Ring and crop mark LED luminance may take on
+                * one of four values:
+                *    0 = Low; 1 = Medium; 2 = High; 3 = Off
+                */
+               int ring_led = wacom->led.select[0] & 0x03;
+               int ring_lum = (((wacom->led.llv & 0x60) >> 5) - 1) & 0x03;
+               int crop_lum = 0;
+               buf[0] = WAC_CMD_LED_CONTROL;
+               buf[1] = (crop_lum << 4) | (ring_lum << 2) | (ring_led);
+       }
+       else {
+               int led = wacom->led.select[0] | 0x4;
 
-       buf[0] = WAC_CMD_LED_CONTROL;
-       buf[1] = led;
-       buf[2] = wacom->led.llv;
-       buf[3] = wacom->led.hlv;
+               if (wacom->wacom_wac.features.type == WACOM_21UX2 ||
+                   wacom->wacom_wac.features.type == WACOM_24HD)
+                       led |= (wacom->led.select[1] << 4) | 0x40;
+
+               buf[0] = WAC_CMD_LED_CONTROL;
+               buf[1] = led;
+               buf[2] = wacom->led.llv;
+               buf[3] = wacom->led.hlv;
+       }
 
        retval = wacom_set_report(wacom->intf, WAC_HID_FEATURE_REPORT,
                                  WAC_CMD_LED_CONTROL, buf, 9, WAC_CMD_RETRIES);
@@ -491,6 +507,16 @@ static struct attribute_group intuos4_led_attr_group = {
        .attrs = intuos4_led_attrs,
 };
 
+static struct attribute *intuos5_led_attrs[] = {
+       &dev_attr_status_led0_select.attr,
+       NULL
+};
+
+static struct attribute_group intuos5_led_attr_group = {
+       .name = "wacom_led",
+       .attrs = intuos5_led_attrs,
+};
+
 static int wacom_initialize_leds(struct wacom *wacom)
 {
        int error;
@@ -516,6 +542,18 @@ static int wacom_initialize_leds(struct wacom *wacom)
                                   &cintiq_led_attr_group);
                break;
 
+       case INTUOS5S:
+       case INTUOS5:
+       case INTUOS5L:
+               wacom->led.select[0] = 0;
+               wacom->led.select[1] = 0;
+               wacom->led.llv = 32;
+               wacom->led.hlv = 0;
+
+               error = sysfs_create_group(&wacom->intf->dev.kobj,
+                                          &intuos5_led_attr_group);
+               break;
+
        default:
                return 0;
        }
@@ -544,6 +582,13 @@ static void wacom_destroy_leds(struct wacom *wacom)
                sysfs_remove_group(&wacom->intf->dev.kobj,
                                   &cintiq_led_attr_group);
                break;
+
+       case INTUOS5S:
+       case INTUOS5:
+       case INTUOS5L:
+               sysfs_remove_group(&wacom->intf->dev.kobj,
+                                  &intuos5_led_attr_group);
+               break;
        }
 }
 
diff --git a/src/2.6.30/wacom_sys.c b/src/2.6.30/wacom_sys.c
index c4c6803..ef19b03 100755
--- a/src/2.6.30/wacom_sys.c
+++ b/src/2.6.30/wacom_sys.c
@@ -487,20 +487,36 @@ static void wacom_remove_shared_data(struct wacom_wac 
*wacom)
 static int wacom_led_control(struct wacom *wacom)
 {
        unsigned char *buf;
-       int retval, led = wacom->led.select[0] | 0x4;
+       int retval;
 
        buf = kzalloc(9, GFP_KERNEL);
        if (!buf)
                return -ENOMEM;
 
-       if (wacom->wacom_wac.features.type == WACOM_21UX2 ||
-           wacom->wacom_wac.features.type == WACOM_24HD)
-               led |= (wacom->led.select[1] << 4) | 0x40;
+       if (wacom->wacom_wac.features.type >= INTUOS5S &&
+           wacom->wacom_wac.features.type <= INTUOS5L) {
+               /* Touch Ring and crop mark LED luminance may take on
+                * one of four values:
+                *    0 = Low; 1 = Medium; 2 = High; 3 = Off
+                */
+               int ring_led = wacom->led.select[0] & 0x03;
+               int ring_lum = (((wacom->led.llv & 0x60) >> 5) - 1) & 0x03;
+               int crop_lum = 0;
+               buf[0] = WAC_CMD_LED_CONTROL;
+               buf[1] = (crop_lum << 4) | (ring_lum << 2) | (ring_led);
+       }
+       else {
+               int led = wacom->led.select[0] | 0x4;
+
+               if (wacom->wacom_wac.features.type == WACOM_21UX2 ||
+                   wacom->wacom_wac.features.type == WACOM_24HD)
+                       led |= (wacom->led.select[1] << 4) | 0x40;
 
-       buf[0] = WAC_CMD_LED_CONTROL;
-       buf[1] = led;
-       buf[2] = wacom->led.llv;
-       buf[3] = wacom->led.hlv;
+               buf[0] = WAC_CMD_LED_CONTROL;
+               buf[1] = led;
+               buf[2] = wacom->led.llv;
+               buf[3] = wacom->led.hlv;
+       }
 
        retval = wacom_set_report(wacom->intf, WAC_HID_FEATURE_REPORT,
                                  WAC_CMD_LED_CONTROL, buf, 9, WAC_CMD_RETRIES);
@@ -569,6 +585,16 @@ static struct attribute_group intuos4_led_attr_group = {
        .attrs = intuos4_led_attrs,
 };
 
+static struct attribute *intuos5_led_attrs[] = {
+       &dev_attr_status_led0_select.attr,
+       NULL
+};
+
+static struct attribute_group intuos5_led_attr_group = {
+       .name = "wacom_led",
+       .attrs = intuos5_led_attrs,
+};
+
 static int wacom_initialize_leds(struct wacom *wacom)
 {
        int error;
@@ -594,6 +620,18 @@ static int wacom_initialize_leds(struct wacom *wacom)
                                   &cintiq_led_attr_group);
                break;
 
+       case INTUOS5S:
+       case INTUOS5:
+       case INTUOS5L:
+               wacom->led.select[0] = 0;
+               wacom->led.select[1] = 0;
+               wacom->led.llv = 32;
+               wacom->led.hlv = 0;
+
+               error = sysfs_create_group(&wacom->intf->dev.kobj,
+                                          &intuos5_led_attr_group);
+               break;
+
        default:
                return 0;
        }
@@ -622,6 +660,13 @@ static void wacom_destroy_leds(struct wacom *wacom)
                sysfs_remove_group(&wacom->intf->dev.kobj,
                                   &cintiq_led_attr_group);
                break;
+
+       case INTUOS5S:
+       case INTUOS5:
+       case INTUOS5L:
+               sysfs_remove_group(&wacom->intf->dev.kobj,
+                                  &intuos5_led_attr_group);
+               break;
        }
 }
 
-- 
1.7.9.5


------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to