Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193511
b: refs/heads/master
c: 95dd3b3
h: refs/heads/master
i:
  193509: aaa51ed
  193507: 88614e5
  193503: fbd9009
v: v3
  • Loading branch information
Dmitry Torokhov committed Apr 14, 2010
1 parent 8138a11 commit 47edb32
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 54 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8da23fc113e8bdaf813545ec935a6c60254ac439
refs/heads/master: 95dd3b30ced3ee740e5dd92fc44515a5a6a350d4
7 changes: 1 addition & 6 deletions trunk/drivers/input/tablet/wacom.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,9 @@ struct wacom {
char phys[32];
};

struct wacom_combo {
struct wacom *wacom;
struct urb *urb;
};

extern const struct usb_device_id wacom_ids[];

int wacom_wac_irq(struct wacom_wac * wacom_wac, void * wcombo);
void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len);
void wacom_setup_input_capabilities(struct input_dev *input_dev,
struct wacom_wac *wacom_wac);
__u16 wacom_le16_to_cpu(unsigned char *data);
Expand Down
12 changes: 1 addition & 11 deletions trunk/drivers/input/tablet/wacom_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,9 @@ static int usb_set_report(struct usb_interface *intf, unsigned char type,
buf, size, 1000);
}

static struct input_dev * get_input_dev(struct wacom_combo *wcombo)
{
return wcombo->wacom->wacom_wac.input;
}

static void wacom_sys_irq(struct urb *urb)
{
struct wacom *wacom = urb->context;
struct wacom_combo wcombo;
int retval;

switch (urb->status) {
Expand All @@ -96,11 +90,7 @@ static void wacom_sys_irq(struct urb *urb)
goto exit;
}

wcombo.wacom = wacom;
wcombo.urb = urb;

if (wacom_wac_irq(&wacom->wacom_wac, &wcombo))
input_sync(get_input_dev(&wcombo));
wacom_wac_irq(&wacom->wacom_wac, urb->actual_length);

exit:
usb_mark_last_busy(wacom->usbdev);
Expand Down
81 changes: 45 additions & 36 deletions trunk/drivers/input/tablet/wacom_wac.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "wacom_wac.h"
#include "wacom.h"

static int wacom_penpartner_irq(struct wacom_wac *wacom, void *wcombo)
static int wacom_penpartner_irq(struct wacom_wac *wacom)
{
unsigned char *data = wacom->data;
struct input_dev *input = wacom->input;
Expand Down Expand Up @@ -58,7 +58,7 @@ static int wacom_penpartner_irq(struct wacom_wac *wacom, void *wcombo)
return 1;
}

static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo)
static int wacom_pl_irq(struct wacom_wac *wacom)
{
struct wacom_features *features = &wacom->features;
unsigned char *data = wacom->data;
Expand Down Expand Up @@ -130,7 +130,7 @@ static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo)
return 1;
}

static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo)
static int wacom_ptu_irq(struct wacom_wac *wacom)
{
unsigned char *data = wacom->data;
struct input_dev *input = wacom->input;
Expand Down Expand Up @@ -158,7 +158,7 @@ static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo)
return 1;
}

static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
static int wacom_graphire_irq(struct wacom_wac *wacom)
{
struct wacom_features *features = &wacom->features;
unsigned char *data = wacom->data;
Expand Down Expand Up @@ -269,7 +269,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
return retval;
}

static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo)
static int wacom_intuos_inout(struct wacom_wac *wacom)
{
struct wacom_features *features = &wacom->features;
unsigned char *data = wacom->data;
Expand Down Expand Up @@ -396,7 +396,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo)
return 0;
}

static void wacom_intuos_general(struct wacom_wac *wacom, void *wcombo)
static void wacom_intuos_general(struct wacom_wac *wacom)
{
struct wacom_features *features = &wacom->features;
unsigned char *data = wacom->data;
Expand Down Expand Up @@ -427,7 +427,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom, void *wcombo)
}
}

static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
static int wacom_intuos_irq(struct wacom_wac *wacom)
{
struct wacom_features *features = &wacom->features;
unsigned char *data = wacom->data;
Expand Down Expand Up @@ -504,7 +504,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
}

/* process in/out prox events */
result = wacom_intuos_inout(wacom, wcombo);
result = wacom_intuos_inout(wacom);
if (result)
return result - 1;

Expand Down Expand Up @@ -537,7 +537,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
}

/* process general packets */
wacom_intuos_general(wacom, wcombo);
wacom_intuos_general(wacom);

/* 4D mouse, 2D mouse, marker pen rotation, tilt mouse, or Lens cursor packets */
if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0 || (data[1] & 0xbc) == 0xac) {
Expand Down Expand Up @@ -615,7 +615,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
}


static void wacom_tpc_finger_in(struct wacom_wac *wacom, void *wcombo, char *data, int idx)
static void wacom_tpc_finger_in(struct wacom_wac *wacom, char *data, int idx)
{
struct input_dev *input = wacom->input;

Expand All @@ -631,7 +631,7 @@ static void wacom_tpc_finger_in(struct wacom_wac *wacom, void *wcombo, char *dat
input_report_key(input, BTN_TOUCH, 1);
}

static void wacom_tpc_touch_out(struct wacom_wac *wacom, void *wcombo, int idx)
static void wacom_tpc_touch_out(struct wacom_wac *wacom, int idx)
{
struct input_dev *input = wacom->input;

Expand All @@ -645,19 +645,18 @@ static void wacom_tpc_touch_out(struct wacom_wac *wacom, void *wcombo, int idx)
input_report_key(input, BTN_TOUCH, 0);
}

static void wacom_tpc_touch_in(struct wacom_wac *wacom, void *wcombo)
static void wacom_tpc_touch_in(struct wacom_wac *wacom, size_t len)
{
char *data = wacom->data;
struct input_dev *input = wacom->input;
struct urb *urb = ((struct wacom_combo *)wcombo)->urb;
static int firstFinger = 0;
static int secondFinger = 0;

wacom->tool[0] = BTN_TOOL_DOUBLETAP;
wacom->id[0] = TOUCH_DEVICE_ID;
wacom->tool[1] = BTN_TOOL_TRIPLETAP;

if (urb->actual_length != WACOM_PKGLEN_TPC1FG) {
if (len != WACOM_PKGLEN_TPC1FG) {

switch (data[0]) {

Expand All @@ -675,25 +674,25 @@ static void wacom_tpc_touch_in(struct wacom_wac *wacom, void *wcombo)
wacom->id[1] = data[1] & 0x03;

if (data[1] & 0x01) {
wacom_tpc_finger_in(wacom, wcombo, data, 0);
wacom_tpc_finger_in(wacom, data, 0);
firstFinger = 1;
} else if (firstFinger) {
wacom_tpc_touch_out(wacom, wcombo, 0);
wacom_tpc_touch_out(wacom, 0);
}

if (data[1] & 0x02) {
/* sync first finger data */
if (firstFinger)
input_sync(input);

wacom_tpc_finger_in(wacom, wcombo, data, 1);
wacom_tpc_finger_in(wacom, data, 1);
secondFinger = 1;
} else if (secondFinger) {
/* sync first finger data */
if (firstFinger)
input_sync(input);

wacom_tpc_touch_out(wacom, wcombo, 1);
wacom_tpc_touch_out(wacom, 1);
secondFinger = 0;
}
if (!(data[1] & 0x01))
Expand All @@ -709,20 +708,19 @@ static void wacom_tpc_touch_in(struct wacom_wac *wacom, void *wcombo)
}
}

static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
{
struct wacom_features *features = &wacom->features;
char *data = wacom->data;
struct input_dev *input = wacom->input;
int prox = 0, pressure, idx = -1;
struct urb *urb = ((struct wacom_combo *)wcombo)->urb;

dbg("wacom_tpc_irq: received report #%d", data[0]);

if (urb->actual_length == WACOM_PKGLEN_TPC1FG || /* single touch */
if (len == WACOM_PKGLEN_TPC1FG || /* single touch */
data[0] == WACOM_REPORT_TPC1FG || /* single touch */
data[0] == WACOM_REPORT_TPC2FG) { /* 2FG touch */
if (urb->actual_length == WACOM_PKGLEN_TPC1FG) { /* with touch */
if (len == WACOM_PKGLEN_TPC1FG) { /* with touch */
prox = data[0] & 0x01;
} else { /* with capacity */
if (data[0] == WACOM_REPORT_TPC1FG)
Expand All @@ -735,28 +733,28 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)

if (!wacom->shared->stylus_in_proximity) {
if (prox) {
wacom_tpc_touch_in(wacom, wcombo);
wacom_tpc_touch_in(wacom, len);
} else {
if (data[0] == WACOM_REPORT_TPC2FG) {
/* 2FGT out-prox */
idx = (wacom->id[1] & 0x01) - 1;
if (idx == 0) {
wacom_tpc_touch_out(wacom, wcombo, idx);
wacom_tpc_touch_out(wacom, idx);
/* sync first finger event */
if (wacom->id[1] & 0x02)
input_sync(input);
}
idx = (wacom->id[1] & 0x02) - 1;
if (idx == 1)
wacom_tpc_touch_out(wacom, wcombo, idx);
wacom_tpc_touch_out(wacom, idx);
} else {
/* one finger touch */
wacom_tpc_touch_out(wacom, wcombo, 0);
wacom_tpc_touch_out(wacom, 0);
}
wacom->id[0] = 0;
}
} else if (wacom->id[0]) { /* force touch out-prox */
wacom_tpc_touch_out(wacom, wcombo, 0);
wacom_tpc_touch_out(wacom, 0);
}
return 1;
} else if (data[0] == WACOM_REPORT_PENABLED) { /* Penabled */
Expand Down Expand Up @@ -792,22 +790,28 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
return 0;
}

int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo)
void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
{
bool sync;

switch (wacom_wac->features.type) {
case PENPARTNER:
return wacom_penpartner_irq(wacom_wac, wcombo);
sync = wacom_penpartner_irq(wacom_wac);
break;

case PL:
return wacom_pl_irq(wacom_wac, wcombo);
sync = wacom_pl_irq(wacom_wac);
break;

case WACOM_G4:
case GRAPHIRE:
case WACOM_MO:
return wacom_graphire_irq(wacom_wac, wcombo);
sync = wacom_graphire_irq(wacom_wac);
break;

case PTU:
return wacom_ptu_irq(wacom_wac, wcombo);
sync = wacom_ptu_irq(wacom_wac);
break;

case INTUOS:
case INTUOS3S:
Expand All @@ -818,16 +822,21 @@ int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo)
case INTUOS4L:
case CINTIQ:
case WACOM_BEE:
return wacom_intuos_irq(wacom_wac, wcombo);
sync = wacom_intuos_irq(wacom_wac);
break;

case TABLETPC:
case TABLETPC2FG:
return wacom_tpc_irq(wacom_wac, wcombo);
sync = wacom_tpc_irq(wacom_wac, len);
break;

default:
return 0;
sync = false;
break;
}
return 0;

if (sync)
input_sync(wacom_wac->input);
}

static void wacom_setup_intuos(struct wacom_wac *wacom_wac)
Expand Down

0 comments on commit 47edb32

Please sign in to comment.