diff --git a/src/2.6.27/wacom.h b/src/2.6.27/wacom.h index aaab310..5552b7e 100755 --- a/src/2.6.27/wacom.h +++ b/src/2.6.27/wacom.h @@ -148,8 +148,6 @@ 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 __u16 wacom_le16_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 const struct usb_device_id *get_device_table(void); extern int usb_get_report(struct usb_interface *intf, unsigned char type, unsigned char id, void *buf, int size); extern int usb_set_report(struct usb_interface *intf, unsigned char type, diff --git a/src/2.6.27/wacom_sys.c b/src/2.6.27/wacom_sys.c index d95e394..7bc7180 100755 --- a/src/2.6.27/wacom_sys.c +++ b/src/2.6.27/wacom_sys.c @@ -14,6 +14,8 @@ #include "wacom.h" #include "wacom_wac.h" +#define NAME_POSTFIX_MAX_SIZE 7 + /* defines to get HID report descriptor */ #define HID_DEVICET_HID (USB_TYPE_CLASS | 0x01) #define HID_DEVICET_REPORT (USB_TYPE_CLASS | 0x02) @@ -197,15 +199,18 @@ static void wacom_close(struct input_dev *dev) void input_dev_bpt(struct input_dev *input_dev, struct wacom_wac *wacom_wac) { - if (wacom_wac->features->device_type == BTN_TOOL_DOUBLETAP) { + if (wacom_wac->features->device_type == BTN_TOOL_TRIPLETAP) { input_set_abs_params(input_dev, ABS_RX, 0, wacom_wac->features->x_phy, 0, 0); input_set_abs_params(input_dev, ABS_RY, 0, wacom_wac->features->y_phy, 0, 0); input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_DOUBLETAP); input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_TRIPLETAP); - input_dev->keybit[BIT_WORD(BTN_MISC)] |= BIT_MASK(BTN_2) | - BIT_MASK(BTN_3) | - BIT_MASK(BTN_BACK) | - BIT_MASK(BTN_FORWARD); + input_dev->keybit[BIT_WORD(BTN_MISC)] |= BIT_MASK(BTN_0) | + BIT_MASK(BTN_1) | + BIT_MASK(BTN_LEFT) | + BIT_MASK(BTN_RIGHT) | + BIT_MASK(BTN_EXTRA); + input_dev->evbit[0] |= BIT_MASK(EV_MSC); + input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL); } } @@ -317,6 +322,7 @@ void input_dev_tpc2fg(struct input_dev *input_dev, struct wacom_wac *wacom_wac) { if (wacom_wac->features->device_type == BTN_TOOL_TRIPLETAP) { input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_TRIPLETAP); + input_dev->keybit[BIT_WORD(BTN_MISC)] |= BIT_MASK(BTN_EXTRA); input_dev->evbit[0] |= BIT_MASK(EV_MSC); input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL); } @@ -383,9 +389,10 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi if (features->type == BAMBOO_PT) { /* need to reset back */ features->pktlen = WACOM_PKGLEN_BBTOUCH; - features->x_max = - wacom_le16_to_cpu(&report[i + 5]); + features->device_type = BTN_TOOL_TRIPLETAP; features->x_phy = + wacom_le16_to_cpu(&report[i + 5]); + features->x_max = wacom_le16_to_cpu(&report[i + 8]); i += 15; } else { @@ -399,9 +406,10 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi } } else if (pen) { /* penabled only accepts exact bytes of data */ - if ((features->type == TABLETPC2FG) || - (features->type == BAMBOO_PT)) + if (features->type == TABLETPC2FG) features->pktlen = WACOM_PKGLEN_GRAPHIRE; + if (features->type == BAMBOO_PT) + features->pktlen = WACOM_PKGLEN_BBFUN; features->device_type = BTN_TOOL_PEN; features->x_max = wacom_le16_to_cpu(&report[i + 3]); @@ -431,9 +439,12 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi wacom_le16_to_cpu(&report[i + 6]); i += 7; } else if (features->type == BAMBOO_PT) { - features->y_max = - wacom_le16_to_cpu(&report[i + 3]); + /* need to reset back */ + features->pktlen = WACOM_PKGLEN_BBTOUCH; + features->device_type = BTN_TOOL_TRIPLETAP; features->y_phy = + wacom_le16_to_cpu(&report[i + 3]); + features->y_max = wacom_le16_to_cpu(&report[i + 6]); i += 12; } else { @@ -447,6 +458,8 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi /* penabled only accepts exact bytes of data */ if (features->type == TABLETPC2FG) features->pktlen = WACOM_PKGLEN_GRAPHIRE; + if (features->type == BAMBOO_PT) + features->pktlen = WACOM_PKGLEN_BBFUN; features->device_type = BTN_TOOL_PEN; features->y_max = wacom_le16_to_cpu(&report[i + 3]); @@ -575,14 +588,19 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i struct wacom_wac *wacom_wac; struct wacom_features *features; struct input_dev *input_dev; + char *name = NULL; int error = -ENOMEM; wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); wacom_wac = kzalloc(sizeof(struct wacom_wac), GFP_KERNEL); + features = kzalloc(sizeof(struct wacom_features), GFP_KERNEL); + name = kzalloc(strlen(((struct wacom_features *)id->driver_info)->name) + NAME_POSTFIX_MAX_SIZE, GFP_KERNEL); input_dev = input_allocate_device(); - if (!wacom || !input_dev || !wacom_wac) + if (!wacom || !wacom_wac || !features || !name || !input_dev) goto fail1; + memcpy(features, (void *)id->driver_info, sizeof(struct wacom_features)); + wacom_wac->data = usb_buffer_alloc(dev, WACOM_PKGLEN_MAX, GFP_KERNEL, &wacom->data_dma); if (!wacom_wac->data) goto fail1; @@ -598,11 +616,9 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i usb_make_path(dev, wacom->phys, sizeof(wacom->phys)); strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); - wacom_wac->features = features = get_wacom_feature(id); + wacom_wac->features = features; BUG_ON(features->pktlen > WACOM_PKGLEN_MAX); - input_dev->name = wacom_wac->features->name; - wacom->wacom_wac = wacom_wac; usb_to_input_id(dev, &input_dev->id); input_dev->dev.parent = &intf->dev; @@ -619,6 +635,21 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i if (error) goto fail2; + if (features->type == TABLETPC || features->type == TABLETPC2FG || features->type == BAMBOO_PT) { + /* Append the device type to the name */ + if (features->device_type == BTN_TOOL_DOUBLETAP || + features->device_type == BTN_TOOL_TRIPLETAP) { + snprintf(name, strlen(features->name) + NAME_POSTFIX_MAX_SIZE, "%s Touch", features->name); + } else { + snprintf(name, strlen(features->name) + NAME_POSTFIX_MAX_SIZE, "%s Pen", features->name); + } + } else { + snprintf(name, strlen(features->name), "%s", features->name); + } + + input_dev->name = wacom_wac->features->name = name; + wacom->wacom_wac = wacom_wac; + input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOUCH); @@ -651,6 +682,8 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i fail1: input_free_device(input_dev); kfree(wacom); kfree(wacom_wac); + kfree(features); + kfree(name); return error; } @@ -665,6 +698,8 @@ static void wacom_disconnect(struct usb_interface *intf) usb_free_urb(wacom->irq); usb_buffer_free(interface_to_usbdev(intf), WACOM_PKGLEN_MAX, wacom->wacom_wac->data, wacom->data_dma); + kfree(wacom->wacom_wac->features->name); + kfree(wacom->wacom_wac->features); kfree(wacom->wacom_wac); kfree(wacom); } @@ -704,8 +739,222 @@ static int wacom_reset_resume(struct usb_interface *intf) return wacom_resume(intf); } +static struct wacom_features wacom_features_0x00 = + { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255, 0, PENPARTNER }; +static struct wacom_features wacom_features_0x10 = + { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }; +static struct wacom_features wacom_features_0x11 = + { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }; +static struct wacom_features wacom_features_0x12 = + { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511, 63, GRAPHIRE }; +static struct wacom_features wacom_features_0x13 = + { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, GRAPHIRE }; +static struct wacom_features wacom_features_0x14 = + { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }; +static struct wacom_features wacom_features_0x15 = + { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, WACOM_G4 }; +static struct wacom_features wacom_features_0x16 = + { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, WACOM_G4 }; +static struct wacom_features wacom_features_0x17 = + { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }; +static struct wacom_features wacom_features_0x18 = + { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511, 63, WACOM_MO }; +static struct wacom_features wacom_features_0x19 = + { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }; +static struct wacom_features wacom_features_0x60 = + { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; +static struct wacom_features wacom_features_0x61 = + { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255, 63, GRAPHIRE }; +static struct wacom_features wacom_features_0x62 = + { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; +static struct wacom_features wacom_features_0x63 = + { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511, 63, GRAPHIRE }; +static struct wacom_features wacom_features_0x64 = + { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511, 63, GRAPHIRE }; +static struct wacom_features wacom_features_0x65 = + { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }; +static struct wacom_features wacom_features_0x69 = + { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; +static struct wacom_features wacom_features_0x20 = + { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS }; +static struct wacom_features wacom_features_0x21 = + { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; +static struct wacom_features wacom_features_0x22 = + { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS }; +static struct wacom_features wacom_features_0x23 = + { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS }; +static struct wacom_features wacom_features_0x24 = + { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS }; +static struct wacom_features wacom_features_0x30 = + { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255, 0, PL }; +static struct wacom_features wacom_features_0x31 = + { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255, 0, PL }; +static struct wacom_features wacom_features_0x32 = + { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255, 0, PL }; +static struct wacom_features wacom_features_0x33 = + { "Wacom PL600SX", WACOM_PKGLEN_GRAPHIRE, 6260, 5016, 255, 0, PL }; +static struct wacom_features wacom_features_0x34 = + { "Wacom PL550", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 511, 0, PL }; +static struct wacom_features wacom_features_0x35 = + { "Wacom PL800", WACOM_PKGLEN_GRAPHIRE, 7220, 5780, 511, 0, PL }; +static struct wacom_features wacom_features_0x37 = + { "Wacom PL700", WACOM_PKGLEN_GRAPHIRE, 6758, 5406, 511, 0, PL }; +static struct wacom_features wacom_features_0x38 = + { "Wacom PL510", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL }; +static struct wacom_features wacom_features_0x39 = + { "Wacom DTU710", WACOM_PKGLEN_GRAPHIRE, 34080, 27660, 511, 0, PL }; +static struct wacom_features wacom_features_0xC4 = + { "Wacom DTF521", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL }; +static struct wacom_features wacom_features_0xC0 = + { "Wacom DTF720", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL }; +static struct wacom_features wacom_features_0xC2 = + { "Wacom DTF720a", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL }; +static struct wacom_features wacom_features_0x03 = + { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE, 20480, 15360, 511, 0, PTU }; +static struct wacom_features wacom_features_0x41 = + { "Wacom Intuos2 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS }; +static struct wacom_features wacom_features_0x42 = + { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; +static struct wacom_features wacom_features_0x43 = + { "Wacom Intuos2 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS }; +static struct wacom_features wacom_features_0x44 = + { "Wacom Intuos2 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS }; +static struct wacom_features wacom_features_0x45 = + { "Wacom Intuos2 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS }; +static struct wacom_features wacom_features_0xB0 = + { "Wacom Intuos3 4x5", WACOM_PKGLEN_INTUOS, 25400, 20320, 1023, 63, INTUOS3S }; +static struct wacom_features wacom_features_0xB1 = + { "Wacom Intuos3 6x8", WACOM_PKGLEN_INTUOS, 40640, 30480, 1023, 63, INTUOS3 }; +static struct wacom_features wacom_features_0xB2 = + { "Wacom Intuos3 9x12", WACOM_PKGLEN_INTUOS, 60960, 45720, 1023, 63, INTUOS3 }; +static struct wacom_features wacom_features_0xB3 = + { "Wacom Intuos3 12x12", WACOM_PKGLEN_INTUOS, 60960, 60960, 1023, 63, INTUOS3L }; +static struct wacom_features wacom_features_0xB4 = + { "Wacom Intuos3 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 1023, 63, INTUOS3L }; +static struct wacom_features wacom_features_0xB5 = + { "Wacom Intuos3 6x11", WACOM_PKGLEN_INTUOS, 54204, 31750, 1023, 63, INTUOS3 }; +static struct wacom_features wacom_features_0xB7 = + { "Wacom Intuos3 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 1023, 63, INTUOS3S }; +static struct wacom_features wacom_features_0xB8 = + { "Wacom Intuos4 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, 63, INTUOS4S }; +static struct wacom_features wacom_features_0xB9 = + { "Wacom Intuos4 6x9", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, 63, INTUOS4 }; +static struct wacom_features wacom_features_0xBA = + { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, 63, INTUOS4L }; +static struct wacom_features wacom_features_0xBB = + { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, 63, INTUOS4L }; +static struct wacom_features wacom_features_0x3F = + { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, 63, CINTIQ }; +static struct wacom_features wacom_features_0xC5 = + { "Wacom Cintiq 20WSX", WACOM_PKGLEN_INTUOS, 86680, 54180, 1023, 63, WACOM_BEE }; +static struct wacom_features wacom_features_0xC6 = + { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023, 63, WACOM_BEE }; +static struct wacom_features wacom_features_0xC7 = + { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511, 0, PL }; +static struct wacom_features wacom_features_0x90 = + { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; +static struct wacom_features wacom_features_0x93 = + { "Wacom ISDv4 93", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; +static struct wacom_features wacom_features_0x9A = + { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; +static struct wacom_features wacom_features_0x9F = + { "Wacom ISDv4 9F", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; +static struct wacom_features wacom_features_0xE2 = + { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }; +static struct wacom_features wacom_features_0xE3 = + { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }; +static struct wacom_features wacom_features_0xD1 = + { "Wacom Bamboo P&T 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; +static struct wacom_features wacom_features_0xD4 = + { "Wacom Bamboo Pen 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; +static struct wacom_features wacom_features_0xD2 = + { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; +static struct wacom_features wacom_features_0xD3 = + { "Wacom Bamboo P&T 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; +static struct wacom_features wacom_features_0xD0 = + { "Wacom Bamboo Touch", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; +static struct wacom_features wacom_features_0x47 = + { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; + +#define USB_DEVICE_WACOM(prod) \ + USB_DEVICE(USB_VENDOR_ID_WACOM,prod), \ + .driver_info = (uintptr_t)&wacom_features_##prod + +static struct usb_device_id wacom_ids[] = { + { USB_DEVICE_WACOM(0x00) }, + { USB_DEVICE_WACOM(0x10) }, + { USB_DEVICE_WACOM(0x11) }, + { USB_DEVICE_WACOM(0x12) }, + { USB_DEVICE_WACOM(0x13) }, + { USB_DEVICE_WACOM(0x14) }, + { USB_DEVICE_WACOM(0x15) }, + { USB_DEVICE_WACOM(0x16) }, + { USB_DEVICE_WACOM(0x17) }, + { USB_DEVICE_WACOM(0x18) }, + { USB_DEVICE_WACOM(0x19) }, + { USB_DEVICE_WACOM(0x60) }, + { USB_DEVICE_WACOM(0x61) }, + { USB_DEVICE_WACOM(0x62) }, + { USB_DEVICE_WACOM(0x63) }, + { USB_DEVICE_WACOM(0x64) }, + { USB_DEVICE_WACOM(0x65) }, + { USB_DEVICE_WACOM(0x69) }, + { USB_DEVICE_WACOM(0x20) }, + { USB_DEVICE_WACOM(0x21) }, + { USB_DEVICE_WACOM(0x22) }, + { USB_DEVICE_WACOM(0x23) }, + { USB_DEVICE_WACOM(0x24) }, + { USB_DEVICE_WACOM(0x30) }, + { USB_DEVICE_WACOM(0x31) }, + { USB_DEVICE_WACOM(0x32) }, + { USB_DEVICE_WACOM(0x33) }, + { USB_DEVICE_WACOM(0x34) }, + { USB_DEVICE_WACOM(0x35) }, + { USB_DEVICE_WACOM(0x37) }, + { USB_DEVICE_WACOM(0x38) }, + { USB_DEVICE_WACOM(0x39) }, + { USB_DEVICE_WACOM(0xC4) }, + { USB_DEVICE_WACOM(0xC0) }, + { USB_DEVICE_WACOM(0xC2) }, + { USB_DEVICE_WACOM(0x03) }, + { USB_DEVICE_WACOM(0x41) }, + { USB_DEVICE_WACOM(0x42) }, + { USB_DEVICE_WACOM(0x43) }, + { USB_DEVICE_WACOM(0x44) }, + { USB_DEVICE_WACOM(0x45) }, + { USB_DEVICE_WACOM(0xB0) }, + { USB_DEVICE_WACOM(0xB1) }, + { USB_DEVICE_WACOM(0xB2) }, + { USB_DEVICE_WACOM(0xB3) }, + { USB_DEVICE_WACOM(0xB4) }, + { USB_DEVICE_WACOM(0xB5) }, + { USB_DEVICE_WACOM(0xB7) }, + { USB_DEVICE_WACOM(0xB8) }, + { USB_DEVICE_WACOM(0xB9) }, + { USB_DEVICE_WACOM(0xBA) }, + { USB_DEVICE_WACOM(0xBB) }, + { USB_DEVICE_WACOM(0x3F) }, + { USB_DEVICE_WACOM(0xC5) }, + { USB_DEVICE_WACOM(0xC6) }, + { USB_DEVICE_WACOM(0xC7) }, + { USB_DEVICE_WACOM(0x90) }, + { USB_DEVICE_WACOM(0x93) }, + { USB_DEVICE_WACOM(0x9A) }, + { USB_DEVICE_WACOM(0x9F) }, + { USB_DEVICE_WACOM(0xE2) }, + { USB_DEVICE_WACOM(0xE3) }, + { USB_DEVICE_WACOM(0xD1) }, + { USB_DEVICE_WACOM(0xD4) }, + { USB_DEVICE_WACOM(0xD2) }, + { USB_DEVICE_WACOM(0xD3) }, + { USB_DEVICE_WACOM(0xD0) }, + { USB_DEVICE_WACOM(0x47) }, + { } +}; + static struct usb_driver wacom_driver = { .name = "wacom", + .id_table = wacom_ids, .probe = wacom_probe, .disconnect = wacom_disconnect, .suspend = wacom_suspend, @@ -718,7 +967,6 @@ static struct usb_driver wacom_driver = { static int __init wacom_init(void) { int result; - wacom_driver.id_table = get_device_table(); result = usb_register(&wacom_driver); if (result == 0) printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" @@ -733,3 +981,4 @@ static void __exit wacom_exit(void) module_init(wacom_init); module_exit(wacom_exit); +MODULE_DEVICE_TABLE(usb, wacom_ids); diff --git a/src/2.6.27/wacom_wac.c b/src/2.6.27/wacom_wac.c index 3531c5c..773001d 100755 --- a/src/2.6.27/wacom_wac.c +++ b/src/2.6.27/wacom_wac.c @@ -152,41 +152,34 @@ static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo) static void wacom_bpt_finger_in(struct wacom_wac *wacom, void *wcombo, char *data, int idx) { - int x = 0, y = 0, pressure, i = idx; + int x = 0, y = 0, pressure; + int finger = idx + 1; - if (idx == 2) { - i = 0; - } - - pressure = (data[2 + (i * 9)] & 0xff); - x = wacom_be16_to_cpu ((unsigned char *)&data[3 + (i * 9)]) & 0x7ff; - y = wacom_be16_to_cpu ((unsigned char *)&data[5 + (i * 9)]) & 0x7ff; + pressure = (data[2 + (idx * 9)] & 0xff); + x = wacom_be16_to_cpu ((unsigned char *)&data[3 + (idx * 9)]) & 0x7ff; + y = wacom_be16_to_cpu ((unsigned char *)&data[5 + (idx * 9)]) & 0x7ff; wacom_report_abs(wcombo, ABS_X, x); wacom_report_abs(wcombo, ABS_Y, y); wacom_report_abs(wcombo, ABS_PRESSURE, pressure); wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); - wacom_report_key(wcombo, wacom->tool[i], 1); + wacom_report_key(wcombo, wacom->tool[idx], 1); if (idx) - wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); + wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, finger); else wacom_report_key(wcombo, BTN_TOUCH, 1); } static void wacom_bpt_touch_out(struct wacom_wac *wacom, void *wcombo, int idx) { - if (idx != 2) { - wacom_report_abs(wcombo, ABS_X, 0); - wacom_report_abs(wcombo, ABS_Y, 0); - wacom_report_abs(wcombo, ABS_PRESSURE, 0); - wacom_report_abs(wcombo, ABS_MISC, 0); - wacom_report_key(wcombo, wacom->tool[idx], 0); - if (idx) - wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); - else - wacom_report_key(wcombo, BTN_TOUCH, 0); - } + int finger = idx + 1; + wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); + wacom_report_key(wcombo, wacom->tool[idx], 0); + if (idx) + wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, finger); + else + wacom_report_key(wcombo, BTN_TOUCH, 0); } static void wacom_bpt_touch_in(struct wacom_wac *wacom, void *wcombo) @@ -194,14 +187,12 @@ static void wacom_bpt_touch_in(struct wacom_wac *wacom, void *wcombo) char *data = wacom->data; static int firstFinger = 0; static int secondFinger = 0; - static int thirdFinger = 0; wacom->tool[0] = BTN_TOOL_DOUBLETAP; wacom->id[0] = TOUCH_DEVICE_ID; wacom->tool[1] = BTN_TOOL_TRIPLETAP; wacom->id[1] = (((data[3] & 0x80) >> 7) & 0x1) | - (((data[12] & 0x80) >> 6) & 0x2) | - ((((data[17] & 0x30) >> 4) == 3) ? 0x4 : 0x0); + (((data[12] & 0x80) >> 6) & 0x2); /* First finger down */ if (data[3] & 0x80) { @@ -209,7 +200,6 @@ static void wacom_bpt_touch_in(struct wacom_wac *wacom, void *wcombo) firstFinger = 1; } else if (firstFinger) { wacom_bpt_touch_out(wacom, wcombo, 0); - firstFinger = 0; } /* Second finger down */ @@ -229,21 +219,8 @@ static void wacom_bpt_touch_in(struct wacom_wac *wacom, void *wcombo) secondFinger = 0; } - if (((data[17] & 0x30) >> 4) == 3) { - /* sync ? */ - if (firstFinger && secondFinger) - wacom_input_sync(wcombo); - wacom_bpt_finger_in(wacom, wcombo, data, 2); - thirdFinger = 1; - } else { - wacom_bpt_touch_out(wacom, wcombo, 2); - thirdFinger = 0; - } - - if (!(data[17] & 0x10)) { + if (!(data[3] & 0x80)) { firstFinger = 0; - secondFinger = 0; - thirdFinger = 0; } } @@ -261,26 +238,15 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, void *wcombo) /* Touch packet */ if (urb->actual_length == WACOM_PKGLEN_BBTOUCH) { - /* Check for pad data first or else it gets sent in with touch data */ - if (data[1]) { - wacom->id[1] = PAD_DEVICE_ID; - wacom_report_key(wcombo, BTN_1, data[1] & 0x1); - wacom_report_key(wcombo, BTN_2, (data[1] & 0x2) >> 1); - wacom_report_key(wcombo, BTN_3, (data[1] & 0x4) >> 2); - wacom_report_key(wcombo, BTN_4, (data[1] & 0x8) >> 3); - wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0); - wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]); - wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); - } else if (wacom->id[1] == PAD_DEVICE_ID) { - wacom->id[1] = 0; - wacom_report_key(wcombo, BTN_1, 0); - wacom_report_key(wcombo, BTN_2, 0); - wacom_report_key(wcombo, BTN_3, 0); - wacom_report_key(wcombo, BTN_4, 0); - wacom_report_key(wcombo, BTN_TOOL_FINGER, 0); - wacom_report_abs(wcombo, ABS_MISC, 0); - wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); - } + /* Send pad data first */ + wacom_report_key(wcombo, BTN_0, data[1] & 0x1); + wacom_report_key(wcombo, BTN_1, (data[1] & 0x2) >> 1); + wacom_report_key(wcombo, BTN_LEFT, (data[1] & 0x4) >> 2); + wacom_report_key(wcombo, BTN_RIGHT, (data[1] & 0x8) >> 3); + wacom_report_key(wcombo, BTN_TOOL_FINGER, data[1] & 0x0f ? 1 : 0); + wacom_report_abs(wcombo, ABS_MISC, PAD_DEVICE_ID); + wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); + wacom_input_sync(wcombo); prox = (data[17] & 0x30 >> 4); if (!stylusInProx) { @@ -289,36 +255,31 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, void *wcombo) wacom_bpt_touch_in(wacom, wcombo); touchOut = 1; retval = 1; - goto exit; } } else { if (wacom->id[1] & 0x1) { wacom_bpt_touch_out(wacom, wcombo, 0); /* sync first finger event */ - if ((wacom->id[1] & 0x2) || (wacom->id[1] & 0x4)) { + if (wacom->id[1] & 0x2) { wacom_input_sync(wcombo); } } if (wacom->id[1] & 0x2) { wacom_bpt_touch_out(wacom, wcombo, 1); } - if (wacom->id[1] & 0x4) { - wacom_bpt_touch_out(wacom, wcombo, 2); - } touchOut = 0; touchInProx = 1; retval = 1; - goto exit; } } else if (touchOut || !prox) { /* force touch out-prox */ wacom_bpt_touch_out(wacom, wcombo, 0); + wacom_bpt_touch_out(wacom, wcombo, 1); touchOut = 0; touchInProx = 1; retval = 1; - goto exit; } - } else if (urb->actual_length == WACOM_PKGLEN_GRAPHIRE) { /* Penabled */ + } else if (urb->actual_length == WACOM_PKGLEN_BBFUN) { /* Penabled */ int x, y, pressure, distance; int tip, button_1, button_2; int in_box, has_data, moving; @@ -329,7 +290,7 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, void *wcombo) button_2 = (data[1] & 0x04) >> 2; eraser = (data[1] & 0x08) >> 3; in_box = (data[1] & 0x10) >> 4; - has_data = (data[1] & 0x20) >> 5; + has_data = (data[1] & 0x20) >> 5; moving = (data[1] & 0x40) >> 6; prox = (data[1] & 0x80) >> 7; touchInProx = ~prox; @@ -1136,165 +1097,6 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w return; } -static struct wacom_features wacom_features[] = { - { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255, 0, PENPARTNER }, - { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }, - { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }, - { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511, 63, GRAPHIRE }, - { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, GRAPHIRE }, - { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }, - { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, WACOM_G4 }, - { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, WACOM_G4 }, - { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }, - { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511, 63, WACOM_MO }, - { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }, - { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }, - { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255, 63, GRAPHIRE }, - { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }, - { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511, 63, GRAPHIRE }, - { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511, 63, GRAPHIRE }, - { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }, - { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }, - { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS }, - { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }, - { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS }, - { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS }, - { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS }, - { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255, 0, PL }, - { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255, 0, PL }, - { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255, 0, PL }, - { "Wacom PL600SX", WACOM_PKGLEN_GRAPHIRE, 6260, 5016, 255, 0, PL }, - { "Wacom PL550", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 511, 0, PL }, - { "Wacom PL800", WACOM_PKGLEN_GRAPHIRE, 7220, 5780, 511, 0, PL }, - { "Wacom PL700", WACOM_PKGLEN_GRAPHIRE, 6758, 5406, 511, 0, PL }, - { "Wacom PL510", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL }, - { "Wacom DTU710", WACOM_PKGLEN_GRAPHIRE, 34080, 27660, 511, 0, PL }, - { "Wacom DTF521", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL }, - { "Wacom DTF720", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL }, - { "Wacom DTF720a", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL }, - { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE, 20480, 15360, 511, 0, PTU }, - { "Wacom Intuos2 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS }, - { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }, - { "Wacom Intuos2 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS }, - { "Wacom Intuos2 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS }, - { "Wacom Intuos2 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS }, - { "Wacom Intuos3 4x5", WACOM_PKGLEN_INTUOS, 25400, 20320, 1023, 63, INTUOS3S }, - { "Wacom Intuos3 6x8", WACOM_PKGLEN_INTUOS, 40640, 30480, 1023, 63, INTUOS3 }, - { "Wacom Intuos3 9x12", WACOM_PKGLEN_INTUOS, 60960, 45720, 1023, 63, INTUOS3 }, - { "Wacom Intuos3 12x12", WACOM_PKGLEN_INTUOS, 60960, 60960, 1023, 63, INTUOS3L }, - { "Wacom Intuos3 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 1023, 63, INTUOS3L }, - { "Wacom Intuos3 6x11", WACOM_PKGLEN_INTUOS, 54204, 31750, 1023, 63, INTUOS3 }, - { "Wacom Intuos3 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 1023, 63, INTUOS3S }, - { "Wacom Intuos4 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, 63, INTUOS4S }, - { "Wacom Intuos4 6x9", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, 63, INTUOS4 }, - { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, 63, INTUOS4L }, - { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, 63, INTUOS4L }, - { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, 63, CINTIQ }, - { "Wacom Cintiq 20WSX", WACOM_PKGLEN_INTUOS, 86680, 54180, 1023, 63, WACOM_BEE }, - { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023, 63, WACOM_BEE }, - { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511, 0, PL }, - { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }, - { "Wacom ISDv4 93", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }, - { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }, - { "Wacom ISDv4 9F", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }, - { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }, - { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }, - { "Wacom Bamboo P&T 4x5", WACOM_PKGLEN_GRAPHIRE, 14720, 9200, 1023, 63, BAMBOO_PT }, - { "Wacom Bamboo Pen 4x5", WACOM_PKGLEN_GRAPHIRE, 14720, 9200, 1023, 63, BAMBOO_PT }, - { "Wacom Bamboo Craft", WACOM_PKGLEN_GRAPHIRE, 14720, 9200, 1023, 63, BAMBOO_PT }, - { "Wacom Bamboo P&T 6x8", WACOM_PKGLEN_GRAPHIRE, 21648, 13530, 1023, 63, BAMBOO_PT }, - { "Wacom Bamboo Touch", WACOM_PKGLEN_GRAPHIRE, 14720, 9200, 1023, 63, BAMBOO_PT }, - { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }, - { } -}; - -static struct usb_device_id wacom_ids[] = { - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x00) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x10) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x11) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x12) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x13) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x14) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x15) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x16) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x17) }, - { 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, 0x61) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x62) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x63) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x64) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x65) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x69) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x20) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x21) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x22) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x23) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x24) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x30) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x31) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x32) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x33) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x34) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x35) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x37) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x38) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x39) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC4) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC0) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC2) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x43) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x44) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x45) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB0) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB1) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB2) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB3) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB4) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB7) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB8) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB9) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xBA) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xBB) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC5) }, - { 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, 0x9F) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xE2) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xE3) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xD1) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xD4) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xD2) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xD3) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xD0) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, - { } -}; - -const struct usb_device_id *get_device_table(void) -{ - const struct usb_device_id *id_table = wacom_ids; - - return id_table; -} - -struct wacom_features * get_wacom_feature(const struct usb_device_id *id) -{ - int index = id - wacom_ids; - struct wacom_features *wf = &wacom_features[index]; - - return wf; -} - #define WAC_LED_RETRIES 10 #define ICON_TRANSFER_STOP 0 #define ICON_TRANSFER_START 1 @@ -1547,5 +1349,3 @@ int wacom_ioctl(struct usb_interface *intf, unsigned int code, void *buf) return ret; } - -MODULE_DEVICE_TABLE(usb, wacom_ids); diff --git a/src/include/Xwacom.h b/src/include/Xwacom.h index e10c675..92b8aa8 100755 --- a/src/include/Xwacom.h +++ b/src/include/Xwacom.h @@ -22,25 +22,30 @@ #include -#define XWACOM_PARAM_TOPX 1 -#define XWACOM_PARAM_TOPY 2 -#define XWACOM_PARAM_BOTTOMX 3 -#define XWACOM_PARAM_BOTTOMY 4 -#define XWACOM_PARAM_DEBUGLEVEL 5 -#define XWACOM_PARAM_PRESSCURVE 6 -#define XWACOM_PARAM_MODE 7 -#define XWACOM_PARAM_TPCBUTTON 8 -#define XWACOM_PARAM_TOUCH 9 -#define XWACOM_PARAM_CURSORPROX 10 -#define XWACOM_PARAM_ROTATE 11 -#define XWACOM_PARAM_TWINVIEW 12 -#define XWACOM_PARAM_SUPPRESS 13 -#define XWACOM_PARAM_SCREEN_NO 14 -#define XWACOM_PARAM_COMMONDBG 15 -#define XWACOM_PARAM_RAWSAMPLE 16 -#define XWACOM_PARAM_CAPACITY 17 -#define XWACOM_PARAM_SERIAL 18 -#define XWACOM_PARAM_GESTURE 19 +#define XWACOM_PARAM_TOPX 1 +#define XWACOM_PARAM_TOPY 2 +#define XWACOM_PARAM_BOTTOMX 3 +#define XWACOM_PARAM_BOTTOMY 4 +#define XWACOM_PARAM_DEBUGLEVEL 5 +#define XWACOM_PARAM_PRESSCURVE 6 +#define XWACOM_PARAM_MODE 7 +#define XWACOM_PARAM_TPCBUTTON 8 +#define XWACOM_PARAM_TOUCH 9 +#define XWACOM_PARAM_CURSORPROX 10 +#define XWACOM_PARAM_ROTATE 11 +#define XWACOM_PARAM_TWINVIEW 12 +#define XWACOM_PARAM_SUPPRESS 13 +#define XWACOM_PARAM_SCREEN_NO 14 +#define XWACOM_PARAM_COMMONDBG 15 +#define XWACOM_PARAM_RAWSAMPLE 16 +#define XWACOM_PARAM_CAPACITY 17 +#define XWACOM_PARAM_SERIAL 18 +#define XWACOM_PARAM_GESTURE 19 +#define XWACOM_PARAM_RIGHTCLICKDISTANCE 20 +#define XWACOM_PARAM_ZOOMPINCHDISTANCE 21 +#define XWACOM_PARAM_ACTIVATEDISTANCE 22 +#define XWACOM_PARAM_SCROLLACTIVATEDISTANCE 23 +#define XWACOM_PARAM_GESTURETAPTIME 24 /* The followings are defined together */ #define XWACOM_PARAM_BUTTON1 101 diff --git a/src/util/10-linuxwacom.fdi b/src/util/10-linuxwacom.fdi index 1aef0d1..ed7a530 100644 --- a/src/util/10-linuxwacom.fdi +++ b/src/util/10-linuxwacom.fdi @@ -68,28 +68,4 @@ - - - - - - - stylus - - - eraser - - - cursor - - - pad - - - touch - - - - - diff --git a/src/util/wacomcfg.c b/src/util/wacomcfg.c index 7da42cc..7af7b6d 100755 --- a/src/util/wacomcfg.c +++ b/src/util/wacomcfg.c @@ -277,10 +277,10 @@ WACOMDEVICETYPE mapStringToType (const char* name) return WACOMDEVICETYPE_STYLUS; else if (strstr(name,"eraser") != NULL) return WACOMDEVICETYPE_ERASER; - else if (strstr(name,"touch") != NULL) - return WACOMDEVICETYPE_TOUCH; else if (strstr(name,"pad") != NULL) return WACOMDEVICETYPE_PAD; + else if (strstr(name,"touch") != NULL) + return WACOMDEVICETYPE_TOUCH; else /* HAL eliminated stylus in the name for stylus */ return WACOMDEVICETYPE_STYLUS; diff --git a/src/util/xidump.c b/src/util/xidump.c index da04088..8e4c410 100755 --- a/src/util/xidump.c +++ b/src/util/xidump.c @@ -501,6 +501,7 @@ static int CursesRun(Display* pDisp, XDeviceInfo* pDevInfo, FORMATTYPE fmt) nProxRow = nRow++; nFocusRow = nRow++; nButtonRow = nRow++; + nRow++; /* Add extra row for up to 10 buttons */ nKeyRow = nRow++; wacscrn_output(nProxRow, 0,"Proximity:"); @@ -617,13 +618,18 @@ static int CursesRun(Display* pDisp, XDeviceInfo* pDevInfo, FORMATTYPE fmt) (pAny->type == gnInputEvent[INPUTEVENT_BTN_RELEASE])) { XDeviceButtonEvent* pBtn = (XDeviceButtonEvent*)pAny; + int nButtonDisplayRow = nButtonRow; bDown = (pAny->type == gnInputEvent[INPUTEVENT_BTN_PRESS]); nBtn = pBtn->button; - if ((nBtn < 1) || (nBtn > 5)) nBtn=6; - snprintf(chBuf,sizeof(chBuf),"%d-%s",pBtn->button, + if ((nBtn < 1) || (nBtn > 10)) nBtn=11; + snprintf(chBuf,sizeof(chBuf),"%02d-%s",pBtn->button, bDown ? "DOWN" : "UP "); if (bDown) wacscrn_standout(); - wacscrn_output(nButtonRow,12 + (nBtn-1) * 10,chBuf); + if (nBtn > 7) { + nBtn -= 7; + nButtonDisplayRow++; + } + wacscrn_output(nButtonDisplayRow,12 + (nBtn-1) * 10,chBuf); if (bDown) wacscrn_normal(); } else if ((pAny->type == gnInputEvent[INPUTEVENT_KEY_PRESS]) || @@ -633,7 +639,7 @@ static int CursesRun(Display* pDisp, XDeviceInfo* pDevInfo, FORMATTYPE fmt) bDown = (pAny->type == gnInputEvent[INPUTEVENT_KEY_PRESS]); nBtn = pKey->keycode - 7; /* first key is always 8 */ if ((nBtn < 1) || (nBtn > 5)) nBtn=6; - snprintf(chBuf,sizeof(chBuf),"%d-%s",pKey->keycode - 7, + snprintf(chBuf,sizeof(chBuf),"02%d-%s",pKey->keycode - 7, bDown ? "DOWN" : "UP "); if (bDown) wacscrn_standout(); wacscrn_output(nKeyRow,12 + (nBtn-1) * 10,chBuf); diff --git a/src/util/xsetwacom.c b/src/util/xsetwacom.c index de9c5b3..bce62c4 100755 --- a/src/util/xsetwacom.c +++ b/src/util/xsetwacom.c @@ -365,6 +365,31 @@ static PARAMINFO gParamInfo[] = "Turns on/off Touch Gesture (default is enable/on). ", XWACOM_PARAM_GESTURE, VALUE_OPTIONAL, RANGE, 0, 1, BOOLEAN_VALUE, 1 }, + + { "RightClickDistance", + "Maximum finger spacing allowed for a right click touch gesture. ", + XWACOM_PARAM_RIGHTCLICKDISTANCE, VALUE_OPTIONAL, + RANGE, 0, 10000, SINGLE_VALUE, 300 }, + + { "ZoomPinchDistance", + "Minimum distance required before starting a zoom touch gesture. ", + XWACOM_PARAM_ZOOMPINCHDISTANCE, VALUE_OPTIONAL, + RANGE, 0, 10000, SINGLE_VALUE, 350 }, + + { "ActivateDistance", + "Minimum finger motion distance required for starting any gesture. ", + XWACOM_PARAM_ACTIVATEDISTANCE, VALUE_OPTIONAL, + RANGE, 0, 10000, SINGLE_VALUE, 50 }, + + { "ScrollActivateDistance", + "Minimum finger motion distance required for starting a scroll gesture. ", + XWACOM_PARAM_SCROLLACTIVATEDISTANCE, VALUE_OPTIONAL, + RANGE, 0, 10000, SINGLE_VALUE, 50 }, + + { "GestureTapTime", + "Maximum time between events required to start a gesture. ", + XWACOM_PARAM_GESTURETAPTIME, VALUE_OPTIONAL, + RANGE, 0, 500, SINGLE_VALUE, 150 }, { "Capacity", "Touch sensitivity level (default is 3, " diff --git a/src/wacom.4x b/src/wacom.4x index d4adb6c..283a8cd 100644 --- a/src/wacom.4x +++ b/src/wacom.4x @@ -99,7 +99,8 @@ sets the mode of the device. The default value for stylus and eraser is Absolute; cursor is Relative; pad mode is decided according to its core option due to its nature of not moving system cursor: Relative if it is a core device; Absolute, otherwise; -touch is always in absolute mode. +touch defaults to Relative for tablets with touch pads and Absolute for +touch screens. .TP 4 .B Option \fI"TopX"\fP \fI"number"\fP X coordinate of the top corner of the active zone. Default to 0. diff --git a/src/wacomxi/wacomcpl-exec b/src/wacomxi/wacomcpl-exec index d4dfddd..4e6b10d 100755 --- a/src/wacomxi/wacomcpl-exec +++ b/src/wacomxi/wacomcpl-exec @@ -528,9 +528,9 @@ proc CreateDevicePanel { type model } { } elseif { ![ string compare $type "touch" ] } { if { $hasTouch($model) } { if { $hasGesture($model) } { - createPanel 1 1 0 1 - } else { createPanel 1 0 0 1 + } else { + createPanel 1 1 0 1 } } } elseif { $isLCD($model) } { @@ -925,7 +925,7 @@ proc displayMode {} { grid $currentW.f.mode -row 4 -column 1 grid $currentW.f.modeL -row 4 -column 0 } - + if { ![ string compare $type "stylus" ] } { set smv $sm([ expr $getOption($device,TPCButton)+1 ]) tk_optionMenu $currentW.f.smode smv $sm(1) $sm(2) @@ -1637,47 +1637,57 @@ proc updateKeys {} { } } -proc touchState { theCButton } { +proc touchState { theTouchButton theGestureButton } { global device touchButton getDeviceModel set touchButton 0 if { $touchButton == [exec xsetwacom get $device touch] } { set touchButton 1 } - checkbutton $theCButton -text "Disable Touch" -anchor w \ - -variable touchButton -state normal -command "switchTouch 0" + checkbutton $theTouchButton -text "Disable Touch" -anchor w \ + -variable touchButton -state normal -command "switchTouch $theTouchButton $theGestureButton" } -proc gestureState { theCButton } { +proc gestureState { theGestureButton } { global device touchButton getDeviceModel hasGesture gestureButton set gestureButton 0 # gesture supported and touch is on - if { $touchButton} { + if { ! $touchButton } { if { $gestureButton == [exec xsetwacom get $device gesture] } { set gestureButton 1 } - checkbutton $theCButton -text "Disable Touch Gesture" -anchor w \ - -variable touchButton -state normal -command switchGesture + checkbutton $theGestureButton -text "Disable Touch Gesture" -anchor w \ + -variable gestureButton -state normal -command switchGesture } else { - checkbutton $theCButton -text "Disable Touch Gesture" -anchor w \ + checkbutton $theGestureButton -text "Disable Touch Gesture" -anchor w \ -variable gestureButton -state disabled -command switchGesture } } proc initialTouch {} { - global device getDeviceModel currentW - global getOption getOptionDefault Option hasCapacity + global device getDeviceModel currentW + global getOption getOptionDefault Option hasCapacity hasGesture set model $getDeviceModel($device,model) set Option(1) "Capacity" - set Option(2) "touch" + set Option(2) "Touch" + set Option(3) "Mode" - getDeviceOptionProc $device 2 + getDeviceOptionProc $device 3 - touchState $currentW.f.touch - grid $currentW.f.touch -row 0 -column 2 + if { $hasGesture($model) } { + touchState $currentW.f.touch $currentW.f.gesture + gestureState $currentW.f.gesture + grid $currentW.f.gesture -row 1 -column 2 + } else { + touchState $currentW.f.touch 0 + } + grid $currentW.f.touch -row 0 -column 2 + + displayMode + frame $currentW.f.group -bd 10 -bg beige -width 150 -height 150 label $currentW.f.groupL -text "Sensitivity: " grid $currentW.f.groupL -row 2 -column 6 @@ -1700,7 +1710,7 @@ proc initialTouch {} { } proc updateTouch {} { - global currentW getOption device + global currentW getOption device dm dmv set value [ $currentW.f.group.scale get ] if { $value != $getOption($device,Capacity) } { @@ -1708,7 +1718,15 @@ proc updateTouch {} { set getOption($device,Capacity) $value } - switchTouch 1 + set mode [ $currentW.f.mode cget -text ] + updateXinitrc $device mode $mode + if { $mode == $dm(1) } { + set getOption($device,Mode) 0 + } else { + set getOption($device,Mode) 1 + } + + switchTouch $currentW.f.touch $currentW.f.gesture closeSubWindow } @@ -1716,7 +1734,7 @@ proc updateTouch {} { proc defaultTouch {} { global touchButton currentW getOptionDefault device - if { [ exec xsetwacom get $device touch ] != $getOptionDefault($device,touch) } { + if { [ exec xsetwacom get $device touch ] != $getOptionDefault($device,Touch) } { set touchButton [ exec xsetwacom get $device touch ] if { [ exec xsetwacom getdefault $device capacity ] < 0 } { if { $touchButton == 0 } { @@ -1730,43 +1748,40 @@ proc defaultTouch {} { $currentW.f.group.scale set $getOptionDefault($device,Capacity) } -proc switchTouch { window } { - global device touchButton gestureButton hasGesture +proc switchTouch { theTouchButton theGestureButton } { + global device getDeviceModel currentW touchButton + global gestureButton hasGesture - # don't send the command for touch with capacity - if { [ exec xsetwacom getdefault $device capacity ] >= 0 && $window == 0 } { - return - } + set model $getDeviceModel($device,model) if { $touchButton == [ exec xsetwacom get $device touch ] } { if { $touchButton == 0 } { .panel.calibrate configure -state normal exec xsetwacom set $device touch 1 updateXinitrc $device touch 1 - if { $hasGesture } { - .panel.button configure -state normal + if { $hasGesture($model) } { + $theGestureButton configure -state normal } } else { .panel.calibrate configure -state disabled exec xsetwacom set $device touch 0 updateXinitrc $device touch 0 - if { $hasGesture } { - .panel.button configure -state disabled + if { $hasGesture($model) } { + $theGestureButton configure -state disabled } } } } proc switchGesture { } { - global device touchButton gestureButton hasGesture + global device touchButton + global gestureButton hasGesture - if { $touchGesture == [ exec xsetwacom get $device gesture ] } { - if { $touchGesture == 0 } { - .panel.button configure -state normal + if { $gestureButton == [ exec xsetwacom get $device gesture ] } { + if { $gestureButton == 0 } { exec xsetwacom set $device gesture 1 updateXinitrc $device gesture 1 } else { - .panel.button configure -state disabled exec xsetwacom set $device gesture 0 updateXinitrc $device gesture 0 } @@ -1809,14 +1824,15 @@ proc createPanel { pressure button mapping calibrate } { button .panel.pressure -text $wName(1) \ -state normal -command "displaySubWindow \ updateTouch defaultTouch initialTouch 1 0 0" + if { [ exec xsetwacom get $device touch ] == 1 } { .panel.calibrate configure -state normal } else { .panel.calibrate configure -state disable } } else { - touchState .panel.pressure - } + touchState .panel.pressure .panel.button + } } else { set wName(1) "Feel" button .panel.pressure -text $wName(1) \ @@ -1826,16 +1842,16 @@ proc createPanel { pressure button mapping calibrate } { grid .panel.pressure -row 5 -column 0 -columnspan 2 -sticky news -padx 10 } if { $button } { - if { ![string compare $getDeviceModel($device,type) "touch"] } { - set model $getDeviceModel($device,model) + set model $getDeviceModel($device,model) + if { ![string compare $getDeviceModel($device,type) "touch"] && !$hasCapacity($model) } { if { $hasGesture($model) } { - gestureState .panel.button + gestureState .panel.button } - } - if { ![string compare $getDeviceModel($device,type) "pad"] } { + } elseif { ![string compare $getDeviceModel($device,type) "pad"] } { button .panel.button -text $wName(6) \ -state normal -command "displaySubWindow \ updateButton defaultButton initialButton 6 0 $startS" + grid .panel.button -row 6 -column 0 -columnspan 2 -sticky news -padx 10 } else { button .panel.button -text $wName(2) \ -state normal -command "displaySubWindow \ @@ -1922,9 +1938,12 @@ proc updateModelInfo { } { } # Bamboo Pen and Touch - for { set i 208 } { $i <= 212 } { incr i 1 } { + for { set i 208 } { $i <= 211 } { incr i 1 } { set hasPad($i) 1 set numPadButtons($i) 4 + set hasCapacity($i) 1 + set hasTouch($i) 1 + set hasGesture($i) 1 } # I3 diff --git a/src/xdrv/wcmCommon.c b/src/xdrv/wcmCommon.c index 4d2e1b0..f08a5b4 100755 --- a/src/xdrv/wcmCommon.c +++ b/src/xdrv/wcmCommon.c @@ -35,7 +35,7 @@ extern int xf86WcmDevSwitchModeCall(LocalDevicePtr local, int mode); extern void xf86WcmChangeScreen(LocalDevicePtr local, int value); extern void xf86WcmTilt2R(WacomDeviceStatePtr ds); -extern void xf86WcmFingerTapToClick(WacomCommonPtr common); +extern void xf86WcmFingerTapToClick(WacomCommonPtr common, WacomDevicePtr priv); extern void xf86WcmSetScreen(LocalDevicePtr local, int v0, int v1); /***************************************************************************** @@ -771,7 +771,7 @@ void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds) } /* don't apply acceleration when too fast. */ y *= param > 20.00 ? 20.00 : param; - } + } } if (type != PAD_ID) @@ -1018,6 +1018,7 @@ void xf86WcmEvent(WacomCommonPtr common, unsigned int channel, WacomDeviceState ds; WacomChannelPtr pChannel; WacomFilterState* fs; + WacomDevicePtr priv = common->wcmDevices; int i, suppress = 0; pChannel = common->wcmChannel + channel; @@ -1047,6 +1048,17 @@ void xf86WcmEvent(WacomCommonPtr common, unsigned int channel, ds.discard_first, ds.proximity, ds.sample, pChannel->nSamples)); + + /* Find the device with touch information */ + if (ds.device_type == TOUCH_ID && !IsTouch(priv)) { + + for (; priv != NULL && !IsTouch(priv); priv = priv->next); + + if (priv == NULL || !IsTouch(priv)) { + xf86Msg(X_ERROR, "xf86WcmEvent: could not find core touch device."); + priv = common->wcmDevices; + } + } #ifdef WCM_ENABLE_LINUXINPUT /* Discard the first 2 USB packages due to events delay */ if ( (pChannel->nSamples < 2) && (common->wcmDevCls == &gWacomUSBDevice) && @@ -1138,15 +1150,14 @@ void xf86WcmEvent(WacomCommonPtr common, unsigned int channel, WacomChannelPtr pOtherChannel; WacomDeviceState dsOther; - /* exit gesture mode when both fingers are out */ + /* Get the other channel state */ if (channel) pOtherChannel = common->wcmChannel; else pOtherChannel = common->wcmChannel + 1; dsOther = pOtherChannel->valid.state; - /* This is the only place to reset gesture mode - * once a gesture mode is entered */ + /* Exit gesture mode when both fingers are out. */ if (!ds.proximity && !dsOther.proximity) { common->wcmGestureMode = 0; @@ -1162,22 +1173,27 @@ void xf86WcmEvent(WacomCommonPtr common, unsigned int channel, if (!channel && common->wcmGestureMode) goto ret; - /* process gesture when both touch and geature are enabled */ + /* process gesture when both touch and gesture are enabled */ if (channel) { - xf86WcmFingerTapToClick(common); + xf86WcmFingerTapToClick(common, priv); goto ret; } } } - /* process single finger events */ - if (ds.device_type == TOUCH_ID && common->wcmTouch && !common->wcmGesture) + /* process single finger events + * if touch is in Relative mode then allow single click + * to work regardless of gesture on/off state. + * Also ensure that we don't try to process single clicks + * when in an active gesture mode. + */ + if (ds.device_type == TOUCH_ID && common->wcmTouch && + (common->wcmCapacityDefault && !(priv->flags & ABSOLUTE_FLAG) && !common->wcmGestureMode)) { WacomDeviceState* pds = &common->wcmTouchpadState; - WacomDevicePtr priv = common->wcmDevices; - if (ds.proximity) + if (ds.proximity) { switch (common->wcmTouchpadMode) { case 0: @@ -1194,38 +1210,26 @@ void xf86WcmEvent(WacomCommonPtr common, unsigned int channel, common->wcmTouchpadMode = 2; } else { /* left button down */ - xf86PostButtonEvent(priv->local->dev, - priv->flags & ABSOLUTE_FLAG, - 1,1,0,priv->naxes, priv->oldX, - priv->oldY,0,0,0,0); + xf86PostButtonEvent(priv->local->dev,FALSE,1,TRUE,0,0); common->wcmTouchpadMode = 3; } break; } - else { + } else { switch (common->wcmTouchpadMode) { case 1: if (GetTimeInMillis() - pds->sample <= 200) { /* left button down */ - xf86PostButtonEvent(priv->local->dev, - priv->flags & ABSOLUTE_FLAG, - 1,1,0,priv->naxes, priv->oldX, - priv->oldY,0,0,0,0); + xf86PostButtonEvent(priv->local->dev,FALSE,1,TRUE,0,0); /* left button up */ - xf86PostButtonEvent(priv->local->dev, - priv->flags & ABSOLUTE_FLAG, - 1,0,0,priv->naxes, priv->oldX, - priv->oldY,0,0,0,0); + xf86PostButtonEvent(priv->local->dev,FALSE,1,FALSE,0,0); } break; case 3: /* left button up */ - xf86PostButtonEvent(priv->local->dev, - priv->flags & ABSOLUTE_FLAG, - 1,0,0,priv->naxes, priv->oldX, - priv->oldY,0,0,0,0); + xf86PostButtonEvent(priv->local->dev,FALSE,1,FALSE,0,0); } common->wcmTouchpadMode = 0; } @@ -1233,8 +1237,12 @@ void xf86WcmEvent(WacomCommonPtr common, unsigned int channel, ds.buttons &= ~1; } - /* everything else falls here */ - commonDispatchDevice(common,channel,pChannel, suppress); + /* everything else falls here, + * dispatch unless this is destined for a touch + * device and touch is disabled. + */ + if (ds.device_type != TOUCH_ID || common->wcmTouch) + commonDispatchDevice(common,channel,pChannel, suppress); ret: resetSampleCounter(pChannel); } diff --git a/src/xdrv/wcmConfig.c b/src/xdrv/wcmConfig.c index 3dfd941..15bb1dc 100755 --- a/src/xdrv/wcmConfig.c +++ b/src/xdrv/wcmConfig.c @@ -200,6 +200,16 @@ LocalDevicePtr xf86WcmAllocate(char* name, int flag) common->wcmGestureMode = 0; /* touch is not in Gesture mode */ common->wcmGesture = 0; /* touch Gesture is disabled */ common->wcmGestureDefault = 0; /* default to disable when touch Gesture isn't supported */ + common->wcmRightClickDistance = 300; /* maximum distance allowed for right click touch gesture */ + common->wcmRightClickDistanceDefault = 300; /* default maximum distance allowed for right click touch gesture */ + common->wcmZoomPinchDistance = 350; /* minimum distance allowed for zoom touch gesture */ + common->wcmZoomPinchDistanceDefault = 350; /* default minimum distance allowed for zoom touch gesture */ + common->wcmActivateDistance = 50; /* minimum motion required before sending on a scroll gesture */ + common->wcmActivateDistanceDefault = 50; /* default minimum motion required before sending on a scroll gesture */ + common->wcmScrollActivateDistance = 50; /* minimum parallel motion required before entering scroll gesture */ + common->wcmScrollActivateDistanceDefault = 50; /* default minimum parallel motion required before entering scroll gesture */ + common->wcmGestureTapTime = 150; /* minimum time between events required to start a gesture */ + common->wcmGestureTapTimeDefault = 150; /* default minimum time between events required to start a gesture */ common->wcmCapacity = -1; /* Capacity is disabled */ common->wcmCapacityDefault = -1; /* default to -1 when capacity isn't supported */ /* 3 when capacity is supported */ @@ -413,7 +423,7 @@ static Bool xf86WcmMatchDevice(LocalDevicePtr pMatch, LocalDevicePtr pLocal) !strcmp(privMatch->common->wcmDevice, common->wcmDevice)) { DBG(2, priv->debugLevel, ErrorF( - "xf86WcmInit wacom port share between" + "xf86WcmMatchDevice: wacom port share between" " %s and %s\n", pLocal->name, pMatch->name)); type = xf86FindOptionValue(pMatch->options, "Type"); if ( type && (strstr(type, "eraser")) ) @@ -426,6 +436,44 @@ static Bool xf86WcmMatchDevice(LocalDevicePtr pMatch, LocalDevicePtr pLocal) privMatch->common->wcmEraserID=pLocal->name; } } + + /* If pad was sent in first on a touch device + * then it got all of the configuration data and + * did not put it in the correct places. + * Make sure the correct common touch variables are initialized. + */ + if ( (privMatch->common->tablet_id >= 0xd0 && privMatch->common->tablet_id <= 0xd3) ) { + type = xf86FindOptionValue(pLocal->options, "Type"); + if ( type && strstr(type, "touch") ) { + type = xf86FindOptionValue(pMatch->options, "Type"); + if ( type && strstr(type, "pad") ) { + DBG(2, priv->debugLevel, ErrorF( + "xf86WcmMatchDevice: wacom detected pad initialized before touch\n")); + + privMatch->common->wcmCapacityDefault = 3; + privMatch->common->wcmMaxTouchX = privMatch->common->wcmMaxX; + privMatch->common->wcmMaxX = 0; + privMatch->common->wcmMaxTouchY = privMatch->common->wcmMaxY; + privMatch->common->wcmMaxY = 0; + privMatch->common->wcmTouchResolX = privMatch->common->wcmMaxStripX; + privMatch->common->wcmMaxStripX = 0; + privMatch->common->wcmTouchResolY = privMatch->common->wcmMaxStripY; + privMatch->common->wcmMaxStripY = 0; + if (privMatch->common->wcmMaxTouchX && privMatch->common->wcmTouchResolX) { + privMatch->common->wcmTouchResolX = + (int)(((double)privMatch->common->wcmTouchResolX) + / ((double)privMatch->common->wcmMaxTouchX) + 0.5); + } + if (privMatch->common->wcmMaxTouchY && privMatch->common->wcmTouchResolY) { + privMatch->common->wcmTouchResolY = + (int)(((double)privMatch->common->wcmTouchResolY) + / ((double)privMatch->common->wcmMaxTouchY) + 0.5); + } + } + } + } + + xfree(common); common = priv->common = privMatch->common; @@ -466,6 +514,36 @@ static void wcmDeviceSpecCommonOptions(LocalDevicePtr local, unsigned long* keys /* Touch gesture applies to the whole tablet */ common->wcmGesture = xf86SetBoolOption(local->options, "Gesture", common->wcmGestureDefault); + + /* Set Bamboo P&T Defaults for gesture size and timeouts */ + if (common->tablet_id >= 0xd0 && common->tablet_id <= 0xd3) { + common->wcmRightClickDistanceDefault = 100; + common->wcmZoomPinchDistanceDefault = 150; + common->wcmActivateDistanceDefault = 20; + common->wcmScrollActivateDistanceDefault = 20; + common->wcmGestureTapTimeDefault = 150; + } + + /* Set maximum distance allowed for right click touch gesture */ + common->wcmRightClickDistance = xf86SetIntOption(local->options, "RightClickDistance", + common->wcmRightClickDistanceDefault); + + /* Set minimum distance allowed for zoom touch gesture */ + common->wcmZoomPinchDistance = xf86SetIntOption(local->options, "ZoomPinchDistance", + common->wcmZoomPinchDistanceDefault); + + /* Set minimum motion required before sending on a scroll gesture */ + common->wcmActivateDistance = xf86SetIntOption(local->options, "ActivateDistance", + common->wcmActivateDistance); + + /* Set minimum parallel motion required before entering scroll gesture */ + common->wcmScrollActivateDistance = xf86SetIntOption(local->options, "ScrollActivateDistance", + common->wcmScrollActivateDistanceDefault); + + /* Set minimum time between events required to start a gesture */ + common->wcmGestureTapTime = xf86SetIntOption(local->options, "GestureTapTime", + common->wcmGestureTapTimeDefault); + } /* xf86WcmInit - called when the module subsection is found in XF86Config */ @@ -623,20 +701,25 @@ static LocalDevicePtr xf86WcmInit(InputDriverPtr drv, IDevPtr dev, int flags) priv->flags |= ABSOLUTE_FLAG; else if (s && (xf86NameCmp(s, "relative") == 0)) priv->flags &= ~ABSOLUTE_FLAG; - else if (s) + else { - xf86Msg(X_ERROR, "%s: invalid Mode (should be absolute or " - "relative). Using default.\n", dev->identifier); - - /* stylus/eraser defaults to absolute mode - * cursor defaults to relative mode + if (s) + xf86Msg(X_ERROR, "%s: invalid Mode (should be absolute" + "or relative). Using default.\n", + local->name); + + /* If Mode not specified or is invalid then rely on + * Type specific defaults from initialization. + * + * If Mode default is hardware specific then handle here: + * + * touch Types are initialized to Absolute. + * Bamboo P&T touch pads need to change default to Relative. */ - if (IsCursor(priv)) + if (IsTouch(priv) && + (common->tablet_id >= 0xd0 && common->tablet_id <= 0xd3)) priv->flags &= ~ABSOLUTE_FLAG; - else - priv->flags |= ABSOLUTE_FLAG; } - /* Pad is always in relative mode when it's a core device. * Always in absolute mode when it is not a core device. */ diff --git a/src/xdrv/wcmTouchFilter.c b/src/xdrv/wcmTouchFilter.c index 6f65a91..2c50a44 100644 --- a/src/xdrv/wcmTouchFilter.c +++ b/src/xdrv/wcmTouchFilter.c @@ -21,10 +21,6 @@ #include /* Defines for 2FC Gesture */ -#define WACOM_DIST_IN_POINT 300 -#define WACOM_APART_IN_POINT 350 -#define WACOM_MOTION_IN_POINT 50 -#define WACOM_PARA_MOTION_IN_POINT 50 #define WACOM_DOWN_TIME_IN_MS 800 #define WACOM_TIME_BETWEEN_IN_MS 400 #define WACOM_HORIZ_ALLOWED 1 @@ -34,10 +30,6 @@ #define GESTURE_SCROLL_MODE 2 #define GESTURE_ZOOM_MODE 4 - -/* Defines for Tap Add-a-Finger to Click */ -#define WACOM_TAP_TIME_IN_MS 150 - extern void xf86WcmRotateCoordinates(LocalDevicePtr local, int* x, int* y); extern void emitKeysym (DeviceIntPtr keydev, int keysym, int state); @@ -52,18 +44,18 @@ static double touchDistance(WacomDeviceState ds0, WacomDeviceState ds1) return distance; } -static Bool pointsInLine(WacomDeviceState ds0, WacomDeviceState ds1, int *direction) +static Bool pointsInLine(WacomCommonPtr common, WacomDeviceState ds0, WacomDeviceState ds1, int *direction) { Bool ret = FALSE; if (*direction == 0) { - if ( abs(ds0.x - ds1.x) < WACOM_PARA_MOTION_IN_POINT) + if ( abs(ds0.x - ds1.x) < common->wcmScrollActivateDistance) { *direction = WACOM_VERT_ALLOWED; ret = TRUE; } - else if (abs(ds0.y - ds1.y) < WACOM_PARA_MOTION_IN_POINT) + else if (abs(ds0.y - ds1.y) < common->wcmScrollActivateDistance) { *direction = WACOM_HORIZ_ALLOWED; ret = TRUE; @@ -71,22 +63,22 @@ static Bool pointsInLine(WacomDeviceState ds0, WacomDeviceState ds1, int *direct } else if (*direction == WACOM_HORIZ_ALLOWED) { - if ( abs(ds0.y - ds1.y) < WACOM_PARA_MOTION_IN_POINT) + if ( abs(ds0.y - ds1.y) < common->wcmScrollActivateDistance) ret = TRUE; } else if (*direction == WACOM_VERT_ALLOWED) { - if ( abs(ds0.x - ds1.x) < WACOM_PARA_MOTION_IN_POINT) + if ( abs(ds0.x - ds1.x) < common->wcmScrollActivateDistance) ret = TRUE; } return ret; } -static Bool pointsInLineAfter(int p1, int p2) +static Bool pointsInLineAfter(WacomCommonPtr common, int p1, int p2) { Bool ret = FALSE; - if ( abs(p1 - p2) < WACOM_PARA_MOTION_IN_POINT) + if ( abs(p1 - p2) < common->wcmScrollActivateDistance) ret = TRUE; return ret; @@ -99,10 +91,7 @@ static void xf86WcmSwitchLeftClick(WacomDevicePtr priv) if (common->wcmGestureMode) { /* send button one up */ - xf86PostButtonEvent(priv->local->dev, - priv->flags & ABSOLUTE_FLAG, - 1,0,0,priv->naxes, priv->oldX, - priv->oldY,0,0,0,0); + xf86PostButtonEvent(priv->local->dev,FALSE,1,FALSE,0,0); priv->oldButtons = 0; } } @@ -110,11 +99,11 @@ static void xf86WcmSwitchLeftClick(WacomDevicePtr priv) /***************************************************************************** * xf86WcmFingerTapToClick -- * translate second finger tap to right click + * priv should always be a touch device ****************************************************************************/ -void xf86WcmFingerTapToClick(WacomCommonPtr common) +void xf86WcmFingerTapToClick(WacomCommonPtr common, WacomDevicePtr priv) { - WacomDevicePtr priv = common->wcmDevices; WacomChannelPtr firstChannel = common->wcmChannel; WacomChannelPtr secondChannel = common->wcmChannel + 1; WacomDeviceState ds[2] = { firstChannel->valid.states[0], @@ -123,95 +112,91 @@ void xf86WcmFingerTapToClick(WacomCommonPtr common) secondChannel->valid.states[1] }; int direction = 0; - DBG(10, priv->debugLevel, ErrorF("xf86WcmFingerTapToClick \n")); + DBG(10, priv->debugLevel, ErrorF("xf86WcmFingerTapToClick: " + "mode = %d, " + "ds[0].x = %d, ds[0].y = %d, ds[1].x = %d, ds[1].y = %d, " + "ds[0].sample = %d, ds[1].sample = %d, " + "dsLast[0].sample = %d, dsLast[1].sample = %d, " + "ds[1].proximity = %s, dsLast[1].proximity = %s\n", + common->wcmGestureMode, + ds[0].x, ds[0].y, ds[1].x, ds[1].y, + ds[0].sample, ds[1].sample, + dsLast[0].sample, dsLast[1].sample, + ds[1].proximity ? "true" : "false", dsLast[1].proximity ? "true" : "false")); /* skip initial second finger event */ if (!dsLast[1].proximity) goto skipGesture; if (!IsTouch(priv)) { - /* go through the shared port */ - for (; priv; priv = priv->next) - { - if (IsTouch(priv)) - break; - } + /* this should never happen */ + xf86Msg(X_ERROR, "WACOM: No touch device found for %s \n", common->wcmDevice); + goto skipGesture; } - if (priv) /* found the first finger */ + /* process second finger tap if matched */ + if ((dsLast[0].sample < dsLast[1].sample) && ((GetTimeInMillis() - + dsLast[1].sample) <= common->wcmGestureTapTime)) { - /* allow only second finger tap */ - if ((dsLast[0].sample < dsLast[1].sample) && ((GetTimeInMillis() - - dsLast[1].sample) <= WACOM_TAP_TIME_IN_MS)) + /* send right click when second finger taps within WACOM_TAP_TIMEms + * and both fingers stay within WACOM_DIST */ + if (!ds[1].proximity && dsLast[1].proximity) { - /* send right click when second finger taps within WACOM_TAP_TIMEms - * and both fingers stay within WACOM_DIST */ - if (!ds[1].proximity && dsLast[1].proximity) + if (abs(touchDistance(ds[0], dsLast[1])) <= common->wcmRightClickDistance) { - if (touchDistance(ds[0], dsLast[1]) <= WACOM_DIST_IN_POINT) + /* send left up before sending right down */ + if (!common->wcmGestureMode) { - /* send left up before sending right down */ - if (!common->wcmGestureMode) - { - common->wcmGestureMode = GESTURE_TAP_MODE; - xf86WcmSwitchLeftClick(priv); - } - - /* right button down */ - xf86PostButtonEvent(priv->local->dev, - priv->flags & ABSOLUTE_FLAG, - 3,1,0,priv->naxes, priv->oldX, - priv->oldY,0,0,0,0); - /* right button up */ - xf86PostButtonEvent(priv->local->dev, - priv->flags & ABSOLUTE_FLAG, - 3,0,0,priv->naxes, priv->oldX, - priv->oldY,0,0,0,0); + common->wcmGestureMode = GESTURE_TAP_MODE; + xf86WcmSwitchLeftClick(priv); } + + /* right button down */ + xf86PostButtonEvent(priv->local->dev,FALSE,3,TRUE,0,0); + /* right button up */ + xf86PostButtonEvent(priv->local->dev,FALSE,3,FALSE,0,0); + } else if (common->wcmGestureMode == GESTURE_TAP_MODE){ + common->wcmGestureMode = 0; } } - else if ((WACOM_TAP_TIME_IN_MS < (GetTimeInMillis() - dsLast[0].sample)) && - (WACOM_TAP_TIME_IN_MS < (GetTimeInMillis() - dsLast[1].sample)) - && ds[0].proximity && ds[1].proximity) + } + + /* process complex two finger gestures */ + if ((common->wcmGestureTapTime < (GetTimeInMillis() - dsLast[0].sample)) && + (common->wcmGestureTapTime < (GetTimeInMillis() - dsLast[1].sample)) && + ds[0].proximity && ds[1].proximity) + { + if (abs(touchDistance(ds[0], ds[1])) >= common->wcmZoomPinchDistance && + common->wcmGestureMode != GESTURE_TAP_MODE && + common->wcmGestureMode != GESTURE_SCROLL_MODE) { - if (abs(touchDistance(ds[0], ds[1])) >= WACOM_APART_IN_POINT && - common->wcmGestureMode != GESTURE_TAP_MODE && - common->wcmGestureMode != GESTURE_SCROLL_MODE) - { - /* fingers moved apart more than WACOM_APART_IN_POINT - * zoom mode is entered */ - if (!common->wcmGestureMode) - { - common->wcmGestureMode = GESTURE_ZOOM_MODE; - xf86WcmSwitchLeftClick(priv); - } - xf86WcmFingerZoom(priv); - } + /* fingers moved apart more than WACOM_APART_IN_POINT + * zoom mode is entered */ + if (!common->wcmGestureMode) + { + common->wcmGestureMode = GESTURE_ZOOM_MODE; + xf86WcmSwitchLeftClick(priv); + } + xf86WcmFingerZoom(priv); + } - if ( pointsInLine(ds[0], dsLast[0], &direction) && - pointsInLine(ds[1], dsLast[1], &direction) && - common->wcmGestureMode != GESTURE_ZOOM_MODE && - common->wcmGestureMode != GESTURE_TAP_MODE) - { - /* send scroll event when both fingers move in - * the same direction */ - if (!common->wcmGestureMode) - { - common->wcmGestureMode = GESTURE_SCROLL_MODE; - xf86WcmSwitchLeftClick(priv); - } - xf86WcmFingerScroll(priv); - } + if ( pointsInLine(common, ds[0], dsLast[0], &direction) && + pointsInLine(common, ds[1], dsLast[1], &direction) && + common->wcmGestureMode != GESTURE_ZOOM_MODE && + common->wcmGestureMode != GESTURE_TAP_MODE) + { + /* send scroll event when both fingers move in + * the same direction */ + if (!common->wcmGestureMode) + { + common->wcmGestureMode = GESTURE_SCROLL_MODE; + xf86WcmSwitchLeftClick(priv); + } + xf86WcmFingerScroll(priv); } } - else - /* this should never happen */ - xf86Msg(X_ERROR, "WACOM: No touch device found for %s \n", common->wcmDevice); -skipGesture: - /* keep the initial in-prox time */ - ds[0].sample = dsLast[0].sample; - ds[1].sample = dsLast[1].sample; +skipGesture: /* keep the initial states for both fingers */ if ( !(common->wcmGestureMode && (GESTURE_SCROLL_MODE | GESTURE_ZOOM_MODE)) && ds[0].proximity && ds[1].proximity) @@ -221,62 +206,24 @@ skipGesture: } } -static void xf86WcmSendVerticalScrollEvent(WacomDevicePtr priv, int dist, - int buttonUp, int buttonDn) -{ - int i = 0; - - for (i=0; i<(int)(((double)abs(dist)/ - (double)WACOM_MOTION_IN_POINT) + 0.5); i++) - { - if (dist > 0) - { - /* button down */ - xf86PostButtonEvent(priv->local->dev, - priv->flags & ABSOLUTE_FLAG, - buttonUp,1,0,priv->naxes, priv->oldX, - priv->oldY,0,0,0,0); - /* button up */ - xf86PostButtonEvent(priv->local->dev, - priv->flags & ABSOLUTE_FLAG, - buttonUp,0,0,priv->naxes, priv->oldX, - priv->oldY,0,0,0,0); - } - else - { - /* button down */ - xf86PostButtonEvent(priv->local->dev, - priv->flags & ABSOLUTE_FLAG, - buttonDn,1,0,priv->naxes, priv->oldX, - priv->oldY,0,0,0,0); - /* button up */ - xf86PostButtonEvent(priv->local->dev, - priv->flags & ABSOLUTE_FLAG, - buttonDn,0,0,priv->naxes, priv->oldX, - priv->oldY,0,0,0,0); - } - } -} - -static void xf86WcmSendHorizontalScrollEvent(WacomDevicePtr priv, int dist, +static void xf86WcmSendScrollEvent(WacomDevicePtr priv, int dist, int buttonUp, int buttonDn) { + WacomCommonPtr common = priv->common; int i = 0; - - for (i=0; i<(int)(((double)abs(dist)/ - (double)WACOM_MOTION_IN_POINT) + 0.5); i++) - { - if (dist > 0) - { - emitKeysym (priv->local->dev, XK_Left, 1); - emitKeysym (priv->local->dev, XK_Left, 0); - } - else - { - emitKeysym (priv->local->dev, XK_Right, 1); - emitKeysym (priv->local->dev, XK_Right, 0); - } - } + int button = (dist > 0) ? buttonUp : buttonDn; + + /* Make sure at least one event happens even if + * distance is negligible. + */ + do { + /* button down */ + xf86PostButtonEvent(priv->local->dev, FALSE, button, TRUE, 0, 0); + /* button up */ + xf86PostButtonEvent(priv->local->dev, FALSE, button, FALSE, 0, 0); + i++; + DBG(10, priv->debugLevel, ErrorF("xf86WcmSendScrollEvent: loop count = %d \n")); + } while (i < (int)(((double)abs(dist)/(double)common->wcmActivateDistance) + 0.5)); } static void xf86WcmFingerScroll(WacomDevicePtr priv) @@ -317,16 +264,16 @@ static void xf86WcmFingerScroll(WacomDevicePtr priv) /* check vertical direction */ midPoint_old = (((double)filterd.x[4] + (double)filterd.x[5]) / 2.); midPoint_new = (((double)filterd.x[0] + (double)filterd.x[1]) / 2.); - if (pointsInLineAfter(midPoint_old, midPoint_new)) + if (pointsInLineAfter(common, midPoint_old, midPoint_new)) { midPoint_old = (((double)filterd.y[2] + (double)filterd.y[3]) / 2.); midPoint_new = (((double)filterd.y[0] + (double)filterd.y[1]) / 2.); dist = midPoint_old - midPoint_new; - if (abs(dist) > WACOM_PARA_MOTION_IN_POINT) + if (abs(dist) > common->wcmScrollActivateDistance) { gesture = 1; - xf86WcmSendVerticalScrollEvent(priv, dist, SCROLL_UP, SCROLL_DOWN); + xf86WcmSendScrollEvent(priv, dist, SCROLL_UP, SCROLL_DOWN); } /* check horizontal direction */ @@ -334,16 +281,16 @@ static void xf86WcmFingerScroll(WacomDevicePtr priv) { midPoint_old = (((double)filterd.y[4] + (double)filterd.y[5]) / 2.); midPoint_new = (((double)filterd.y[0] + (double)filterd.y[1]) / 2.); - if (pointsInLineAfter(midPoint_old, midPoint_new)) + if (pointsInLineAfter(common, midPoint_old, midPoint_new)) { midPoint_old = (((double)filterd.x[2] + (double)filterd.x[3]) / 2.); midPoint_new = (((double)filterd.x[0] + (double)filterd.x[1]) / 2.); dist = midPoint_old - midPoint_new; - if (abs(dist) > WACOM_PARA_MOTION_IN_POINT) + if (abs(dist) > common->wcmScrollActivateDistance) { gesture = 1; - xf86WcmSendHorizontalScrollEvent(priv, dist, SCROLL_RIGHT, SCROLL_LEFT); + xf86WcmSendScrollEvent(priv, dist, SCROLL_RIGHT, SCROLL_LEFT); } } } @@ -365,30 +312,22 @@ static void xf86WcmFingerZoom(WacomDevicePtr priv) secondChannel->valid.states[0] }; int i = 0; int dist = touchDistance(common->wcmGestureState[0], common->wcmGestureState[1]); + int direction; DBG(10, priv->debugLevel, ErrorF("xf86WcmFingerZoom \n")); dist = touchDistance(ds[0], ds[1]) - dist; - + direction = (dist > 0) ? XK_plus : XK_minus; /* zooming? */ - if (abs(dist) > WACOM_MOTION_IN_POINT) + if (abs(dist) > common->wcmActivateDistance) { for (i=0; i<(int)(((double)abs(dist)/ - (double)WACOM_MOTION_IN_POINT) + 0.5); i++) + (double)common->wcmActivateDistance) + 0.5); i++) { - emitKeysym (priv->local->dev, XK_Control_L, 1); - /* zooming in */ - if (dist > 0) - { - emitKeysym (priv->local->dev, XK_plus, 1); - emitKeysym (priv->local->dev, XK_plus, 0); - } - else /* zooming out */ - { - emitKeysym (priv->local->dev, XK_minus, 1); - emitKeysym (priv->local->dev, XK_minus, 0); - } - emitKeysym (priv->local->dev, XK_Control_L, 0); + emitKeysym (priv->local->dev, XK_Control_L, TRUE); + emitKeysym (priv->local->dev, direction, TRUE); + emitKeysym (priv->local->dev, direction, FALSE); + emitKeysym (priv->local->dev, XK_Control_L, FALSE); } /* reset initial states */ diff --git a/src/xdrv/wcmUSB.c b/src/xdrv/wcmUSB.c index c08c471..087fe6e 100755 --- a/src/xdrv/wcmUSB.c +++ b/src/xdrv/wcmUSB.c @@ -751,11 +751,22 @@ static int usbChooseChannel(WacomCommonPtr common, int serial) int i, channel = -1; if (common->wcmProtocolLevel == 4) { - /* Protocol 4 doesn't support tool serial numbers */ - if (serial == 0xf0) - channel = 1; - else - channel = 0; + /* Protocol 4 doesn't support tool serial numbers. + * + * For tablets with multi-touch capabilities we use + * serial numbers as channel selectors for finger data. + * serial 1 -> MAX_FINGERS support finger data on a + * channel number. + * serial 0xf0 is reserved for the pad interface and is + * always the last supported channel (i.e. MAX_CHANNELS-1). + */ + if (serial == 0xf0) { + channel = MAX_CHANNELS-1; + } else if (serial > 0 && serial <= MAX_FINGERS) { + channel = serial - 1; + } else { + channel = 0; /* default to channel zero */ + } } else if (serial) /* serial number should never be 0 for V5 devices */ { diff --git a/src/xdrv/wcmXCommand.c b/src/xdrv/wcmXCommand.c index b4814d1..1f87481 100644 --- a/src/xdrv/wcmXCommand.c +++ b/src/xdrv/wcmXCommand.c @@ -377,6 +377,60 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) xf86ReplaceStrOption(local->options, "Gesture", "off"); } break; + case XWACOM_PARAM_RIGHTCLICKDISTANCE: + if (value < 0) + return BadValue; + else if (common->wcmRightClickDistance != value) + { + common->wcmRightClickDistance = value; + xf86ReplaceIntOption(local->options, "RightClickDistance", value); + } + break; + case XWACOM_PARAM_ZOOMPINCHDISTANCE: + /* Gestures will not work well if this + * value is less than wcmRightClickDistance + */ + if (value < 0 || value <= common->wcmRightClickDistance) + return BadValue; + else if (common->wcmZoomPinchDistance != value) + { + common->wcmZoomPinchDistance = value; + xf86ReplaceIntOption(local->options, "ZoomPinchDistance", value); + } + break; + case XWACOM_PARAM_ACTIVATEDISTANCE: + /* Gestures will not work well if this + * value is greater than or equal to wcmRightClickDistance + */ + if (value < 0 || value >= common->wcmRightClickDistance) + return BadValue; + else if (common->wcmActivateDistance != value) + { + common->wcmActivateDistance = value; + xf86ReplaceIntOption(local->options, "ActivateDistance", value); + } + break; + case XWACOM_PARAM_SCROLLACTIVATEDISTANCE: + /* Gestures will not work well if this + * value is greater than or equal to wcmRightClickDistance + */ + if (value < 0 || value >= common->wcmRightClickDistance) + return BadValue; + else if (common->wcmScrollActivateDistance != value) + { + common->wcmScrollActivateDistance = value; + xf86ReplaceIntOption(local->options, "ScrollActivateDistance", value); + } + break; + case XWACOM_PARAM_GESTURETAPTIME: + if (value < 0) + return BadValue; + else if (common->wcmGestureTapTime != value) + { + common->wcmGestureTapTime = value; + xf86ReplaceIntOption(local->options, "GestureTapTime", value); + } + break; case XWACOM_PARAM_CAPACITY: if ((value < -1) || (value > 5)) return BadValue; @@ -817,6 +871,16 @@ static int xf86WcmGetParam(LocalDevicePtr local, int param) return common->wcmTouch; case XWACOM_PARAM_GESTURE: return common->wcmGesture; + case XWACOM_PARAM_RIGHTCLICKDISTANCE: + return common->wcmRightClickDistance; + case XWACOM_PARAM_ZOOMPINCHDISTANCE: + return common->wcmZoomPinchDistance; + case XWACOM_PARAM_ACTIVATEDISTANCE: + return common->wcmActivateDistance; + case XWACOM_PARAM_SCROLLACTIVATEDISTANCE: + return common->wcmScrollActivateDistance; + case XWACOM_PARAM_GESTURETAPTIME: + return common->wcmGestureTapTime; case XWACOM_PARAM_CAPACITY: return common->wcmCapacity; case XWACOM_PARAM_CURSORPROX: @@ -999,10 +1063,20 @@ static int xf86WcmGetDefaultParam(LocalDevicePtr local, int param) return common->wcmTPCButtonDefault; case XWACOM_PARAM_TOUCH: return common->wcmTouchDefault; - case XWACOM_PARAM_CAPACITY: - return common->wcmCapacityDefault; case XWACOM_PARAM_GESTURE: return common->wcmGestureDefault; + case XWACOM_PARAM_CAPACITY: + return common->wcmCapacityDefault; + case XWACOM_PARAM_RIGHTCLICKDISTANCE: + return common->wcmRightClickDistanceDefault; + case XWACOM_PARAM_ZOOMPINCHDISTANCE: + return common->wcmZoomPinchDistanceDefault; + case XWACOM_PARAM_ACTIVATEDISTANCE: + return common->wcmActivateDistanceDefault; + case XWACOM_PARAM_SCROLLACTIVATEDISTANCE: + return common->wcmScrollActivateDistanceDefault; + case XWACOM_PARAM_GESTURETAPTIME: + return common->wcmGestureTapTimeDefault; case XWACOM_PARAM_PRESSCURVE: if (IsStylus (priv) || IsEraser (priv)) return (0 << 24) | (0 << 16) | (100 << 8) | 100; @@ -1044,7 +1118,7 @@ int xf86WcmDevChangeControl(LocalDevicePtr local, xDeviceCtl* control) AxisInfoPtr a; DBG (5, common->debugLevel, ErrorF( - "xf86WcmQueryControl: dev %s query 0x%x at %d\n", + "xf86WcmDevChangeControl: dev %s query 0x%x at %d\n", local->dev->name, r [0], priv->naxes)); /* Since X11 doesn't provide any sane protocol for querying * device parameters, we have to do a dirty trick here: @@ -1065,7 +1139,7 @@ int xf86WcmDevChangeControl(LocalDevicePtr local, xDeviceCtl* control) case 2: { DBG (5, common->debugLevel, ErrorF( - "xf86WcmChangeControl: dev %s set 0x%x to 0x%x\n", + "xf86WcmDevChangeControl: dev %s set 0x%x to 0x%x\n", local->dev->name, r [0], r [1])); if (r [0] >= XWACOM_PARAM_BUTTON1 && r[0] <= XWACOM_PARAM_STRIPRDN) rc = xf86WcmSetButtonParam (local, r [0], r[1]); @@ -1078,7 +1152,7 @@ int xf86WcmDevChangeControl(LocalDevicePtr local, xDeviceCtl* control) AxisInfoPtr a; DBG (5, common->debugLevel, ErrorF( - "xf86WcmQueryControl: dev %s query 0x%x at %d\n", + "xf86WcmDevChangeControl: dev %s query default 0x%x at %d\n", local->dev->name, r [0], priv->naxes)); /* Since X11 doesn't provide any sane protocol for querying * device parameters, we have to do a dirty trick here: diff --git a/src/xdrv/xf86Wacom.c b/src/xdrv/xf86Wacom.c index 3c147c2..f2ec088 100755 --- a/src/xdrv/xf86Wacom.c +++ b/src/xdrv/xf86Wacom.c @@ -339,7 +339,7 @@ static void xf86WcmInitialToolSize(LocalDevicePtr local) priv->resolY = common->wcmResolY; } - DBG(2, priv->debugLevel, ErrorF("xf86WcmRegisterX11Devices: " + DBG(2, priv->debugLevel, ErrorF("xf86WcmInitializeToolSize: " "maxX=%d maxY=%d reslX=%d reslY=%d \n", priv->maxX, priv->maxY, priv->resolX, priv->resolY)); @@ -355,7 +355,7 @@ static void xf86WcmInitialToolSize(LocalDevicePtr local) } } - DBG(2, priv->debugLevel, ErrorF("Wacom device \"%s\" " + DBG(2, priv->debugLevel, ErrorF("xf86WcmInitializeToolSize: Wacom device \"%s\" " "top X=%d top Y=%d bottom X=%d bottom Y=%d \n", local->name, priv->topX, priv->topY, priv->bottomX, priv->bottomY)); @@ -395,7 +395,8 @@ static int xf86WcmRegisterX11Devices (LocalDevicePtr local) "(%s) %d buttons, %d keys, %d axes\n", IsStylus(priv) ? "stylus" : IsCursor(priv) ? "cursor" : - IsPad(priv) ? "pad" : "eraser", + IsPad(priv) ? "pad" : + IsTouch(priv) ? "touch" : "eraser", nbbuttons, nbkeys, nbaxes)); for(loop=1; loop<=nbbuttons; loop++) @@ -568,6 +569,20 @@ static int xf86WcmRegisterX11Devices (LocalDevicePtr local) { /* hard prox out */ priv->hardProx = 0; + + /* Change Capacity and Mode defaults for Bamboo + * NOTE: This is here because the first time X starts + * tablet configuration via HAL is already completed + * before tablet_id is set, so this ensures that the + * Capacity is set correctly and we are in relative mode + * by default regardless of the state of X configuration. + */ + if (common->tablet_id >= 0xd0 && common->tablet_id <= 0xd3) { + /* set capacity default to 3 for Bamboo */ + common->wcmCapacityDefault = 3; + /* default touch to relative mode */ + priv->flags &= ~ABSOLUTE_FLAG; + } } return TRUE; @@ -956,12 +971,13 @@ static int xf86WcmDevProc(DeviceIntPtr pWcm, int what) LocalDevicePtr local = (LocalDevicePtr)pWcm->public.devicePrivate; WacomDevicePtr priv = (WacomDevicePtr)PRIVATE(pWcm); - DBG(2, priv->debugLevel, ErrorF("BEGIN xf86WcmProc dev=%p priv=%p " + DBG(2, priv->debugLevel, ErrorF("BEGIN xf86WcmDevProc dev=%p priv=%p " "type=%s(%s) flags=%d fd=%d what=%s\n", (void *)pWcm, (void *)priv, IsStylus(priv) ? "stylus" : IsCursor(priv) ? "cursor" : - IsPad(priv) ? "pad" : "eraser", + IsPad(priv) ? "pad" : + IsTouch(priv) ? "touch" : "eraser", local->name, priv->flags, local ? local->fd : -1, (what == DEVICE_INIT) ? "INIT" : (what == DEVICE_OFF) ? "OFF" : @@ -978,7 +994,7 @@ static int xf86WcmDevProc(DeviceIntPtr pWcm, int what) priv->wcmInitKeyClassCount = 0; if (!xf86WcmDevOpen(pWcm)) { - DBG(1, priv->debugLevel, ErrorF("xf86WcmProc INIT FAILED\n")); + DBG(1, priv->debugLevel, ErrorF("xf86WcmDevProc INIT FAILED\n")); return !Success; } priv->wcmInitKeyClassCount++; @@ -988,7 +1004,7 @@ static int xf86WcmDevProc(DeviceIntPtr pWcm, int what) case DEVICE_ON: if (!xf86WcmDevOpen(pWcm)) { - DBG(1, priv->debugLevel, ErrorF("xf86WcmProc ON FAILED\n")); + DBG(1, priv->debugLevel, ErrorF("xf86WcmDevProc ON FAILED\n")); return !Success; } priv->wcmDevOpenCount++; @@ -1013,7 +1029,7 @@ static int xf86WcmDevProc(DeviceIntPtr pWcm, int what) break; } /* end switch */ - DBG(2, priv->debugLevel, ErrorF("END xf86WcmProc Success \n")); + DBG(2, priv->debugLevel, ErrorF("END xf86WcmDevProc Success \n")); return Success; } diff --git a/src/xdrv/xf86WacomDefs.h b/src/xdrv/xf86WacomDefs.h index d67cf75..9d180de 100755 --- a/src/xdrv/xf86WacomDefs.h +++ b/src/xdrv/xf86WacomDefs.h @@ -354,8 +354,8 @@ struct _WacomDeviceClass #define DEVICE_ISDV4 0x000C -#define MAX_CHANNELS 2 -#define MAX_FINGERS 2 +#define MAX_FINGERS 2 +#define MAX_CHANNELS MAX_FINGERS + 1 struct _WacomCommonRec { @@ -420,6 +420,16 @@ struct _WacomCommonRec WacomDeviceState wcmGestureState[MAX_FINGERS]; /* inital state when in gesture mode */ int wcmGesture; /* disable/enable touch gesture */ int wcmGestureDefault; /* default touch gesture to disable when not supported */ + int wcmRightClickDistance; /* maximum finger spacing allowed for a right click touch gesture */ + int wcmRightClickDistanceDefault; /* default maximum finger spacing allowed for a right click touch gesture */ + int wcmZoomPinchDistance; /* minimum distance required before starting a zoom touch gesture */ + int wcmZoomPinchDistanceDefault; /* default minimum distance required before starting a zoom touch gesture */ + int wcmActivateDistance; /* minimum finger motion distance required for starting any gesture */ + int wcmActivateDistanceDefault; /* default minimum finger motion distance required for starting any gesture */ + int wcmScrollActivateDistance; /* minimum finger motion distance required for starting a scroll gesture */ + int wcmScrollActivateDistanceDefault; /* default minimum finger motion distance required for starting a scroll gesture */ + int wcmGestureTapTime; /* maximum time between events required to start a gesture */ + int wcmGestureTapTimeDefault; /* default maximum time between events required to start a gesture */ int wcmCapacity; /* disable/enable capacity */ int wcmCapacityDefault; /* default to -1 when capacity isn't supported/disabled */ /* 3 when capacity is supported */