@@ -580,11 +580,12 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
580
580
struct wacom_features * features = & wacom -> features ;
581
581
unsigned char * data = wacom -> data ;
582
582
struct input_dev * input = wacom -> pen_input ;
583
- int idx = 0 ;
583
+ int idx = ( features -> type == INTUOS ) ? ( data [ 1 ] & 0x01 ) : 0 ;
584
584
585
- /* tool number */
586
- if (features -> type == INTUOS )
587
- idx = data [1 ] & 0x01 ;
585
+ if (!(((data [1 ] & 0xfc ) == 0xc0 ) || /* in prox */
586
+ ((data [1 ] & 0xfe ) == 0x20 ) || /* in range */
587
+ ((data [1 ] & 0xfe ) == 0x80 ))) /* out prox */
588
+ return 0 ;
588
589
589
590
/* Enter report */
590
591
if ((data [1 ] & 0xfc ) == 0xc0 ) {
@@ -676,26 +677,6 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
676
677
return 1 ;
677
678
}
678
679
679
- /*
680
- * don't report events for invalid data
681
- */
682
- /* older I4 styli don't work with new Cintiqs */
683
- if ((!((wacom -> id [idx ] >> 20 ) & 0x01 ) &&
684
- (features -> type == WACOM_21UX2 )) ||
685
- /* Only large Intuos support Lense Cursor */
686
- (wacom -> tool [idx ] == BTN_TOOL_LENS &&
687
- (features -> type == INTUOS3 ||
688
- features -> type == INTUOS3S ||
689
- features -> type == INTUOS4 ||
690
- features -> type == INTUOS4S ||
691
- features -> type == INTUOS5 ||
692
- features -> type == INTUOS5S ||
693
- features -> type == INTUOSPM ||
694
- features -> type == INTUOSPS )) ||
695
- /* Cintiq doesn't send data when RDY bit isn't set */
696
- (features -> type == CINTIQ && !(data [1 ] & 0x40 )))
697
- return 1 ;
698
-
699
680
wacom -> shared -> stylus_in_proximity = true;
700
681
if (wacom -> shared -> touch_down )
701
682
return 1 ;
@@ -897,6 +878,26 @@ static int wacom_intuos_general(struct wacom_wac *wacom)
897
878
return 1 ;
898
879
}
899
880
881
+ /*
882
+ * don't report events for invalid data
883
+ */
884
+ /* older I4 styli don't work with new Cintiqs */
885
+ if ((!((wacom -> id [idx ] >> 20 ) & 0x01 ) &&
886
+ (features -> type == WACOM_21UX2 )) ||
887
+ /* Only large Intuos support Lense Cursor */
888
+ (wacom -> tool [idx ] == BTN_TOOL_LENS &&
889
+ (features -> type == INTUOS3 ||
890
+ features -> type == INTUOS3S ||
891
+ features -> type == INTUOS4 ||
892
+ features -> type == INTUOS4S ||
893
+ features -> type == INTUOS5 ||
894
+ features -> type == INTUOS5S ||
895
+ features -> type == INTUOSPM ||
896
+ features -> type == INTUOSPS )) ||
897
+ /* Cintiq doesn't send data when RDY bit isn't set */
898
+ (features -> type == CINTIQ && !(data [1 ] & 0x40 )))
899
+ return 1 ;
900
+
900
901
x = (be16_to_cpup ((__be16 * )& data [2 ]) << 1 ) | ((data [9 ] >> 1 ) & 1 );
901
902
y = (be16_to_cpup ((__be16 * )& data [4 ]) << 1 ) | (data [9 ] & 1 );
902
903
distance = data [9 ] >> 2 ;
0 commit comments