On Tue, Sep 27, 2011 at 12:09 PM, Eduard Hasenleithner
<ehase...@gmail.com> wrote:
>> We are on the page here. Besides the touch ring, the leds also tell
>> users which set of expresskey functions they can use though.
>
> This is because of there are no expresskey displays, right?

If you consider the LED as a property of the whole tablet, it will not
be restricted to the ring or something else just because they are
closer.

> Gah, I was reading the documentation for C21UX without -2. The -2
> model is quite new?

It is new. But not as fresh as C24HD ;).

> Ok, since I "extrapolated" from my Intuos4 to the (new) Cintiqs, I had
> the wrong picture. You are right, in order to keep the code simple but
> still have full flexibility, it is best to just report the "led axis"
> to the X11 client.
>
>> There are two steps in handling the LEDs - gathering user action and
>> switching the physical led status. The first step is in the X driver;
>> the second step stays in the kernel as your code does. So, most new
>> changes are in the X driver, instead of in the kernel.
>
> So let me summarize: The only important point of the function selector
> (led) is to provide another axis to the X11 client application.
> The X11 client is free to decide on what to do with the additional axis.
> In general, It is used for switching between many sets of expresskey
> allocations.

Yes, and no. Yes for the led to provide new app functions. No if you
think we are going to report the LED through XInput valuators. Due to
backward compatibility, we will not report LED as a new axis. It will
only be reported as a Wacom property through xsetwacom.

> Please find attached how I see it what happens when the toggle button
> is pressed.

I agree with you except one step: we do not ignore the round button
event. It will still be reported to the userland. There is no need to
prevent userland to assign a new function for it.

> In that case, I have another question out of curiosity:
> What prevents this new axis to be synthesized solely in the X11 input
> driver (without kernel support)?

Do you mean we send the led switch command from the X driver directly
to the device without going through the kernel driver? I am afraid we
can not. How do we talk to the device without creating a sysfsctl? We
need a new access point/thread to communite with the device.

> The current conclusion for me is that I don't implement the led
> selection, but only the luminance settings.

I guess so. Attached is a rough kernel patch. I'll update the
xf86-input-wacom after your X patch is merged.

I'll submit the attached patch if I get a reviewed-by or tested-by
from you. Thank you.

Ping

----------------

diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h
index 00332d66..3cb80cc 100644
--- a/drivers/input/tablet/wacom.h
+++ b/drivers/input/tablet/wacom.h
@@ -11,7 +11,7 @@
  *  Copyright (c) 2000 Daniel Egger            <eg...@suse.de>
  *  Copyright (c) 2001 Frederic Lepied         <flep...@mandrakesoft.com>
  *  Copyright (c) 2004 Panagiotis Issaris
<panagiotis.issa...@mech.kuleuven.ac.be>
- *  Copyright (c) 2002-2009 Ping Cheng         <pi...@wacom.com>
+ *  Copyright (c) 2002-2011 Ping Cheng         <pi...@wacom.com>
  *
  *  ChangeLog:
  *      v0.1 (vp)  - Initial release
@@ -93,7 +93,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v1.52"
+#define DRIVER_VERSION "v1.53"
 #define DRIVER_AUTHOR "Vojtech Pavlik <vojt...@ucw.cz>"
 #define DRIVER_DESC "USB Wacom tablet driver"
 #define DRIVER_LICENSE "GPL"
@@ -115,7 +115,8 @@ struct wacom {
        bool open;
        char phys[32];
        struct wacom_led {
-               u8 select; /* status led selector (0..3, -1=none) */
+               /* 0xf0 for LEDs on the left; 0x0f on the right */
+               u8 select; /* status led selector (1..4, 0=none) */
                u8 llv;    /* status led brightness no button */
                u8 hlv;    /* status led brightness button pressed */
                u8 img_lum;   /* OLED matrix display brightness */
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 0eccf57..488f2d9 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -500,7 +500,7 @@ static int wacom_led_control(struct wacom *wacom)
                return -ENOMEM;

        buf[0] = WAC_CMD_LED_CONTROL;
-       buf[1] = wacom->led.select >= 0 ? wacom->led.select | 4 : 0;
+       buf[1] = wacom->led.select;
        buf[2] = wacom->led.llv;
        buf[3] = wacom->led.hlv;
        buf[4] = wacom->led.img_lum;
@@ -557,7 +557,8 @@ static ssize_t wacom_led_select_store(struct device *dev,
                                      const char *buf, size_t count)
 {
        struct wacom *wacom = dev_get_drvdata(dev);
-       unsigned int id;
+       struct input_dev *input = wacom->wacom_wac.input;
+       unsigned int id, left_id, right_id;
        int err;

        err = kstrtouint(buf, 10, &id);
@@ -566,9 +567,17 @@ static ssize_t wacom_led_select_store(struct device *dev,

        mutex_lock(&wacom->lock);

-       wacom->led.select = id;
+       right_id = id & 0xf;
+       right_id = right_id > 0 ? right_id | 4 : 0;
+       left_id = id & 0xf0;
+       left_id = left_id > 0 ? left_id | 0x40 : 0;
+       wacom->led.select = left_id | right_id;
+
        err = wacom_led_control(wacom);

+       if (err > 0)
+               input_report_abs(input, ABS_LED_STATUS, wacom->led.select);
+
        mutex_unlock(&wacom->lock);

        return err < 0 ? err : count;
@@ -671,27 +680,41 @@ static struct attribute_group wacom_led_attr_group = {

 static int wacom_initialize_leds(struct wacom *wacom)
 {
+       struct input_dev *input = wacom->wacom_wac.input;
        int error;

-       if (wacom->wacom_wac.features.type >= INTUOS4 &&
-           wacom->wacom_wac.features.type <= INTUOS4L) {
-
-               /* Initialize default values */
-               wacom->led.select = 0;
+       /* Initialize default values */
+       switch (wacom->wacom_wac.features.type) {
+       case INTUOS4:
+       case INTUOS4L:
+               wacom->led.select = 4;
                wacom->led.llv = 30;
                wacom->led.hlv = 20;
                wacom->led.img_lum = 10;
-               wacom_led_control(wacom);
-
-               error = sysfs_create_group(&wacom->intf->dev.kobj,
-                                          &wacom_led_attr_group);
-               if (error) {
-                       dev_err(&wacom->intf->dev,
-                               "cannot create sysfs group err: %d\n", error);
-                       return error;
-               }
+               input_set_abs_params(input, ABS_LED_STATUS, 0, 0x07, 0, 0);
+               break;
+
+       case WACOM_21UX2:
+               wacom->led.select =  0x44;
+               input_set_abs_params(input, ABS_LED_STATUS, 0, 0x77, 0, 0);
+               break;
+
+       default:
+               return 0;
+       }
+
+       error = sysfs_create_group(&wacom->intf->dev.kobj,
+                                  &wacom_led_attr_group);
+       if (error) {
+               dev_err(&wacom->intf->dev,
+                       "cannot create sysfs group err: %d\n", error);
+               return error;
        }

+       error = wacom_led_control(wacom);
+       if (error > 0)
+               input_report_abs(input, ABS_LED_STATUS, wacom->led.select);
+
        return 0;
 }

diff --git a/include/linux/input.h b/include/linux/input.h
index 57add32..970725a 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -770,6 +770,7 @@ struct input_keymap_entry {
 #define ABS_TOOL_WIDTH         0x1c

 #define ABS_VOLUME             0x20
+#define ABS_LED_STATUS         0x21

 #define ABS_MISC               0x28

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to