aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/input/aiptek.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/input/aiptek.c')
-rw-r--r--drivers/usb/input/aiptek.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c
index e991f7ed7330..6bb0f25e8e93 100644
--- a/drivers/usb/input/aiptek.c
+++ b/drivers/usb/input/aiptek.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Native support for the Aiptek HyperPen USB Tablets 2 * Native support for the Aiptek HyperPen USB Tablets
3 * (4000U/5000U/6000U/8000U/12000U) 3 * (4000U/5000U/6000U/8000U/12000U)
4 * 4 *
5 * Copyright (c) 2001 Chris Atenasio <chris@crud.net> 5 * Copyright (c) 2001 Chris Atenasio <chris@crud.net>
6 * Copyright (c) 2002-2004 Bryan W. Headley <bwheadley@earthlink.net> 6 * Copyright (c) 2002-2004 Bryan W. Headley <bwheadley@earthlink.net>
7 * 7 *
@@ -31,7 +31,7 @@
31 * - Added support for the sysfs interface, deprecating the 31 * - Added support for the sysfs interface, deprecating the
32 * procfs interface for 2.5.x kernel. Also added support for 32 * procfs interface for 2.5.x kernel. Also added support for
33 * Wheel command. Bryan W. Headley July-15-2003. 33 * Wheel command. Bryan W. Headley July-15-2003.
34 * v1.2 - Reworked jitter timer as a kernel thread. 34 * v1.2 - Reworked jitter timer as a kernel thread.
35 * Bryan W. Headley November-28-2003/Jan-10-2004. 35 * Bryan W. Headley November-28-2003/Jan-10-2004.
36 * v1.3 - Repaired issue of kernel thread going nuts on single-processor 36 * v1.3 - Repaired issue of kernel thread going nuts on single-processor
37 * machines, introduced programmableDelay as a command line 37 * machines, introduced programmableDelay as a command line
@@ -49,10 +49,10 @@
49 * NOTE: 49 * NOTE:
50 * This kernel driver is augmented by the "Aiptek" XFree86 input 50 * This kernel driver is augmented by the "Aiptek" XFree86 input
51 * driver for your X server, as well as the Gaiptek GUI Front-end 51 * driver for your X server, as well as the Gaiptek GUI Front-end
52 * "Tablet Manager". 52 * "Tablet Manager".
53 * These three products are highly interactive with one another, 53 * These three products are highly interactive with one another,
54 * so therefore it's easier to document them all as one subsystem. 54 * so therefore it's easier to document them all as one subsystem.
55 * Please visit the project's "home page", located at, 55 * Please visit the project's "home page", located at,
56 * http://aiptektablet.sourceforge.net. 56 * http://aiptektablet.sourceforge.net.
57 * 57 *
58 * This program is free software; you can redistribute it and/or modify 58 * This program is free software; you can redistribute it and/or modify
@@ -156,7 +156,7 @@
156 * Command/Data Description Return Bytes Return Value 156 * Command/Data Description Return Bytes Return Value
157 * 0x10/0x00 SwitchToMouse 0 157 * 0x10/0x00 SwitchToMouse 0
158 * 0x10/0x01 SwitchToTablet 0 158 * 0x10/0x01 SwitchToTablet 0
159 * 0x18/0x04 SetResolution 0 159 * 0x18/0x04 SetResolution 0
160 * 0x12/0xFF AutoGainOn 0 160 * 0x12/0xFF AutoGainOn 0
161 * 0x17/0x00 FilterOn 0 161 * 0x17/0x00 FilterOn 0
162 * 0x01/0x00 GetXExtension 2 MaxX 162 * 0x01/0x00 GetXExtension 2 MaxX
@@ -247,7 +247,7 @@
247#define AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE 2 247#define AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE 2
248#define AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED 3 248#define AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED 3
249 249
250 /* Time to wait (in ms) to help mask hand jittering 250 /* Time to wait (in ms) to help mask hand jittering
251 * when pressing the stylus buttons. 251 * when pressing the stylus buttons.
252 */ 252 */
253#define AIPTEK_JITTER_DELAY_DEFAULT 50 253#define AIPTEK_JITTER_DELAY_DEFAULT 50
@@ -324,7 +324,6 @@ struct aiptek {
324 struct aiptek_settings curSetting; /* tablet's current programmable */ 324 struct aiptek_settings curSetting; /* tablet's current programmable */
325 struct aiptek_settings newSetting; /* ... and new param settings */ 325 struct aiptek_settings newSetting; /* ... and new param settings */
326 unsigned int ifnum; /* interface number for IO */ 326 unsigned int ifnum; /* interface number for IO */
327 int openCount; /* module use counter */
328 int diagnostic; /* tablet diagnostic codes */ 327 int diagnostic; /* tablet diagnostic codes */
329 unsigned long eventCount; /* event count */ 328 unsigned long eventCount; /* event count */
330 int inDelay; /* jitter: in jitter delay? */ 329 int inDelay; /* jitter: in jitter delay? */
@@ -791,7 +790,7 @@ exit:
791 * specific Aiptek model numbers, because there has been overlaps, 790 * specific Aiptek model numbers, because there has been overlaps,
792 * use, and reuse of id's in existing models. Certain models have 791 * use, and reuse of id's in existing models. Certain models have
793 * been known to use more than one ID, indicative perhaps of 792 * been known to use more than one ID, indicative perhaps of
794 * manufacturing revisions. In any event, we consider these 793 * manufacturing revisions. In any event, we consider these
795 * IDs to not be model-specific nor unique. 794 * IDs to not be model-specific nor unique.
796 */ 795 */
797static const struct usb_device_id aiptek_ids[] = { 796static const struct usb_device_id aiptek_ids[] = {
@@ -814,15 +813,9 @@ static int aiptek_open(struct input_dev *inputdev)
814{ 813{
815 struct aiptek *aiptek = inputdev->private; 814 struct aiptek *aiptek = inputdev->private;
816 815
817 if (aiptek->openCount++ > 0) {
818 return 0;
819 }
820
821 aiptek->urb->dev = aiptek->usbdev; 816 aiptek->urb->dev = aiptek->usbdev;
822 if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0) { 817 if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0)
823 aiptek->openCount--;
824 return -EIO; 818 return -EIO;
825 }
826 819
827 return 0; 820 return 0;
828} 821}
@@ -834,13 +827,11 @@ static void aiptek_close(struct input_dev *inputdev)
834{ 827{
835 struct aiptek *aiptek = inputdev->private; 828 struct aiptek *aiptek = inputdev->private;
836 829
837 if (--aiptek->openCount == 0) { 830 usb_kill_urb(aiptek->urb);
838 usb_kill_urb(aiptek->urb);
839 }
840} 831}
841 832
842/*********************************************************************** 833/***********************************************************************
843 * aiptek_set_report and aiptek_get_report() are borrowed from Linux 2.4.x, 834 * aiptek_set_report and aiptek_get_report() are borrowed from Linux 2.4.x,
844 * where they were known as usb_set_report and usb_get_report. 835 * where they were known as usb_set_report and usb_get_report.
845 */ 836 */
846static int 837static int
@@ -2252,7 +2243,6 @@ static void aiptek_disconnect(struct usb_interface *intf)
2252 AIPTEK_PACKET_LENGTH, 2243 AIPTEK_PACKET_LENGTH,
2253 aiptek->data, aiptek->data_dma); 2244 aiptek->data, aiptek->data_dma);
2254 kfree(aiptek); 2245 kfree(aiptek);
2255 aiptek = NULL;
2256 } 2246 }
2257} 2247}
2258 2248