diff options
Diffstat (limited to 'drivers/hid/hid-input.c')
-rw-r--r-- | drivers/hid/hid-input.c | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index a2f74e6adc70..d6fab5798487 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -325,6 +325,9 @@ static const struct hid_device_id hid_battery_quirks[] = { | |||
325 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, | 325 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, |
326 | USB_DEVICE_ID_ELECOM_BM084), | 326 | USB_DEVICE_ID_ELECOM_BM084), |
327 | HID_BATTERY_QUIRK_IGNORE }, | 327 | HID_BATTERY_QUIRK_IGNORE }, |
328 | { HID_USB_DEVICE(USB_VENDOR_ID_SYMBOL, | ||
329 | USB_DEVICE_ID_SYMBOL_SCANNER_3), | ||
330 | HID_BATTERY_QUIRK_IGNORE }, | ||
328 | {} | 331 | {} |
329 | }; | 332 | }; |
330 | 333 | ||
@@ -1838,47 +1841,3 @@ void hidinput_disconnect(struct hid_device *hid) | |||
1838 | } | 1841 | } |
1839 | EXPORT_SYMBOL_GPL(hidinput_disconnect); | 1842 | EXPORT_SYMBOL_GPL(hidinput_disconnect); |
1840 | 1843 | ||
1841 | /** | ||
1842 | * hid_scroll_counter_handle_scroll() - Send high- and low-resolution scroll | ||
1843 | * events given a high-resolution wheel | ||
1844 | * movement. | ||
1845 | * @counter: a hid_scroll_counter struct describing the wheel. | ||
1846 | * @hi_res_value: the movement of the wheel, in the mouse's high-resolution | ||
1847 | * units. | ||
1848 | * | ||
1849 | * Given a high-resolution movement, this function converts the movement into | ||
1850 | * microns and emits high-resolution scroll events for the input device. It also | ||
1851 | * uses the multiplier from &struct hid_scroll_counter to emit low-resolution | ||
1852 | * scroll events when appropriate for backwards-compatibility with userspace | ||
1853 | * input libraries. | ||
1854 | */ | ||
1855 | void hid_scroll_counter_handle_scroll(struct hid_scroll_counter *counter, | ||
1856 | int hi_res_value) | ||
1857 | { | ||
1858 | int low_res_value, remainder, multiplier; | ||
1859 | |||
1860 | input_report_rel(counter->dev, REL_WHEEL_HI_RES, | ||
1861 | hi_res_value * counter->microns_per_hi_res_unit); | ||
1862 | |||
1863 | /* | ||
1864 | * Update the low-res remainder with the high-res value, | ||
1865 | * but reset if the direction has changed. | ||
1866 | */ | ||
1867 | remainder = counter->remainder; | ||
1868 | if ((remainder ^ hi_res_value) < 0) | ||
1869 | remainder = 0; | ||
1870 | remainder += hi_res_value; | ||
1871 | |||
1872 | /* | ||
1873 | * Then just use the resolution multiplier to see if | ||
1874 | * we should send a low-res (aka regular wheel) event. | ||
1875 | */ | ||
1876 | multiplier = counter->resolution_multiplier; | ||
1877 | low_res_value = remainder / multiplier; | ||
1878 | remainder -= low_res_value * multiplier; | ||
1879 | counter->remainder = remainder; | ||
1880 | |||
1881 | if (low_res_value) | ||
1882 | input_report_rel(counter->dev, REL_WHEEL, low_res_value); | ||
1883 | } | ||
1884 | EXPORT_SYMBOL_GPL(hid_scroll_counter_handle_scroll); | ||