diff options
| author | Bastian Blank <waldi@debian.org> | 2010-02-11 02:06:23 -0500 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-02-11 02:31:37 -0500 |
| commit | b036f6fb3aa23a52d90da5fc57e0803f08292e82 (patch) | |
| tree | 714b969a2dc7101c4a2574c48cb5ddd239dad47f | |
| parent | 5deeac99fe1146532eb7c64f9adb17d17628d751 (diff) | |
Input: wacom - get features from driver info
Get the features information from the driver info of the usb device id
structure provided by the caller. The device ids and feature structs
are strong coupled using indices.
Signed-off-by: Bastian Blank <waldi@debian.org>
Tested-by: Jason Childs <oblivian@users.sourceforge.net>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
| -rw-r--r-- | drivers/input/tablet/wacom.h | 5 | ||||
| -rw-r--r-- | drivers/input/tablet/wacom_sys.c | 10 | ||||
| -rw-r--r-- | drivers/input/tablet/wacom_wac.c | 342 |
3 files changed, 205 insertions, 152 deletions
diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h index 16310f368dab..8fef1b689c69 100644 --- a/drivers/input/tablet/wacom.h +++ b/drivers/input/tablet/wacom.h | |||
| @@ -85,6 +85,7 @@ | |||
| 85 | #include <linux/kernel.h> | 85 | #include <linux/kernel.h> |
| 86 | #include <linux/slab.h> | 86 | #include <linux/slab.h> |
| 87 | #include <linux/module.h> | 87 | #include <linux/module.h> |
| 88 | #include <linux/mod_devicetable.h> | ||
| 88 | #include <linux/init.h> | 89 | #include <linux/init.h> |
| 89 | #include <linux/usb/input.h> | 90 | #include <linux/usb/input.h> |
| 90 | #include <asm/unaligned.h> | 91 | #include <asm/unaligned.h> |
| @@ -120,6 +121,8 @@ struct wacom_combo { | |||
| 120 | struct urb *urb; | 121 | struct urb *urb; |
| 121 | }; | 122 | }; |
| 122 | 123 | ||
| 124 | extern const struct usb_device_id wacom_ids[]; | ||
| 125 | |||
| 123 | extern int wacom_wac_irq(struct wacom_wac * wacom_wac, void * wcombo); | 126 | extern int wacom_wac_irq(struct wacom_wac * wacom_wac, void * wcombo); |
| 124 | extern void wacom_report_abs(void *wcombo, unsigned int abs_type, int abs_data); | 127 | extern void wacom_report_abs(void *wcombo, unsigned int abs_type, int abs_data); |
| 125 | extern void wacom_report_rel(void *wcombo, unsigned int rel_type, int rel_data); | 128 | extern void wacom_report_rel(void *wcombo, unsigned int rel_type, int rel_data); |
| @@ -142,7 +145,5 @@ extern void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wa | |||
| 142 | extern void input_dev_bee(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | 145 | extern void input_dev_bee(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
| 143 | extern __u16 wacom_le16_to_cpu(unsigned char *data); | 146 | extern __u16 wacom_le16_to_cpu(unsigned char *data); |
| 144 | extern __u16 wacom_be16_to_cpu(unsigned char *data); | 147 | extern __u16 wacom_be16_to_cpu(unsigned char *data); |
| 145 | extern struct wacom_features *get_wacom_feature(const struct usb_device_id *id); | ||
| 146 | extern const struct usb_device_id *get_device_table(void); | ||
| 147 | 148 | ||
| 148 | #endif | 149 | #endif |
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 072f33b3b2b0..be4b76f264a7 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
| @@ -530,10 +530,13 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
| 530 | struct usb_endpoint_descriptor *endpoint; | 530 | struct usb_endpoint_descriptor *endpoint; |
| 531 | struct wacom *wacom; | 531 | struct wacom *wacom; |
| 532 | struct wacom_wac *wacom_wac; | 532 | struct wacom_wac *wacom_wac; |
| 533 | struct wacom_features *features; | 533 | struct wacom_features *features = (void *)id->driver_info; |
| 534 | struct input_dev *input_dev; | 534 | struct input_dev *input_dev; |
| 535 | int error = -ENOMEM; | 535 | int error = -ENOMEM; |
| 536 | 536 | ||
| 537 | if (!features) | ||
| 538 | return -EINVAL; | ||
| 539 | |||
| 537 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); | 540 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); |
| 538 | wacom_wac = kzalloc(sizeof(struct wacom_wac), GFP_KERNEL); | 541 | wacom_wac = kzalloc(sizeof(struct wacom_wac), GFP_KERNEL); |
| 539 | input_dev = input_allocate_device(); | 542 | input_dev = input_allocate_device(); |
| @@ -555,7 +558,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
| 555 | usb_make_path(dev, wacom->phys, sizeof(wacom->phys)); | 558 | usb_make_path(dev, wacom->phys, sizeof(wacom->phys)); |
| 556 | strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); | 559 | strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); |
| 557 | 560 | ||
| 558 | wacom_wac->features = features = get_wacom_feature(id); | 561 | wacom_wac->features = features; |
| 559 | BUG_ON(features->pktlen > WACOM_PKGLEN_MAX); | 562 | BUG_ON(features->pktlen > WACOM_PKGLEN_MAX); |
| 560 | 563 | ||
| 561 | input_dev->name = wacom_wac->features->name; | 564 | input_dev->name = wacom_wac->features->name; |
| @@ -663,6 +666,7 @@ static int wacom_reset_resume(struct usb_interface *intf) | |||
| 663 | 666 | ||
| 664 | static struct usb_driver wacom_driver = { | 667 | static struct usb_driver wacom_driver = { |
| 665 | .name = "wacom", | 668 | .name = "wacom", |
| 669 | .id_table = wacom_ids, | ||
| 666 | .probe = wacom_probe, | 670 | .probe = wacom_probe, |
| 667 | .disconnect = wacom_disconnect, | 671 | .disconnect = wacom_disconnect, |
| 668 | .suspend = wacom_suspend, | 672 | .suspend = wacom_suspend, |
| @@ -674,7 +678,7 @@ static struct usb_driver wacom_driver = { | |||
| 674 | static int __init wacom_init(void) | 678 | static int __init wacom_init(void) |
| 675 | { | 679 | { |
| 676 | int result; | 680 | int result; |
| 677 | wacom_driver.id_table = get_device_table(); | 681 | |
| 678 | result = usb_register(&wacom_driver); | 682 | result = usb_register(&wacom_driver); |
| 679 | if (result == 0) | 683 | if (result == 0) |
| 680 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" | 684 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 1056f149fe31..56aaf0164a56 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
| @@ -903,153 +903,201 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w | |||
| 903 | return; | 903 | return; |
| 904 | } | 904 | } |
| 905 | 905 | ||
| 906 | static struct wacom_features wacom_features[] = { | 906 | static struct wacom_features wacom_features_0x00 = |
| 907 | { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255, 0, PENPARTNER }, | 907 | { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255, 0, PENPARTNER }; |
| 908 | { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }, | 908 | static struct wacom_features wacom_features_0x10 = |
| 909 | { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }, | 909 | { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }; |
| 910 | { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511, 63, GRAPHIRE }, | 910 | static struct wacom_features wacom_features_0x11 = |
| 911 | { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, GRAPHIRE }, | 911 | { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }; |
| 912 | { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }, | 912 | static struct wacom_features wacom_features_0x12 = |
| 913 | { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, WACOM_G4 }, | 913 | { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511, 63, GRAPHIRE }; |
| 914 | { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, WACOM_G4 }, | 914 | static struct wacom_features wacom_features_0x13 = |
| 915 | { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }, | 915 | { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, GRAPHIRE }; |
| 916 | { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511, 63, WACOM_MO }, | 916 | static struct wacom_features wacom_features_0x14 = |
| 917 | { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }, | 917 | { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }; |
| 918 | { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }, | 918 | static struct wacom_features wacom_features_0x15 = |
| 919 | { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255, 63, GRAPHIRE }, | 919 | { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, WACOM_G4 }; |
| 920 | { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }, | 920 | static struct wacom_features wacom_features_0x16 = |
| 921 | { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511, 63, GRAPHIRE }, | 921 | { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, WACOM_G4 }; |
| 922 | { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511, 63, GRAPHIRE }, | 922 | static struct wacom_features wacom_features_0x17 = |
| 923 | { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }, | 923 | { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }; |
| 924 | { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }, | 924 | static struct wacom_features wacom_features_0x18 = |
| 925 | { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS }, | 925 | { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511, 63, WACOM_MO }; |
| 926 | { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }, | 926 | static struct wacom_features wacom_features_0x19 = |
| 927 | { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS }, | 927 | { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }; |
| 928 | { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS }, | 928 | static struct wacom_features wacom_features_0x60 = |
| 929 | { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS }, | 929 | { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; |
| 930 | { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255, 0, PL }, | 930 | static struct wacom_features wacom_features_0x61 = |
| 931 | { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255, 0, PL }, | 931 | { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255, 63, GRAPHIRE }; |
| 932 | { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255, 0, PL }, | 932 | static struct wacom_features wacom_features_0x62 = |
| 933 | { "Wacom PL600SX", WACOM_PKGLEN_GRAPHIRE, 6260, 5016, 255, 0, PL }, | 933 | { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; |
| 934 | { "Wacom PL550", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 511, 0, PL }, | 934 | static struct wacom_features wacom_features_0x63 = |
| 935 | { "Wacom PL800", WACOM_PKGLEN_GRAPHIRE, 7220, 5780, 511, 0, PL }, | 935 | { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511, 63, GRAPHIRE }; |
| 936 | { "Wacom PL700", WACOM_PKGLEN_GRAPHIRE, 6758, 5406, 511, 0, PL }, | 936 | static struct wacom_features wacom_features_0x64 = |
| 937 | { "Wacom PL510", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL }, | 937 | { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511, 63, GRAPHIRE }; |
| 938 | { "Wacom DTU710", WACOM_PKGLEN_GRAPHIRE, 34080, 27660, 511, 0, PL }, | 938 | static struct wacom_features wacom_features_0x65 = |
| 939 | { "Wacom DTF521", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL }, | 939 | { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }; |
| 940 | { "Wacom DTF720", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL }, | 940 | static struct wacom_features wacom_features_0x69 = |
| 941 | { "Wacom DTF720a", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL }, | 941 | { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; |
| 942 | { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE, 20480, 15360, 511, 0, PTU }, | 942 | static struct wacom_features wacom_features_0x20 = |
| 943 | { "Wacom Intuos2 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS }, | 943 | { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS }; |
| 944 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }, | 944 | static struct wacom_features wacom_features_0x21 = |
| 945 | { "Wacom Intuos2 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS }, | 945 | { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; |
| 946 | { "Wacom Intuos2 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS }, | 946 | static struct wacom_features wacom_features_0x22 = |
| 947 | { "Wacom Intuos2 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS }, | 947 | { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS }; |
| 948 | { "Wacom Intuos3 4x5", WACOM_PKGLEN_INTUOS, 25400, 20320, 1023, 63, INTUOS3S }, | 948 | static struct wacom_features wacom_features_0x23 = |
| 949 | { "Wacom Intuos3 6x8", WACOM_PKGLEN_INTUOS, 40640, 30480, 1023, 63, INTUOS3 }, | 949 | { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS }; |
| 950 | { "Wacom Intuos3 9x12", WACOM_PKGLEN_INTUOS, 60960, 45720, 1023, 63, INTUOS3 }, | 950 | static struct wacom_features wacom_features_0x24 = |
| 951 | { "Wacom Intuos3 12x12", WACOM_PKGLEN_INTUOS, 60960, 60960, 1023, 63, INTUOS3L }, | 951 | { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS }; |
| 952 | { "Wacom Intuos3 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 1023, 63, INTUOS3L }, | 952 | static struct wacom_features wacom_features_0x30 = |
| 953 | { "Wacom Intuos3 6x11", WACOM_PKGLEN_INTUOS, 54204, 31750, 1023, 63, INTUOS3 }, | 953 | { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255, 0, PL }; |
| 954 | { "Wacom Intuos3 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 1023, 63, INTUOS3S }, | 954 | static struct wacom_features wacom_features_0x31 = |
| 955 | { "Wacom Intuos4 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, 63, INTUOS4S }, | 955 | { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255, 0, PL }; |
| 956 | { "Wacom Intuos4 6x9", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, 63, INTUOS4 }, | 956 | static struct wacom_features wacom_features_0x32 = |
| 957 | { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, 63, INTUOS4L }, | 957 | { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255, 0, PL }; |
| 958 | { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, 63, INTUOS4L }, | 958 | static struct wacom_features wacom_features_0x33 = |
| 959 | { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, 63, CINTIQ }, | ||
