| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Joystick device driver for the input driver suite. |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 1999-2002 Vojtech Pavlik |
|---|
| 5 | 6 | * Copyright (c) 1999 Colin Van Dyke |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 9 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | | - * (at your option) any later version. |
|---|
| 11 | 7 | */ |
|---|
| 12 | 8 | |
|---|
| 13 | 9 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| .. | .. |
|---|
| 279 | 275 | goto err_free_client; |
|---|
| 280 | 276 | |
|---|
| 281 | 277 | file->private_data = client; |
|---|
| 282 | | - nonseekable_open(inode, file); |
|---|
| 278 | + stream_open(inode, file); |
|---|
| 283 | 279 | |
|---|
| 284 | 280 | return 0; |
|---|
| 285 | 281 | |
|---|
| .. | .. |
|---|
| 815 | 811 | static bool joydev_dev_is_absolute_mouse(struct input_dev *dev) |
|---|
| 816 | 812 | { |
|---|
| 817 | 813 | DECLARE_BITMAP(jd_scratch, KEY_CNT); |
|---|
| 814 | + bool ev_match = false; |
|---|
| 818 | 815 | |
|---|
| 819 | 816 | BUILD_BUG_ON(ABS_CNT > KEY_CNT || EV_CNT > KEY_CNT); |
|---|
| 820 | 817 | |
|---|
| .. | .. |
|---|
| 833 | 830 | * considered to be an absolute mouse if the following is |
|---|
| 834 | 831 | * true: |
|---|
| 835 | 832 | * |
|---|
| 836 | | - * 1) Event types are exactly EV_ABS, EV_KEY and EV_SYN. |
|---|
| 833 | + * 1) Event types are exactly |
|---|
| 834 | + * EV_ABS, EV_KEY and EV_SYN |
|---|
| 835 | + * or |
|---|
| 836 | + * EV_ABS, EV_KEY, EV_SYN and EV_MSC |
|---|
| 837 | + * or |
|---|
| 838 | + * EV_ABS, EV_KEY, EV_SYN, EV_MSC and EV_REL. |
|---|
| 837 | 839 | * 2) Absolute events are exactly ABS_X and ABS_Y. |
|---|
| 838 | 840 | * 3) Keys are exactly BTN_LEFT, BTN_RIGHT and BTN_MIDDLE. |
|---|
| 839 | 841 | * 4) Device is not on "Amiga" bus. |
|---|
| 840 | 842 | */ |
|---|
| 841 | 843 | |
|---|
| 842 | 844 | bitmap_zero(jd_scratch, EV_CNT); |
|---|
| 845 | + /* VMware VMMouse, HP ILO2 */ |
|---|
| 843 | 846 | __set_bit(EV_ABS, jd_scratch); |
|---|
| 844 | 847 | __set_bit(EV_KEY, jd_scratch); |
|---|
| 845 | 848 | __set_bit(EV_SYN, jd_scratch); |
|---|
| 846 | | - if (!bitmap_equal(jd_scratch, dev->evbit, EV_CNT)) |
|---|
| 849 | + if (bitmap_equal(jd_scratch, dev->evbit, EV_CNT)) |
|---|
| 850 | + ev_match = true; |
|---|
| 851 | + |
|---|
| 852 | + /* HP ILO2, AMI BMC firmware */ |
|---|
| 853 | + __set_bit(EV_MSC, jd_scratch); |
|---|
| 854 | + if (bitmap_equal(jd_scratch, dev->evbit, EV_CNT)) |
|---|
| 855 | + ev_match = true; |
|---|
| 856 | + |
|---|
| 857 | + /* VMware Virtual USB Mouse, QEMU USB Tablet, ATEN BMC firmware */ |
|---|
| 858 | + __set_bit(EV_REL, jd_scratch); |
|---|
| 859 | + if (bitmap_equal(jd_scratch, dev->evbit, EV_CNT)) |
|---|
| 860 | + ev_match = true; |
|---|
| 861 | + |
|---|
| 862 | + if (!ev_match) |
|---|
| 847 | 863 | return false; |
|---|
| 848 | 864 | |
|---|
| 849 | 865 | bitmap_zero(jd_scratch, ABS_CNT); |
|---|