Re: [Linuxwacom-devel] [PATCH v3] Enable LED status change through xsetwacom

2012-02-22 Thread Peter Hutterer
On Sat, Feb 18, 2012 at 12:42:21PM +, Bastien Nocera wrote:
> Peter Hutterer  writes:
> > On Wed, Feb 08, 2012 at 08:30:58AM -0800, Jason Gerecke wrote:
> > > Any feedback on the changes or ideas on exposing the properties?
> > 
> > sorry for the delay. short answer - I don't think we should merge this
> > support as properties. properties are not well-suited for this, they are too
> > generic and too much knowledge must reside in the client setting them.
> 
> Exactly. But the client should be the one handling the mode switching, and the
> button actions in the first place. So I don't see what's wrong with exposing
> it as a property. It would make it available now, and make it possible for me 
> to make the mode switching work in GNOME 3.4 (I really don't want to have mode
> switching enabled if I can't show the user that the mode has indeed switched).
> 
> So I'm in favour of one property per LED group, and a bitmask as to which one
> is lit up (if even just an index, if we want to force 1 LED lit at all times).
> 
> > Instead, we should extend the protocol for XI 2.3 to add a LED class and the
> > required requests to modify the LEDs support. This gives us
> > more flexibility handling LEDs and less driver-dependent behaviour.
> 
> That's nice. It doesn't require using properties. but it does still require
> the client having special knowledge of the device. It's not like one would set
> the LEDs the same way on a Wacom tablet and a PS3 joypad for example.

It doesn't tell us where the LEDs are and what they could mean (unless we
employ XKB-like geometry) but it gives us a number of other options, most
importantly a valid range. The current LEDs may only support bitmasks, they
may be arranged in groups but there's no guarantee that this will be the
same in the next generation of devices. Properties cannot give us this
information, we need a real API for this.

Changing properties is painful, they're a soft API. Appending and removing
is relatively easy provided clients are written correctly, but anything else
is annoying at best and impossible at worst.

Cheers,
  Peter

--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH] HID: wacom: Add serial and id reporting for Wacom Intuos4 WL

2012-02-22 Thread Przemo Firszt
This patch implements reporting id and serial number of used tool.
Reported values are the same as for USB on of the driver for wacom Intuos4 WL

Signed-off-by: Przemo Firszt 
---
 drivers/hid/hid-wacom.c |   21 +++--
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c
index a793753..49b9178 100644
--- a/drivers/hid/hid-wacom.c
+++ b/drivers/hid/hid-wacom.c
@@ -35,6 +35,8 @@ struct wacom_data {
__u16 tool;
unsigned char butstate;
__u8 features;
+   __u32 id;
+   __u32 serial;
unsigned char high_speed;
 #ifdef CONFIG_HID_WACOM_POWER_SUPPLY
int battery_capacity;
@@ -318,26 +320,30 @@ static void wacom_i4_parse_pen_report(struct wacom_data 
*wdata,
struct input_dev *input, unsigned char *data)
 {
__u16 x, y, pressure;
-   __u32 id;
 
switch (data[1]) {
case 0x80: /* Out of proximity report */
input_report_key(input, BTN_TOUCH, 0);
input_report_abs(input, ABS_PRESSURE, 0);
input_report_key(input, wdata->tool, 0);
+   input_report_abs(input, ABS_MISC, 0);
+   input_event(input, EV_MSC, MSC_SERIAL, wdata->serial);
wdata->tool = 0;
input_sync(input);
break;
case 0xC2: /* Tool report */
-   id = ((data[2] << 4) | (data[3] >> 4) |
+   wdata->id = ((data[2] << 4) | (data[3] >> 4) |
((data[7] & 0x0f) << 20) |
-   ((data[8] & 0xf0) << 12)) & 0xf;
+   ((data[8] & 0xf0) << 12));
+   wdata->serial = ((data[3] & 0x0f) << 28) +
+   (data[4] << 20) + (data[5] << 12) +
+   (data[6] << 4) + (data[7] >> 4);
 
-   switch (id) {
-   case 0x802:
+   switch (wdata->id) {
+   case 0x100802:
wdata->tool = BTN_TOOL_PEN;
break;
-   case 0x80A:
+   case 0x10080A:
wdata->tool = BTN_TOOL_RUBBER;
break;
}
@@ -356,6 +362,9 @@ static void wacom_i4_parse_pen_report(struct wacom_data 
*wdata,
input_report_abs(input, ABS_X, x);
input_report_abs(input, ABS_Y, y);
input_report_abs(input, ABS_PRESSURE, pressure);
+   input_report_abs(input, ABS_MISC, wdata->id);
+   input_event(input, EV_MSC, MSC_SERIAL, wdata->serial);
+   input_report_key(input, wdata->tool, 1);
input_sync(input);
break;
}
-- 
1.7.6.4


--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH] HID: wacom: set ABS_MISC bit for Intuos4 WL

2012-02-22 Thread Przemo Firszt
ABS_MISC has to be set for Intuos4 WL otherwise xorg driver won't use proper
protocol and the information about tool id and serial is lost.

Signed-off-by: Przemo Firszt 
---
 drivers/hid/hid-wacom.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c
index 696b907..a793753 100644
--- a/drivers/hid/hid-wacom.c
+++ b/drivers/hid/hid-wacom.c
@@ -471,6 +471,7 @@ static int wacom_input_mapped(struct hid_device *hdev, 
struct hid_input *hi,
input_set_abs_params(input, ABS_DISTANCE, 0, 32, 0, 0);
break;
case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH:
+   __set_bit(ABS_MISC, input->absbit);
input_set_abs_params(input, ABS_X, 0, 40640, 4, 0);
input_set_abs_params(input, ABS_Y, 0, 25400, 4, 0);
input_set_abs_params(input, ABS_PRESSURE, 0, 2047, 0, 0);
-- 
1.7.6.4


--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] Protocol for Intuos4 WL?

2012-02-22 Thread Przemo Firszt
Dnia 2012-02-22, śro o godzinie 19:55 +, Przemo Firszt pisze:
[..]
> I understand that usbInitProtocol5 should initialise protocol v5 but I can't 
> find where it's called.
> The same for usbInitProtocol4.
> 
> Any hints?
> 
I'll answer my own question: absbit wasn't set in kernel driver. Adding
__set_bit(ABS_MISC, input->absbit);
solved the problem.
 
-- 
regards,
Przemo


--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] Protocol for Intuos4 WL?

2012-02-22 Thread Przemo Firszt
I'm trying to track down a probem with Intuos4 WL. Connected by USB
works OK:
[  3182.316] (II) /dev/input/event8 (10:wcmEvent): c=0 i=1050626 t=1c
s=343955190 x=18061 y=9959 b=0 p=0 rz=0 tx=28 ty=32 aw=0 aw2=0 rw=0 t=0
px=1 st=0 cs=4 

so serial is 343955190 (hex 148056F6), 
id 1050626 (hex 100802) or hex 10080A depending on the tool.

now hid-wacom: 

[ 22269.565] (II) /dev/input/event8 (10:wcmEvent): c=0 i=0 t=1 s=1 
x=32822 y=11354 b=0 p=0 rz=0 tx=0 ty=0 aw=0 aw2=0 rw=0 t=0 px=1 st=0 cs=4 

so serial = 1, id =0

part of the code related to reporting:

input_report_key(input, BTN_TOUCH, pressure > 1);
input_report_abs(input, ABS_DISTANCE, ((data[9] >> 3) & 0x3f));
input_report_key(input, BTN_STYLUS, data[1] & 0x02);
input_report_key(input, BTN_STYLUS2, data[1] & 0x04);
input_report_abs(input, ABS_X, x);
input_report_abs(input, ABS_Y, y);
input_report_abs(input, ABS_PRESSURE, pressure);
input_report_abs(input, ABS_MISC, wdata->id);
input_report_key(input, wdata->tool, 1);
input_event(input, EV_MSC, MSC_SERIAL, wdata->serial);
input_sync(input);

values on kernel side are correct, I can prove it :-)

My guess is that usbChooseChannel is picking WCM_PROTOCOL_GENERIC 

I understand that usbInitProtocol5 should initialise protocol v5 but I can't 
find where it's called.
The same for usbInitProtocol4.

Any hints?


P.S. How to set debug level for tablet before connecting? I what to debug 
connection process, but 
xsetwacom --set "Wacom Intuos4 WL pad" TabletDebugLevel 10 can't work if there 
is no tablet connected.
-- 
regards
Przemo Firszt


--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH] Export current tool ID in the property too

2012-02-22 Thread Chris Bagwell
I believe I get it.  I was thinking about advertising the old value
change but this instead looks like it advertises missing device ID
change which indirectly covers all the cases were old values need
updating... and old values only get updated on demand.

Reviewed-by: Chris Bagwell 


On Wed, Feb 22, 2012 at 12:54 AM, Peter Hutterer
 wrote:
> Previously, we exported old serial number, old tool ID and current serial
> number. Export the current tool ID as well.
>
> Signed-off-by: Peter Hutterer 
> ---
>  include/wacom-properties.h |    6 --
>  src/wcmCommon.c            |    6 +++---
>  src/wcmXCommand.c          |   16 ++--
>  src/xf86Wacom.h            |    2 +-
>  src/xf86WacomDefs.h        |    1 +
>  5 files changed, 19 insertions(+), 12 deletions(-)
>
> diff --git a/include/wacom-properties.h b/include/wacom-properties.h
> index 0bb84b1..2bb86ab 100644
> --- a/include/wacom-properties.h
> +++ b/include/wacom-properties.h
> @@ -33,8 +33,10 @@
>  /* 32 bit, 4 values */
>  #define WACOM_PROP_PRESSURECURVE "Wacom Pressurecurve"
>
> -/* CARD32, 4 values, tablet id, old serial, old hw device id, current serial
> -   read-only */
> +/* CARD32, 4 values, tablet id, old serial, old hw device id,
> +   current serial, current device id
> +   read-only
> + */
>  #define WACOM_PROP_SERIALIDS "Wacom Serial IDs"
>
>  /* CARD32, 1 value */
> diff --git a/src/wcmCommon.c b/src/wcmCommon.c
> index 11340ea..65b0390 100644
> --- a/src/wcmCommon.c
> +++ b/src/wcmCommon.c
> @@ -730,8 +730,8 @@ void wcmSendEvents(InputInfoPtr pInfo, const 
> WacomDeviceState* ds)
>                return;
>        }
>
> -       if (priv->cur_serial != serial)
> -               wcmUpdateSerial(pInfo, serial);
> +       if (priv->cur_serial != serial || priv->cur_device_id != id)
> +               wcmUpdateSerial(pInfo, serial, id);
>
>        /* don't move the cursor when going out-prox */
>        if (!ds->proximity)
> @@ -833,7 +833,7 @@ void wcmSendEvents(InputInfoPtr pInfo, const 
> WacomDeviceState* ds)
>                priv->devReverseCount = 0;
>                priv->old_serial = serial;
>                priv->old_device_id = id;
> -               wcmUpdateSerial(pInfo, 0);
> +               wcmUpdateSerial(pInfo, 0, 0);
>        }
>  }
>
> diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
> index 0fd5664..57b3f20 100644
> --- a/src/wcmXCommand.c
> +++ b/src/wcmXCommand.c
> @@ -190,7 +190,8 @@ void InitWcmDeviceProperties(InputInfoPtr pInfo)
>        values[1] = priv->old_serial;
>        values[2] = priv->old_device_id;
>        values[3] = priv->cur_serial;
> -       prop_serials = InitWcmAtom(pInfo->dev, WACOM_PROP_SERIALIDS, 
> XA_INTEGER, 32, 4, values);
> +       values[4] = priv->cur_device_id;
> +       prop_serials = InitWcmAtom(pInfo->dev, WACOM_PROP_SERIALIDS, 
> XA_INTEGER, 32, 5, values);
>
>        values[0] = priv->serial;
>        prop_serial_binding = InitWcmAtom(pInfo->dev, WACOM_PROP_SERIAL_BIND, 
> XA_INTEGER, 32, 1, values);
> @@ -718,7 +719,7 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, 
> XIPropertyValuePtr prop,
>                 * set it at runtime. If we get here from wcmUpdateSerial,
>                 * we know the serial has ben set internally already, so we
>                 * can reply with success. */
> -               if (prop->size == 4 && prop->format == 32)
> +               if (prop->size == 5 && prop->format == 32)
>                        if (((CARD32*)prop->data)[3] == priv->cur_serial)
>                                return Success;
>
> @@ -875,11 +876,12 @@ int wcmGetProperty (DeviceIntPtr dev, Atom property)
>                values[1] = priv->old_serial;
>                values[2] = priv->old_device_id;
>                values[3] = priv->cur_serial;
> +               values[4] = priv->cur_device_id;
>
>                DBG(10, priv, "Update to serial: %d\n", priv->old_serial);
>
>                return XIChangeDeviceProperty(dev, property, XA_INTEGER, 32,
> -                                             PropModeReplace, 4,
> +                                             PropModeReplace, 5,
>                                              values, FALSE);
>        }
>
> @@ -892,14 +894,14 @@ serialTimerFunc(OsTimerPtr timer, CARD32 now, pointer 
> arg)
>        InputInfoPtr pInfo = arg;
>        WacomDevicePtr priv = pInfo->private;
>        XIPropertyValuePtr prop;
> -       CARD32 prop_value[4];
> +       CARD32 prop_value[5];
>        int sigstate;
>        int rc;
>
>        sigstate = xf86BlockSIGIO();
>
>        rc = XIGetDeviceProperty(pInfo->dev, prop_serials, &prop);
> -       if (rc != Success || prop->format != 32 || prop->size != 4)
> +       if (rc != Success || prop->format != 32 || prop->size != 5)
>        {
>                xf86Msg(X_ERROR, "%s: Failed to update serial number.\n",
>                        pInfo->name);
> @@ -908,6 +910,7 @@ serialTimerFunc(OsTimerPtr timer, CARD32 now, pointer arg)
>
>        memcpy(prop_value, prop->data, sizeof(prop_va

Re: [Linuxwacom-devel] [PATCH] Export current tool ID in the property too

2012-02-22 Thread Bastien Nocera
Em Wed, 2012-02-22 às 16:54 +1000, Peter Hutterer escreveu:
> Previously, we exported old serial number, old tool ID and current serial
> number. Export the current tool ID as well.

Just what I needed. I changed the code in gnome-settings-daemon and
gnome-control-center to check for the current tool ID before the old
one, and the panel switches styli as needed.

Tested-by: Bastien Nocera 

Cheers


--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel