aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/tablet/aiptek.c94
1 files changed, 52 insertions, 42 deletions
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
index c7db623682de..0c78dc4ed5cf 100644
--- a/drivers/input/tablet/aiptek.c
+++ b/drivers/input/tablet/aiptek.c
@@ -218,15 +218,9 @@
218#define AIPTEK_WHEEL_DISABLE (-10101) 218#define AIPTEK_WHEEL_DISABLE (-10101)
219 219
220 /* ToolCode values, which BTW are 0x140 .. 0x14f 220 /* ToolCode values, which BTW are 0x140 .. 0x14f
221 * We have things set up such that if TOOL_BUTTON_FIRED_BIT is 221 * We have things set up such that if the tool button has changed,
222 * not set, we'll send one instance of AIPTEK_TOOL_BUTTON_xxx. 222 * the tools get reset.
223 *
224 * Whenever the user resets the value, TOOL_BUTTON_FIRED_BIT will
225 * get reset.
226 */ 223 */
227#define TOOL_BUTTON(x) ((x) & 0x14f)
228#define TOOL_BUTTON_FIRED(x) ((x) & 0x200)
229#define TOOL_BUTTON_FIRED_BIT 0x200
230 /* toolMode codes 224 /* toolMode codes
231 */ 225 */
232#define AIPTEK_TOOL_BUTTON_PEN_MODE BTN_TOOL_PEN 226#define AIPTEK_TOOL_BUTTON_PEN_MODE BTN_TOOL_PEN
@@ -326,6 +320,9 @@ struct aiptek {
326 int inDelay; /* jitter: in jitter delay? */ 320 int inDelay; /* jitter: in jitter delay? */
327 unsigned long endDelay; /* jitter: time when delay ends */ 321 unsigned long endDelay; /* jitter: time when delay ends */
328 int previousJitterable; /* jitterable prev value */ 322 int previousJitterable; /* jitterable prev value */
323
324 int lastMacro; /* macro key to reset */
325 int previousToolMode; /* pen, pencil, brush, etc. tool */
329 unsigned char *data; /* incoming packet data */ 326 unsigned char *data; /* incoming packet data */
330}; 327};
331 328
@@ -542,16 +539,18 @@ static void aiptek_irq(struct urb *urb)
542 * all 'bad' reports... 539 * all 'bad' reports...
543 */ 540 */
544 if (dv != 0) { 541 if (dv != 0) {
545 /* If we've not already sent a tool_button_?? code, do 542 /* If the selected tool changed, reset the old
546 * so now. Then set FIRED_BIT so it won't be resent unless 543 * tool key, and set the new one.
547 * the user forces FIRED_BIT off.
548 */ 544 */
549 if (TOOL_BUTTON_FIRED 545 if (aiptek->previousToolMode !=
550 (aiptek->curSetting.toolMode) == 0) { 546 aiptek->curSetting.toolMode) {
547 input_report_key(inputdev,
548 aiptek->previousToolMode, 0);
551 input_report_key(inputdev, 549 input_report_key(inputdev,
552 TOOL_BUTTON(aiptek->curSetting.toolMode), 550 aiptek->curSetting.toolMode,
553 1); 551 1);
554 aiptek->curSetting.toolMode |= TOOL_BUTTON_FIRED_BIT; 552 aiptek->previousToolMode =
553 aiptek->curSetting.toolMode;
555 } 554 }
556 555
557 if (p != 0) { 556 if (p != 0) {
@@ -612,16 +611,18 @@ static void aiptek_irq(struct urb *urb)
612 middle = (data[5] & aiptek->curSetting.mouseButtonMiddle) != 0 ? 1 : 0; 611 middle = (data[5] & aiptek->curSetting.mouseButtonMiddle) != 0 ? 1 : 0;
613 612
614 if (dv != 0) { 613 if (dv != 0) {
615 /* If we've not already sent a tool_button_?? code, do 614 /* If the selected tool changed, reset the old
616 * so now. Then set FIRED_BIT so it won't be resent unless 615 * tool key, and set the new one.
617 * the user forces FIRED_BIT off.
618 */ 616 */
619 if (TOOL_BUTTON_FIRED 617 if (aiptek->previousToolMode !=
620 (aiptek->curSetting.toolMode) == 0) { 618 aiptek->curSetting.toolMode) {
619 input_report_key(inputdev,
620 aiptek->previousToolMode, 0);
621 input_report_key(inputdev, 621 input_report_key(inputdev,
622 TOOL_BUTTON(aiptek->curSetting.toolMode), 622 aiptek->curSetting.toolMode,
623 1); 623 1);
624 aiptek->curSetting.toolMode |= TOOL_BUTTON_FIRED_BIT; 624 aiptek->previousToolMode =
625 aiptek->curSetting.toolMode;
625 } 626 }
626 627
627 if (p != 0) { 628 if (p != 0) {
@@ -662,15 +663,18 @@ static void aiptek_irq(struct urb *urb)
662 z = le16_to_cpu(get_unaligned((__le16 *) (data + 4))); 663 z = le16_to_cpu(get_unaligned((__le16 *) (data + 4)));
663 664
664 if (dv != 0) { 665 if (dv != 0) {
665 /* If we've not already sent a tool_button_?? code, do 666 /* If the selected tool changed, reset the old
666 * so now. Then set FIRED_BIT so it won't be resent unless 667 * tool key, and set the new one.
667 * the user forces FIRED_BIT off.
668 */ 668 */
669 if (TOOL_BUTTON_FIRED(aiptek->curSetting.toolMode) == 0) { 669 if (aiptek->previousToolMode !=
670 aiptek->curSetting.toolMode) {
671 input_report_key(inputdev,
672 aiptek->previousToolMode, 0);
670 input_report_key(inputdev, 673 input_report_key(inputdev,
671 TOOL_BUTTON(aiptek->curSetting.toolMode), 674 aiptek->curSetting.toolMode,
672 1); 675 1);
673 aiptek->curSetting.toolMode |= TOOL_BUTTON_FIRED_BIT; 676 aiptek->previousToolMode =
677 aiptek->curSetting.toolMode;
674 } 678 }
675 679
676 if (p != 0) { 680 if (p != 0) {
@@ -710,15 +714,18 @@ static void aiptek_irq(struct urb *urb)
710 macro = data[3]; 714 macro = data[3];
711 715
712 if (dv != 0) { 716 if (dv != 0) {
713 /* If we've not already sent a tool_button_?? code, do 717 /* If the selected tool changed, reset the old
714 * so now. Then set FIRED_BIT so it won't be resent unless 718 * tool key, and set the new one.
715 * the user forces FIRED_BIT off.
716 */ 719 */
717 if (TOOL_BUTTON_FIRED(aiptek->curSetting.toolMode) == 0) { 720 if (aiptek->previousToolMode !=
721 aiptek->curSetting.toolMode) {
722 input_report_key(inputdev,
723 aiptek->previousToolMode, 0);
718 input_report_key(inputdev, 724 input_report_key(inputdev,
719 TOOL_BUTTON(aiptek->curSetting.toolMode), 725 aiptek->curSetting.toolMode,
720 1); 726 1);
721 aiptek->curSetting.toolMode |= TOOL_BUTTON_FIRED_BIT; 727 aiptek->previousToolMode =
728 aiptek->curSetting.toolMode;
722 } 729 }
723 730
724 if (p != 0) { 731 if (p != 0) {
@@ -762,15 +769,18 @@ static void aiptek_irq(struct urb *urb)
762 0); 769 0);
763 } 770 }
764 771
765 /* If we've not already sent a tool_button_?? code, do 772 /* If the selected tool changed, reset the old
766 * so now. Then set FIRED_BIT so it won't be resent unless 773 tool key, and set the new one.
767 * the user forces FIRED_BIT off. 774 */
768 */ 775 if (aiptek->previousToolMode !=
769 if (TOOL_BUTTON_FIRED(aiptek->curSetting.toolMode) == 0) { 776 aiptek->curSetting.toolMode) {
777 input_report_key(inputdev,
778 aiptek->previousToolMode, 0);
770 input_report_key(inputdev, 779 input_report_key(inputdev,
771 TOOL_BUTTON(aiptek->curSetting. 780 aiptek->curSetting.toolMode,
772 toolMode), 1); 781 1);
773 aiptek->curSetting.toolMode |= TOOL_BUTTON_FIRED_BIT; 782 aiptek->previousToolMode =
783 aiptek->curSetting.toolMode;
774 } 784 }
775 785
776 input_report_key(inputdev, macroKeyEvents[macro], 1); 786 input_report_key(inputdev, macroKeyEvents[macro], 1);