Skip to content

Commit f1539a0

Browse files
committed
Revert "HID: input: Create a utility class for counting scroll events"
This reverts commit 1ff2e1a. It turns out the current API is not that compatible with some Microsoft mice, so better start again from scratch. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Acked-by: Harry Cutts <hcutts@chromium.org> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Jiri Kosina <jkosina@suse.cz>
1 parent 00acc9e commit f1539a0

File tree

2 files changed

+0
-73
lines changed

2 files changed

+0
-73
lines changed

drivers/hid/hid-input.c

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,48 +1841,3 @@ void hidinput_disconnect(struct hid_device *hid)
18411841
}
18421842
EXPORT_SYMBOL_GPL(hidinput_disconnect);
18431843

1844-
/**
1845-
* hid_scroll_counter_handle_scroll() - Send high- and low-resolution scroll
1846-
* events given a high-resolution wheel
1847-
* movement.
1848-
* @counter: a hid_scroll_counter struct describing the wheel.
1849-
* @hi_res_value: the movement of the wheel, in the mouse's high-resolution
1850-
* units.
1851-
*
1852-
* Given a high-resolution movement, this function converts the movement into
1853-
* microns and emits high-resolution scroll events for the input device. It also
1854-
* uses the multiplier from &struct hid_scroll_counter to emit low-resolution
1855-
* scroll events when appropriate for backwards-compatibility with userspace
1856-
* input libraries.
1857-
*/
1858-
void hid_scroll_counter_handle_scroll(struct hid_scroll_counter *counter,
1859-
int hi_res_value)
1860-
{
1861-
int low_res_scroll_amount;
1862-
/* Some wheels will rest 7/8ths of a notch from the previous notch
1863-
* after slow movement, so we want the threshold for low-res events to
1864-
* be in the middle of the notches (e.g. after 4/8ths) as opposed to on
1865-
* the notches themselves (8/8ths).
1866-
*/
1867-
int threshold = counter->resolution_multiplier / 2;
1868-
1869-
input_report_rel(counter->dev, REL_WHEEL_HI_RES,
1870-
hi_res_value * counter->microns_per_hi_res_unit);
1871-
1872-
counter->remainder += hi_res_value;
1873-
if (abs(counter->remainder) >= threshold) {
1874-
/* Add (or subtract) 1 because we want to trigger when the wheel
1875-
* is half-way to the next notch (i.e. scroll 1 notch after a
1876-
* 1/2 notch movement, 2 notches after a 1 1/2 notch movement,
1877-
* etc.).
1878-
*/
1879-
low_res_scroll_amount =
1880-
counter->remainder / counter->resolution_multiplier
1881-
+ (hi_res_value > 0 ? 1 : -1);
1882-
input_report_rel(counter->dev, REL_WHEEL,
1883-
low_res_scroll_amount);
1884-
counter->remainder -=
1885-
low_res_scroll_amount * counter->resolution_multiplier;
1886-
}
1887-
}
1888-
EXPORT_SYMBOL_GPL(hid_scroll_counter_handle_scroll);

include/linux/hid.h

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,34 +1139,6 @@ static inline u32 hid_report_len(struct hid_report *report)
11391139
int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
11401140
int interrupt);
11411141

1142-
1143-
/**
1144-
* struct hid_scroll_counter - Utility class for processing high-resolution
1145-
* scroll events.
1146-
* @dev: the input device for which events should be reported.
1147-
* @microns_per_hi_res_unit: the amount moved by the user's finger for each
1148-
* high-resolution unit reported by the mouse, in
1149-
* microns.
1150-
* @resolution_multiplier: the wheel's resolution in high-resolution mode as a
1151-
* multiple of its lower resolution. For example, if
1152-
* moving the wheel by one "notch" would result in a
1153-
* value of 1 in low-resolution mode but 8 in
1154-
* high-resolution, the multiplier is 8.
1155-
* @remainder: counts the number of high-resolution units moved since the last
1156-
* low-resolution event (REL_WHEEL or REL_HWHEEL) was sent. Should
1157-
* only be used by class methods.
1158-
*/
1159-
struct hid_scroll_counter {
1160-
struct input_dev *dev;
1161-
int microns_per_hi_res_unit;
1162-
int resolution_multiplier;
1163-
1164-
int remainder;
1165-
};
1166-
1167-
void hid_scroll_counter_handle_scroll(struct hid_scroll_counter *counter,
1168-
int hi_res_value);
1169-
11701142
/* HID quirks API */
11711143
unsigned long hid_lookup_quirk(const struct hid_device *hdev);
11721144
int hid_quirks_init(char **quirks_param, __u16 bus, int count);

0 commit comments

Comments
 (0)