Commit 545f4e99 authored by Ping Cheng's avatar Ping Cheng Committed by Dmitry Torokhov

Input: wacom - add support for new USB Tablet PCs

Signed-off-by: default avatarPing Cheng <pingc@wacom.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 8442c87d
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
* - Support Intuos3 4x6 * - Support Intuos3 4x6
* v1.47 (pc) - Added support for Bamboo * v1.47 (pc) - Added support for Bamboo
* v1.48 (pc) - Added support for Bamboo1, BambooFun, and Cintiq 12WX * v1.48 (pc) - Added support for Bamboo1, BambooFun, and Cintiq 12WX
* v1.49 (pc) - Added support for USB Tablet PC (0x90, 0x93, and 0x9A)
*/ */
/* /*
...@@ -86,7 +87,7 @@ ...@@ -86,7 +87,7 @@
/* /*
* Version Information * Version Information
*/ */
#define DRIVER_VERSION "v1.48" #define DRIVER_VERSION "v1.49"
#define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>"
#define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver" #define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver"
#define DRIVER_LICENSE "GPL" #define DRIVER_LICENSE "GPL"
...@@ -103,15 +104,15 @@ struct wacom { ...@@ -103,15 +104,15 @@ struct wacom {
struct usb_device *usbdev; struct usb_device *usbdev;
struct usb_interface *intf; struct usb_interface *intf;
struct urb *irq; struct urb *irq;
struct wacom_wac * wacom_wac; struct wacom_wac *wacom_wac;
struct mutex lock; struct mutex lock;
unsigned int open:1; unsigned int open:1;
char phys[32]; char phys[32];
}; };
struct wacom_combo { struct wacom_combo {
struct wacom * wacom; struct wacom *wacom;
struct urb * urb; struct urb *urb;
}; };
extern int wacom_wac_irq(struct wacom_wac * wacom_wac, void * wcombo); extern int wacom_wac_irq(struct wacom_wac * wacom_wac, void * wcombo);
...@@ -132,7 +133,7 @@ extern void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wa ...@@ -132,7 +133,7 @@ extern void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wa
extern void input_dev_bee(struct input_dev *input_dev, struct wacom_wac *wacom_wac); extern void input_dev_bee(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
extern __u16 wacom_le16_to_cpu(unsigned char *data); extern __u16 wacom_le16_to_cpu(unsigned char *data);
extern __u16 wacom_be16_to_cpu(unsigned char *data); extern __u16 wacom_be16_to_cpu(unsigned char *data);
extern struct wacom_features * get_wacom_feature(const struct usb_device_id *id); extern struct wacom_features *get_wacom_feature(const struct usb_device_id *id);
extern const struct usb_device_id * get_device_table(void); extern const struct usb_device_id *get_device_table(void);
#endif #endif
This diff is collapsed.
...@@ -535,31 +535,147 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) ...@@ -535,31 +535,147 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
return 1; return 1;
} }
int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
{
char *data = wacom->data;
int prox = 0, pressure;
static int stylusInProx, touchInProx = 1, touchOut;
struct urb *urb = ((struct wacom_combo *)wcombo)->urb;
dbg("wacom_tpc_irq: received report #%d", data[0]);
if (urb->actual_length == 5 || data[0] == 6) { /* Touch data */
if (urb->actual_length == 5) { /* with touch */
prox = data[0] & 0x03;
} else { /* with capacity */
prox = data[1] & 0x03;
}
if (!stylusInProx) { /* stylus not in prox */
if (prox) {
if (touchInProx) {
wacom->tool[1] = BTN_TOOL_DOUBLETAP;
wacom->id[0] = TOUCH_DEVICE_ID;
if (urb->actual_length != 5) {
wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2]));
wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4]));
wacom_report_abs(wcombo, ABS_PRESSURE, wacom_le16_to_cpu(&data[6]));
wacom_report_key(wcombo, BTN_TOUCH, wacom_le16_to_cpu(&data[6]));
} else {
wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[1]));
wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[3]));
wacom_report_key(wcombo, BTN_TOUCH, 1);
}
wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]);
wacom_report_key(wcombo, wacom->tool[1], prox & 0x01);
touchOut = 1;
return 1;
}
} else {
wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]);
wacom_report_key(wcombo, wacom->tool[1], prox & 0x01);
wacom_report_key(wcombo, BTN_TOUCH, 0);
touchOut = 0;
touchInProx = 1;
return 1;
}
} else if (touchOut || !prox) { /* force touch out-prox */
wacom_report_abs(wcombo, ABS_MISC, TOUCH_DEVICE_ID);
wacom_report_key(wcombo, BTN_TOUCH, 0);
touchOut = 0;
touchInProx = 1;
return 1;
}
} else if (data[0] == 2) { /* Penabled */
prox = data[1] & 0x20;
touchInProx = 0;
wacom->id[0] = ERASER_DEVICE_ID;
/*
* if going from out of proximity into proximity select between the eraser
* and the pen based on the state of the stylus2 button, choose eraser if
* pressed else choose pen. if not a proximity change from out to in, send
* an out of proximity for previous tool then a in for new tool.
*/
if (prox) { /* in prox */
if (!wacom->tool[0]) {
/* Going into proximity select tool */
wacom->tool[1] = (data[1] & 0x08) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
if (wacom->tool[1] == BTN_TOOL_PEN)
wacom->id[0] = STYLUS_DEVICE_ID;
} else if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[1] & 0x08)) {
/*
* was entered with stylus2 pressed
* report out proximity for previous tool
*/
wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]);
wacom_report_key(wcombo, wacom->tool[1], 0);
wacom_input_sync(wcombo);
/* set new tool */
wacom->tool[1] = BTN_TOOL_PEN;
wacom->id[0] = STYLUS_DEVICE_ID;
return 0;
}
if (wacom->tool[1] != BTN_TOOL_RUBBER) {
/* Unknown tool selected default to pen tool */
wacom->tool[1] = BTN_TOOL_PEN;
wacom->id[0] = STYLUS_DEVICE_ID;
}
wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02);
wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x10);
wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2]));
wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4]));
pressure = ((data[7] & 0x01) << 8) | data[6];
if (pressure < 0)
pressure = wacom->features->pressure_max + pressure + 1;
wacom_report_abs(wcombo, ABS_PRESSURE, pressure);
wacom_report_key(wcombo, BTN_TOUCH, pressure);
} else {
wacom_report_abs(wcombo, ABS_PRESSURE, 0);
wacom_report_key(wcombo, BTN_STYLUS, 0);
wacom_report_key(wcombo, BTN_STYLUS2, 0);
wacom_report_key(wcombo, BTN_TOUCH, 0);
}
wacom_report_key(wcombo, wacom->tool[1], prox);
wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]);
stylusInProx = prox;
wacom->tool[0] = prox;
return 1;
}
return 0;
}
int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo) int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo)
{ {
switch (wacom_wac->features->type) { switch (wacom_wac->features->type) {
case PENPARTNER: case PENPARTNER:
return (wacom_penpartner_irq(wacom_wac, wcombo)); return wacom_penpartner_irq(wacom_wac, wcombo);
break;
case PL: case PL:
return (wacom_pl_irq(wacom_wac, wcombo)); return wacom_pl_irq(wacom_wac, wcombo);
break;
case WACOM_G4: case WACOM_G4:
case GRAPHIRE: case GRAPHIRE:
case WACOM_MO: case WACOM_MO:
return (wacom_graphire_irq(wacom_wac, wcombo)); return wacom_graphire_irq(wacom_wac, wcombo);
break;
case PTU: case PTU:
return (wacom_ptu_irq(wacom_wac, wcombo)); return wacom_ptu_irq(wacom_wac, wcombo);
break;
case INTUOS: case INTUOS:
case INTUOS3S: case INTUOS3S:
case INTUOS3: case INTUOS3:
case INTUOS3L: case INTUOS3L:
case CINTIQ: case CINTIQ:
case WACOM_BEE: case WACOM_BEE:
return (wacom_intuos_irq(wacom_wac, wcombo)); return wacom_intuos_irq(wacom_wac, wcombo);
break;
case TABLETPC:
return wacom_tpc_irq(wacom_wac, wcombo);
default: default:
return 0; return 0;
} }
...@@ -586,13 +702,15 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w ...@@ -586,13 +702,15 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w
/* fall through */ /* fall through */
case INTUOS3S: case INTUOS3S:
input_dev_i3s(input_dev, wacom_wac); input_dev_i3s(input_dev, wacom_wac);
/* fall through */
case INTUOS: case INTUOS:
input_dev_i(input_dev, wacom_wac); input_dev_i(input_dev, wacom_wac);
break; break;
case PL: case PL:
case PTU: case PTU:
case TABLETPC:
input_dev_pl(input_dev, wacom_wac); input_dev_pl(input_dev, wacom_wac);
break; /* fall through */
case PENPARTNER: case PENPARTNER:
input_dev_pt(input_dev, wacom_wac); input_dev_pt(input_dev, wacom_wac);
break; break;
...@@ -611,6 +729,7 @@ static struct wacom_features wacom_features[] = { ...@@ -611,6 +729,7 @@ static struct wacom_features wacom_features[] = {
{ "Wacom Graphire4 6x8", 8, 16704, 12064, 511, 63, WACOM_G4 }, { "Wacom Graphire4 6x8", 8, 16704, 12064, 511, 63, WACOM_G4 },
{ "Wacom BambooFun 4x5", 9, 14760, 9225, 511, 63, WACOM_MO }, { "Wacom BambooFun 4x5", 9, 14760, 9225, 511, 63, WACOM_MO },
{ "Wacom BambooFun 6x8", 9, 21648, 13530, 511, 63, WACOM_MO }, { "Wacom BambooFun 6x8", 9, 21648, 13530, 511, 63, WACOM_MO },
{ "Wacom Bamboo1 Medium",8, 16704, 12064, 511, 63, GRAPHIRE },
{ "Wacom Volito", 8, 5104, 3712, 511, 63, GRAPHIRE }, { "Wacom Volito", 8, 5104, 3712, 511, 63, GRAPHIRE },
{ "Wacom PenStation2", 8, 3250, 2320, 255, 63, GRAPHIRE }, { "Wacom PenStation2", 8, 3250, 2320, 255, 63, GRAPHIRE },
{ "Wacom Volito2 4x5", 8, 5104, 3712, 511, 63, GRAPHIRE }, { "Wacom Volito2 4x5", 8, 5104, 3712, 511, 63, GRAPHIRE },
...@@ -650,6 +769,10 @@ static struct wacom_features wacom_features[] = { ...@@ -650,6 +769,10 @@ static struct wacom_features wacom_features[] = {
{ "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 63, CINTIQ }, { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 63, CINTIQ },
{ "Wacom Cintiq 20WSX", 10, 86680, 54180, 1023, 63, WACOM_BEE }, { "Wacom Cintiq 20WSX", 10, 86680, 54180, 1023, 63, WACOM_BEE },
{ "Wacom Cintiq 12WX", 10, 53020, 33440, 1023, 63, WACOM_BEE }, { "Wacom Cintiq 12WX", 10, 53020, 33440, 1023, 63, WACOM_BEE },
{ "Wacom DTU1931", 8, 37832, 30305, 511, 0, PL },
{ "Wacom ISDv4 90", 8, 26202, 16325, 255, 0, TABLETPC },
{ "Wacom ISDv4 93", 8, 26202, 16325, 255, 0, TABLETPC },
{ "Wacom ISDv4 9A", 8, 26202, 16325, 255, 0, TABLETPC },
{ "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31, INTUOS }, { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31, INTUOS },
{ } { }
}; };
...@@ -665,6 +788,7 @@ static struct usb_device_id wacom_ids[] = { ...@@ -665,6 +788,7 @@ static struct usb_device_id wacom_ids[] = {
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x16) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x16) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x17) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x17) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x18) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x18) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x19) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x60) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x60) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x61) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x61) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x62) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x62) },
...@@ -704,18 +828,26 @@ static struct usb_device_id wacom_ids[] = { ...@@ -704,18 +828,26 @@ static struct usb_device_id wacom_ids[] = {
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC5) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC5) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC6) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC6) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC7) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x90) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x93) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x9A) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) },
{ } { }
}; };
const struct usb_device_id * get_device_table(void) { const struct usb_device_id *get_device_table(void)
const struct usb_device_id * id_table = wacom_ids; {
const struct usb_device_id *id_table = wacom_ids;
return id_table; return id_table;
} }
struct wacom_features * get_wacom_feature(const struct usb_device_id * id) { struct wacom_features * get_wacom_feature(const struct usb_device_id *id)
{
int index = id - wacom_ids; int index = id - wacom_ids;
struct wacom_features *wf = &wacom_features[index]; struct wacom_features *wf = &wacom_features[index];
return wf; return wf;
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#define WACOM_WAC_H #define WACOM_WAC_H
#define STYLUS_DEVICE_ID 0x02 #define STYLUS_DEVICE_ID 0x02
#define TOUCH_DEVICE_ID 0x03
#define CURSOR_DEVICE_ID 0x06 #define CURSOR_DEVICE_ID 0x06
#define ERASER_DEVICE_ID 0x0A #define ERASER_DEVICE_ID 0x0A
#define PAD_DEVICE_ID 0x0F #define PAD_DEVICE_ID 0x0F
...@@ -27,6 +28,7 @@ enum { ...@@ -27,6 +28,7 @@ enum {
CINTIQ, CINTIQ,
WACOM_BEE, WACOM_BEE,
WACOM_MO, WACOM_MO,
TABLETPC,
MAX_TYPE MAX_TYPE
}; };
...@@ -38,6 +40,8 @@ struct wacom_features { ...@@ -38,6 +40,8 @@ struct wacom_features {
int pressure_max; int pressure_max;
int distance_max; int distance_max;
int type; int type;
int touch_x_max;
int touch_y_max;
}; };
struct wacom_wac { struct wacom_wac {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment