On Mon, Mar 14, 2011 at 10:14 PM, Ping Cheng <[email protected]> wrote:
> On Tue, Mar 15, 2011 at 2:31 AM, Chris Bagwell
>>
>> Hmmm. There is an issue there when we convert to generic, huh? Well,
>> we can squeak by if we continue to use BTN_LEFT/RIGHT/MIDDLE for mouse
>> and BTN_0/1/4/5 for PAD.
>>
>> I keep this in mind as I make updates to see if I can resolve some of
>> the xf86-input-wacom side issues before we get there.
>
> Great. In fact, if you can bring the kernel driver to generic format while
> you work on xf86-input-wacom, we could skip the middle step you mentioned in
> the other email.
>
> Now you know all the "features" we need to maintain for Graphire, I have no
> problem for you to update the kernel driver to Generic.
>
I went ahead and whipped up new graphire routine using generic
protocol. This should work good with xf86-input-evdev for instance
but not suggested to use that way.
I've attached as C function because its easier to review and to hand
replace in either linux kernel or input-wacom. I'll post patch
against input-wacom or linux-input soon.
It has one issue I know of with xf86-input-wacom. The ABS_WHEEL and
REL_WHEEL will get processed by channel 0 even when its coming from
PAD. I'll need to make a patch like I did for buttons to route them
to PAD device. I believe mouse and pad buttons will work fine in
todays xf86-input-wacom.
There is internally confusion where buttons left/middle/right and
relative wheel could be on a mouse but will get routed to pad device.
I'm hoping to keep it simple and let this happen for know. User will
not really notice difference which device processed it.
If it shows up as issue, I guess we could guess which device its
associated with by looking for an in proximity mouse and routing there
first but that has issues when tool leaves proximity and we guessed
wrong.
Looking for testers since this is all done blind... and looking for
feedback or ideas related to overlap of tools and pad button event
names.
Chris
static int wacom_graphire_irq(struct wacom_wac *wacom)
{
struct wacom_features *features = &wacom->features;
struct input_dev *input = wacom->input;
unsigned char *data = wacom->data;
int prox = 0, x = 0, y = 0, p = 0, d = 0, rw = 0, aw = 0,
pen = 0, btns1 = 0, btns2 = 0, btnl = 0, btnm = 0, btnr = 0,
btn0 = 0, btn1 = 0, btn3 = 0, btn4 = 0;
if (data[0] != WACOM_REPORT_PENABLED) {
dbg("wacom_graphire_irq: received unknown report #%d", data[0]);
return 0;
}
prox = data[1] & 0x80;
/*
* firmware can send invalid data when out of proximity so
* send zeros to be safe. Also gives apps a fresh starting
* point when entering proximity.
*/
if (prox) {
switch ((data[1] >> 5) & 3) {
case 0: /* Pen */
wacom->tool[0] = BTN_TOOL_PEN;
break;
case 1: /* Rubber */
wacom->tool[0] = BTN_TOOL_RUBBER;
break;
case 2: /* Mouse with wheel */
case 3: /* Mouse without wheel */
wacom->tool[0] = BTN_TOOL_MOUSE;
break;
}
x = le16_to_cpup((__le16 *)&data[2]);
y = le16_to_cpup((__le16 *)&data[4]);
if (wacom->tool[0] == BTN_TOOL_MOUSE ) {
if (features->type == WACOM_G4 ||
features->type == WACOM_MO) {
d = data[6] & 0x3f;
rw = (data[7] & 0x04) - (data[7] & 0x03);
} else {
d = data[7] & 0x3f;
rw = -(signed char)data[6];
}
btnl = data[1] & 0x01;
btnr = data[1] & 0x02;
btnm = data[1] & 0x04;
} else {
p = data[6] | ((data[7] & 0x01) << 8);
pen = data[1] & 0x01;
btns1 = data[1] & 0x02;
btns2 = data[1] & 0x04;
}
}
/* Buttons and wheels on tablet are always reported */
if (features->type == WACOM_G4) {
btn0 = data[7] & 0x40;
btn1 = data[7] & 0x80;
/*
* Mouse wheel and tablet wheel share event but mouse
* event is only valid when tool is in proximity.
* When both are in use, give priority to mouse.
*/
if (!rw)
rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3);
} else if (features->type == WACOM_MO) {
btn0 = data[7] & 0x08;
btn1 = data[7] & 0x10;
btn3 = data[7] & 0x20;
btn4 = data[7] & 0x40;
aw = data[8] & 0x7f;
}
input_report_key(input, BTN_TOUCH, pen);
input_report_key(input, BTN_STYLUS, btns1);
input_report_key(input, BTN_STYLUS2, btns2);
input_report_key(input, BTN_LEFT, btnl);
input_report_key(input, BTN_MIDDLE, btnm);
input_report_key(input, BTN_RIGHT, btnr);
input_report_key(input, BTN_0, btn0);
input_report_key(input, BTN_1, btn1);
input_report_key(input, BTN_3, btn3);
input_report_key(input, BTN_4, btn4);
input_report_abs(input, ABS_X, x);
input_report_abs(input, ABS_Y, y);
input_report_abs(input, ABS_PRESSURE, p);
input_report_abs(input, ABS_DISTANCE, d);
input_report_abs(input, ABS_WHEEL, aw);
input_report_rel(input, REL_WHEEL, rw);
input_report_key(input, wacom->tool[0], prox);
return 1;
}
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel