diff options
Diffstat (limited to 'drivers/input/tablet/kbtab.c')
-rw-r--r-- | drivers/input/tablet/kbtab.c | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c index 6682b17bf844..b9969f120247 100644 --- a/drivers/input/tablet/kbtab.c +++ b/drivers/input/tablet/kbtab.c | |||
@@ -34,10 +34,6 @@ struct kbtab { | |||
34 | struct input_dev *dev; | 34 | struct input_dev *dev; |
35 | struct usb_device *usbdev; | 35 | struct usb_device *usbdev; |
36 | struct urb *irq; | 36 | struct urb *irq; |
37 | int x, y; | ||
38 | int button; | ||
39 | int pressure; | ||
40 | __u32 serial[2]; | ||
41 | char phys[32]; | 37 | char phys[32]; |
42 | }; | 38 | }; |
43 | 39 | ||
@@ -46,6 +42,7 @@ static void kbtab_irq(struct urb *urb) | |||
46 | struct kbtab *kbtab = urb->context; | 42 | struct kbtab *kbtab = urb->context; |
47 | unsigned char *data = kbtab->data; | 43 | unsigned char *data = kbtab->data; |
48 | struct input_dev *dev = kbtab->dev; | 44 | struct input_dev *dev = kbtab->dev; |
45 | int pressure; | ||
49 | int retval; | 46 | int retval; |
50 | 47 | ||
51 | switch (urb->status) { | 48 | switch (urb->status) { |
@@ -63,31 +60,27 @@ static void kbtab_irq(struct urb *urb) | |||
63 | goto exit; | 60 | goto exit; |
64 | } | 61 | } |
65 | 62 | ||
66 | kbtab->x = get_unaligned_le16(&data[1]); | ||
67 | kbtab->y = get_unaligned_le16(&data[3]); | ||
68 | |||
69 | kbtab->pressure = (data[5]); | ||
70 | 63 | ||
71 | input_report_key(dev, BTN_TOOL_PEN, 1); | 64 | input_report_key(dev, BTN_TOOL_PEN, 1); |
72 | 65 | ||
73 | input_report_abs(dev, ABS_X, kbtab->x); | 66 | input_report_abs(dev, ABS_X, get_unaligned_le16(&data[1])); |
74 | input_report_abs(dev, ABS_Y, kbtab->y); | 67 | input_report_abs(dev, ABS_Y, get_unaligned_le16(&data[3])); |
75 | 68 | ||
76 | /*input_report_key(dev, BTN_TOUCH , data[0] & 0x01);*/ | 69 | /*input_report_key(dev, BTN_TOUCH , data[0] & 0x01);*/ |
77 | input_report_key(dev, BTN_RIGHT, data[0] & 0x02); | 70 | input_report_key(dev, BTN_RIGHT, data[0] & 0x02); |
78 | 71 | ||
79 | if (-1 == kb_pressure_click) { | 72 | pressure = data[5]; |
80 | input_report_abs(dev, ABS_PRESSURE, kbtab->pressure); | 73 | if (kb_pressure_click == -1) |
81 | } else { | 74 | input_report_abs(dev, ABS_PRESSURE, pressure); |
82 | input_report_key(dev, BTN_LEFT, (kbtab->pressure > kb_pressure_click) ? 1 : 0); | 75 | else |
83 | }; | 76 | input_report_key(dev, BTN_LEFT, pressure > kb_pressure_click ? 1 : 0); |
84 | 77 | ||
85 | input_sync(dev); | 78 | input_sync(dev); |
86 | 79 | ||
87 | exit: | 80 | exit: |
88 | retval = usb_submit_urb (urb, GFP_ATOMIC); | 81 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
89 | if (retval) | 82 | if (retval) |
90 | err ("%s - usb_submit_urb failed with result %d", | 83 | err("%s - usb_submit_urb failed with result %d", |
91 | __func__, retval); | 84 | __func__, retval); |
92 | } | 85 | } |
93 | 86 | ||
@@ -153,13 +146,11 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
153 | input_dev->open = kbtab_open; | 146 | input_dev->open = kbtab_open; |
154 | input_dev->close = kbtab_close; | 147 | input_dev->close = kbtab_close; |
155 | 148 | ||
156 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) | | 149 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
157 | BIT_MASK(EV_MSC); | 150 | input_dev->keybit[BIT_WORD(BTN_LEFT)] |= |
158 | input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_LEFT) | | 151 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT); |
159 | BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE); | 152 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= |
160 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_PEN) | | 153 | BIT_MASK(BTN_TOOL_PEN) | BIT_MASK(BTN_TOUCH); |
161 | BIT_MASK(BTN_TOUCH); | ||
162 | input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL); | ||
163 | input_set_abs_params(input_dev, ABS_X, 0, 0x2000, 4, 0); | 154 | input_set_abs_params(input_dev, ABS_X, 0, 0x2000, 4, 0); |
164 | input_set_abs_params(input_dev, ABS_Y, 0, 0x1750, 4, 0); | 155 | input_set_abs_params(input_dev, ABS_Y, 0, 0x1750, 4, 0); |
165 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, 0xff, 0, 0); | 156 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, 0xff, 0, 0); |
@@ -182,7 +173,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
182 | return 0; | 173 | return 0; |
183 | 174 | ||
184 | fail3: usb_free_urb(kbtab->irq); | 175 | fail3: usb_free_urb(kbtab->irq); |
185 | fail2: usb_buffer_free(dev, 10, kbtab->data, kbtab->data_dma); | 176 | fail2: usb_buffer_free(dev, 8, kbtab->data, kbtab->data_dma); |
186 | fail1: input_free_device(input_dev); | 177 | fail1: input_free_device(input_dev); |
187 | kfree(kbtab); | 178 | kfree(kbtab); |
188 | return error; | 179 | return error; |
@@ -193,13 +184,11 @@ static void kbtab_disconnect(struct usb_interface *intf) | |||
193 | struct kbtab *kbtab = usb_get_intfdata(intf); | 184 | struct kbtab *kbtab = usb_get_intfdata(intf); |
194 | 185 | ||
195 | usb_set_intfdata(intf, NULL); | 186 | usb_set_intfdata(intf, NULL); |
196 | if (kbtab) { | 187 | |
197 | usb_kill_urb(kbtab->irq); | 188 | input_unregister_device(kbtab->dev); |
198 | input_unregister_device(kbtab->dev); | 189 | usb_free_urb(kbtab->irq); |
199 | usb_free_urb(kbtab->irq); | 190 | usb_buffer_free(kbtab->usbdev, 8, kbtab->data, kbtab->data_dma); |
200 | usb_buffer_free(interface_to_usbdev(intf), 10, kbtab->data, kbtab->data_dma); | 191 | kfree(kbtab); |
201 | kfree(kbtab); | ||
202 | } | ||
203 | } | 192 | } |
204 | 193 | ||
205 | static struct usb_driver kbtab_driver = { | 194 | static struct usb_driver kbtab_driver = { |