This repository has been archived by the owner on Feb 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
usb-hid-mac-quirks.patch
64 lines (60 loc) · 2.85 KB
/
usb-hid-mac-quirks.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# T2 SDE: target/coreos/package/.../usb-hid-mac-quirks.patch
# Copyright (C) 2011 - 2012 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- T2-COPYRIGHT-NOTE-END ---
OS X apparently uses ~15% as "overscan" area, probably to make it more
comfortable to really reach the edge on fuzzy boundary values, ...
Ideally we could let the OS scale the values, by faking the logic
min and max to be 15% larger, however, for some strange reasons
I could not yet find combinations that would work even partially
as expected (e.g. higher value values would nto work at all,
maybe the driver expects 32bit ints as x/y due exceeding the
max of the signed 16 bit int?).
--- qemu-kvm-0.12.5/hw/usb-hid.c.vanilla 2011-02-18 14:33:29.000000000 +0000
+++ qemu-kvm-0.12.5/hw/usb-hid.c 2011-02-18 14:40:07.000000000 +0000
@@ -289,7 +289,7 @@
static const uint8_t qemu_tablet_hid_report_descriptor[] = {
0x05, 0x01, /* Usage Page (Generic Desktop) */
- 0x09, 0x01, /* Usage (Pointer) */
+ 0x09, 0x02, /* Usage (Mouse) (OSX does not "like"^W support Pointer) */
0xa1, 0x01, /* Collection (Application) */
0x09, 0x01, /* Usage (Pointer) */
0xa1, 0x00, /* Collection (Physical) */
@@ -307,10 +307,8 @@
0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x30, /* Usage (X) */
0x09, 0x31, /* Usage (Y) */
- 0x15, 0x00, /* Logical Minimum (0) */
- 0x26, 0xff, 0x7f, /* Logical Maximum (0x7fff) */
- 0x35, 0x00, /* Physical Minimum (0) */
- 0x46, 0xff, 0x7f, /* Physical Maximum (0x7fff) */
+ 0x17,0x00,0x00,0,0, /* Logical Minimum (0) - a little*/
+ 0x27,0xff,0x7f,0,0, /* Logical Maximum (0x7fff) + a little */
0x75, 0x10, /* Report Size (16) */
0x95, 0x02, /* Report Count (2) */
0x81, 0x02, /* Input (Data, Variable, Absolute) */
--- qemu-kvm-1.0.1/hw/hid.c.vanilla 2012-06-28 09:31:44.402287497 +0000
+++ qemu-kvm-1.0.1/hw/hid.c 2012-06-28 09:30:20.414378668 +0000
@@ -245,8 +245,9 @@
e->xdx -= dx;
e->ydy -= dy;
} else {
- dx = e->xdx;
- dy = e->ydy;
+ /* OSX scaling - TODO: make an config option */
+ dx = (signed int)(.85 * ((signed int)e->xdx - 0x4000)) + 0x4000;
+ dy = (signed int)(.85 * ((signed int)e->ydy - 0x4000)) + 0x4000;
}
dz = int_clamp(e->dz, -127, 127);
e->dz -= dz;