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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
--- a/src/mouse.c 2026-07-23 13:55:22.649216163 -0500
+++ b/src/mouse.c 2026-07-23 14:01:32.777853582 -0500
@@ -1772,6 +1772,26 @@
break;
case DEVICE_ON:
+ /*
+ * illumos/Solaris CR 6892799 fix: the VUID /dev/mouse stream
+ * (unlike a plain serial line) does not tolerate being closed
+ * and reopened across every console mode switch (X VT
+ * enter/leave toggles DEVICE_OFF/DEVICE_ON around each
+ * switch). Keep the fd + Xisb buffer alive once opened; only
+ * (re)open here on the very first DEVICE_ON, or if a prior
+ * open attempt failed. DEVICE_OFF no longer closes the fd -
+ * the real close now happens once, in DEVICE_CLOSE.
+ */
+ if (pInfo->fd != -1) {
+ /* Already open from a previous DEVICE_ON - just re-enable. */
+ xf86FlushInput(pInfo->fd);
+ xf86AddEnabledDevice(pInfo);
+ if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft) {
+ RegisterBlockAndWakeupHandlers (MouseBlockHandler,
+ MouseWakeupHandler,
+ (pointer) pInfo);
+ }
+ } else {
pInfo->fd = xf86OpenSerial(pInfo->options);
if (pInfo->fd == -1)
xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
@@ -1820,6 +1840,7 @@
}
}
}
+ }
pMse->lastButtons = 0;
pMse->lastMappedButtons = 0;
pMse->emulateState = 0;
@@ -1832,12 +1853,11 @@
case DEVICE_OFF:
if (pInfo->fd != -1) {
xf86RemoveEnabledDevice(pInfo);
- if (pMse->buffer) {
- XisbFree(pMse->buffer);
- pMse->buffer = NULL;
- }
- xf86CloseSerial(pInfo->fd);
- pInfo->fd = -1;
+ /*
+ * 6892799: do NOT close/free the buffer or fd here - the
+ * VUID /dev/mouse stream must survive the mode switch.
+ * Actual teardown is deferred to DEVICE_CLOSE.
+ */
if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft)
{
RemoveBlockAndWakeupHandlers (MouseBlockHandler,
@@ -1848,6 +1868,16 @@
device->public.on = FALSE;
break;
case DEVICE_CLOSE:
+ /* 6892799: the fd/buffer were kept open across DEVICE_OFF/ON
+ * cycles; do the real close here, once, at final teardown. */
+ if (pInfo->fd != -1) {
+ if (pMse->buffer) {
+ XisbFree(pMse->buffer);
+ pMse->buffer = NULL;
+ }
+ xf86CloseSerial(pInfo->fd);
+ pInfo->fd = -1;
+ }
free(pMse->mousePriv);
pMse->mousePriv = NULL;
break;
@@ -3738,6 +3768,16 @@
#define VAL_THRESHOLD 40
/*
+ * SDK-drift compat fix: mouse.c relies on the X server's misc.h `sign()`
+ * macro, which the XLibre 25.1.8 SDK this port builds against no longer
+ * provides (dropped upstream). Define the historical semantics locally if
+ * it is not already defined by the SDK.
+ */
+#ifndef sign
+#define sign(x) ((x) > 0 ? 1 : ((x) < 0 ? -1 : 0))
+#endif
+
+/*
* checkForErraticMovements() -- check if mouse 'jumps around'.
*/
static void
|