@@ -2047,10 +2047,21 @@ static void wacom_wac_pad_usage_mapping(struct hid_device *hdev,
20472047 break ;
20482048 case WACOM_HID_WD_TOUCHRING :
20492049 if (field -> flags & HID_MAIN_ITEM_RELATIVE ) {
2050- wacom_map_usage (input , usage , field , EV_REL , REL_WHEEL_HI_RES , 0 );
2051- set_bit (REL_WHEEL , input -> relbit );
2050+ wacom_wac -> relring_count ++ ;
2051+ if (wacom_wac -> relring_count == 1 ) {
2052+ wacom_map_usage (input , usage , field , EV_REL , REL_WHEEL_HI_RES , 0 );
2053+ set_bit (REL_WHEEL , input -> relbit );
2054+ }
2055+ else if (wacom_wac -> relring_count == 2 ) {
2056+ wacom_map_usage (input , usage , field , EV_REL , REL_HWHEEL_HI_RES , 0 );
2057+ set_bit (REL_HWHEEL , input -> relbit );
2058+ }
20522059 } else {
2053- wacom_map_usage (input , usage , field , EV_ABS , ABS_WHEEL , 0 );
2060+ wacom_wac -> absring_count ++ ;
2061+ if (wacom_wac -> absring_count == 1 )
2062+ wacom_map_usage (input , usage , field , EV_ABS , ABS_WHEEL , 0 );
2063+ else if (wacom_wac -> absring_count == 2 )
2064+ wacom_map_usage (input , usage , field , EV_ABS , ABS_THROTTLE , 0 );
20542065 }
20552066 features -> device_type |= WACOM_DEVICETYPE_PAD ;
20562067 break ;
@@ -2173,14 +2184,37 @@ static void wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field
21732184 value = wacom_offset_rotation (input , usage , value , 1 , 2 );
21742185 }
21752186 else if (field -> flags & HID_MAIN_ITEM_RELATIVE ) {
2176- /* We must invert the sign for vertical
2177- * relative scrolling. Clockwise rotation
2178- * produces positive values from HW, but
2179- * userspace treats positive REL_WHEEL as a
2180- * scroll *up*!
2181- */
2182- int hires_value = - value * 120 / usage -> resolution_multiplier ;
2183- int * ring_value = & wacom_wac -> hid_data .ring_value ;
2187+ int hires_value = value * 120 / usage -> resolution_multiplier ;
2188+ int * ring_value ;
2189+ int lowres_code ;
2190+
2191+ if (usage -> code == REL_WHEEL_HI_RES ) {
2192+ /* We must invert the sign for vertical
2193+ * relative scrolling. Clockwise
2194+ * rotation produces positive values
2195+ * from HW, but userspace treats
2196+ * positive REL_WHEEL as a scroll *up*!
2197+ */
2198+ hires_value = - hires_value ;
2199+ ring_value = & wacom_wac -> hid_data .ring_value ;
2200+ lowres_code = REL_WHEEL ;
2201+ }
2202+ else if (usage -> code == REL_HWHEEL_HI_RES ) {
2203+ /* No need to invert the sign for
2204+ * horizontal relative scrolling.
2205+ * Clockwise rotation produces positive
2206+ * values from HW and userspace treats
2207+ * positive REL_HWHEEL as a scroll
2208+ * right.
2209+ */
2210+ ring_value = & wacom_wac -> hid_data .ring2_value ;
2211+ lowres_code = REL_HWHEEL ;
2212+ }
2213+ else {
2214+ hid_err (wacom -> hdev , "unrecognized relative wheel with code %d\n" ,
2215+ usage -> code );
2216+ break ;
2217+ }
21842218
21852219 value = hires_value ;
21862220 * ring_value += hires_value ;
@@ -2191,7 +2225,7 @@ static void wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field
21912225 if (* ring_value >= 120 || * ring_value <= -120 ) {
21922226 int clicks = * ring_value / 120 ;
21932227
2194- input_event (input , usage -> type , REL_WHEEL , clicks );
2228+ input_event (input , usage -> type , lowres_code , clicks );
21952229 * ring_value -= clicks * 120 ;
21962230 }
21972231 }
0 commit comments