Import few patches from upstream to allow building with newer xorg

Note that those drivers are barely maintained and might disappear in the futur

PR:		216270
Submitted by:	matthew@reztek.cz
This commit is contained in:
Baptiste Daroussin 2017-01-23 22:22:53 +00:00
parent c524320e17
commit 1810e8dcb7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=432296
11 changed files with 684 additions and 1 deletions

View file

@ -2,7 +2,7 @@
PORTNAME= xf86-input-acecad
PORTVERSION= 1.5.0
PORTREVISION= 6
PORTREVISION= 7
CATEGORIES= x11-drivers
MAINTAINER= x11@FreeBSD.org

View file

@ -0,0 +1,86 @@
From fd61e53ed08cec2b3af688a55507477f6ef30544 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Fri, 3 Jun 2011 15:59:14 +0200
Subject: =?UTF-8?q?Avoid=20=E2=80=9C'ReverseConvertProc'=20defined=20but?=
=?UTF-8?q?=20not=20used=E2=80=9D=20warning.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Move this function next to its unique caller (AceCadPreInit), and only
declare/define it when the input ABI is strictly less than 12.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Cyril Brulebois <kibi@debian.org>
diff --git a/src/acecad.c b/src/acecad.c
index 6259f21..f5a2213 100644
--- src/acecad.c
+++ src/acecad.c
@@ -370,6 +370,21 @@ SetupProc_fail:
return NULL;
}
+static Bool
+ReverseConvertProc (InputInfoPtr local,
+ int x, int y,
+ int *valuators)
+{
+ AceCadPrivatePtr priv = (AceCadPrivatePtr)(local->private);
+
+ // xf86Msg(X_INFO, "%s: reverse coordinate conversion in : %d, %d\n", local->name, x, y);
+ valuators[0] = x * priv->acecadMaxX / screenInfo.screens[0]->width;
+ valuators[1] = y * priv->acecadMaxY / screenInfo.screens[0]->height;
+ // xf86Msg(X_INFO, "%s: reverse coordinate conversion out: %d, %d\n", local->name, valuators[0], valuators[1]);
+
+ return TRUE;
+}
+
static int
NewAceCadPreInit(InputDriverPtr drv, InputInfoPtr local, int flags)
#else
@@ -1071,22 +1086,6 @@ ConvertProc (InputInfoPtr local, int first, int num,
}
-static Bool
-ReverseConvertProc (InputInfoPtr local,
- int x, int y,
- int *valuators)
-{
- AceCadPrivatePtr priv = (AceCadPrivatePtr)(local->private);
-
- // xf86Msg(X_INFO, "%s: reverse coordinate conversion in : %d, %d\n", local->name, x, y);
- valuators[0] = x * priv->acecadMaxX / screenInfo.screens[0]->width;
- valuators[1] = y * priv->acecadMaxY / screenInfo.screens[0]->height;
- // xf86Msg(X_INFO, "%s: reverse coordinate conversion out: %d, %d\n", local->name, valuators[0], valuators[1]);
-
- return TRUE;
-}
-
-
#define WriteString(str)\
XisbWrite (priv->buffer, (unsigned char *)(str), strlen(str))
diff --git a/src/acecad.h b/src/acecad.h
index a2b5c66..bd8e997 100644
--- src/acecad.h
+++ src/acecad.h
@@ -102,12 +102,12 @@ static Bool DeviceClose (DeviceIntPtr);
static Bool DeviceInit (DeviceIntPtr);
static void ReadInput (InputInfoPtr);
static Bool ConvertProc (InputInfoPtr, int, int, int, int, int, int, int, int, int *, int *);
-static Bool ReverseConvertProc(InputInfoPtr , int , int , int*);
static Bool QueryHardware (AceCadPrivatePtr);
static void NewPacket (AceCadPrivatePtr priv);
static Bool AceCadGetPacket (AceCadPrivatePtr);
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
static InputInfoPtr AceCadPreInit(InputDriverPtr, IDevPtr , int);
+static Bool ReverseConvertProc(InputInfoPtr , int , int , int*);
#else
static int AceCadPreInit(InputDriverPtr, InputInfoPtr , int);
#endif
--
cgit v0.10.2

View file

@ -0,0 +1,34 @@
From 1fea6530eeca06b0d8d15a9327f87063292e1e6d Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Fri, 3 Jun 2011 15:59:14 +0200
Subject: Silence gcc: report_{x, y} are getting initialized.
Get us rid of:
| CC acecad.lo
| acecad.c: In function 'USBReadInput':
| acecad.c:1052:43: warning: 'report_y' may be used uninitialized in this function [-Wuninitialized]
| acecad.c:1052:43: warning: 'report_x' may be used uninitialized in this function [-Wuninitialized]
Both code paths (with XORG_BOTCHED_INPUT or not) will lead report_x and
report_y to be set, but make sure the compiler stops guessing.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Cyril Brulebois <kibi@debian.org>
diff --git a/src/acecad.c b/src/acecad.c
index f5a2213..1e2f0c0 100644
--- src/acecad.c
+++ src/acecad.c
@@ -919,7 +919,7 @@ USBReadInput (InputInfoPtr local)
int x = priv->acecadOldX;
int y = priv->acecadOldY;
int z = priv->acecadOldZ;
- int report_x, report_y;
+ int report_x = 0, report_y = 0;
int prox = priv->acecadOldProximity;
int buttons = priv->acecadOldButtons;
int is_core_pointer = 0;
--
cgit v0.10.2

View file

@ -0,0 +1,165 @@
From ef1e9cf34e8f1ec2513dd6bd36d824b54e841ea7 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Fri, 3 Jun 2011 15:59:15 +0200
Subject: Drop support for pre-input ABI 12 servers.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Cyril Brulebois <kibi@debian.org>
diff --git a/configure.ac b/configure.ac
index 4c76754..d4a404d 100644
--- configure.ac
+++ configure.ac
@@ -55,7 +55,7 @@ AC_CHECK_HEADERS([linux/input.h sysfs/libsysfs.h])
XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
# Obtain compiler/linker options from server and required extensions
-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901] xproto kbproto inputproto $REQUIRED_MODULES)
+PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto kbproto inputproto $REQUIRED_MODULES)
# Define a configure option for an alternate input module directory
AC_ARG_WITH(xorg-module-dir,
diff --git a/src/acecad.c b/src/acecad.c
index d60b3b6..17e141f 100644
--- src/acecad.c
+++ src/acecad.c
@@ -90,6 +90,10 @@
#endif
#define DBG(lvl, f) {if ((lvl) <= xf86GetVerbosity()) f;}
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
+#error "XINPUT ABI 12 required."
+#endif
+
/*****************************************************************************
* Local Headers
****************************************************************************/
@@ -331,66 +335,8 @@ ProbeFound:
#endif
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
-static int NewAceCadPreInit(InputDriverPtr drv, InputInfoPtr dev, int flags);
-
-static InputInfoPtr
-AceCadPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
-{
- InputInfoPtr local = xf86AllocateInput(drv, 0);
- AceCadPrivatePtr priv = calloc (1, sizeof(AceCadPrivateRec));
-
- if ((!local))
- goto SetupProc_fail;
-
- local->name = dev->identifier;
- local->type_name = XI_TABLET;
- local->flags = XI86_SEND_DRAG_EVENTS;
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
- local->motion_history_proc = xf86GetMotionEvents;
-#endif
- local->control_proc = NULL;
- local->switch_mode = NULL;
- local->conversion_proc = ConvertProc;
- local->reverse_conversion_proc = ReverseConvertProc;
- local->dev = NULL;
- local->private = priv;
- local->private_flags = 0;
- local->conf_idev = dev;
- /*local->always_core_feedback = 0;*/
-
- xf86CollectInputOptions(local, default_options, NULL);
-
- xf86OptionListReport(local->options);
-
- if (NewAceCadPreInit(drv, local, flags) == Success)
- return local;
-
-SetupProc_fail:
- return NULL;
-}
-
-static Bool
-ReverseConvertProc (InputInfoPtr local,
- int x, int y,
- int *valuators)
-{
- AceCadPrivatePtr priv = (AceCadPrivatePtr)(local->private);
-
- // xf86Msg(X_INFO, "%s: reverse coordinate conversion in : %d, %d\n", local->name, x, y);
- valuators[0] = x * priv->acecadMaxX / screenInfo.screens[0]->width;
- valuators[1] = y * priv->acecadMaxY / screenInfo.screens[0]->height;
- // xf86Msg(X_INFO, "%s: reverse coordinate conversion out: %d, %d\n", local->name, valuators[0], valuators[1]);
-
- return TRUE;
-}
-
-static int
-NewAceCadPreInit(InputDriverPtr drv, InputInfoPtr local, int flags)
-#else
static int
AceCadPreInit(InputDriverPtr drv, InputInfoPtr local, int flags)
-#endif
{
AceCadPrivatePtr priv = calloc (1, sizeof(AceCadPrivateRec));
int speed;
@@ -500,10 +446,6 @@ AceCadPreInit(InputDriverPtr drv, InputInfoPtr local, int flags)
xf86ProcessCommonOptions(local, local->options);
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
- local->flags |= XI86_CONFIGURED;
-#endif
-
if (local->fd != -1)
{
RemoveEnabledDevice (local->fd);
@@ -709,9 +651,6 @@ DeviceInit (DeviceIntPtr dev)
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
axes_labels,
#endif
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3
- xf86GetMotionEvents,
-#endif
history_size,
((priv->flags & ABSOLUTE_FLAG)? Absolute: Relative)|OutOfProximity)
== FALSE)
@@ -818,9 +757,6 @@ ReadInput (InputInfoPtr local)
/*xf86Msg(X_INFO, "ACECAD Tablet Read Input\n");*/
is_absolute = (priv->flags & ABSOLUTE_FLAG);
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
- is_core_pointer = xf86IsCorePointer(local->dev);
-#endif
/*
* set blocking to -1 on the first call because we know there is data to
@@ -923,9 +859,6 @@ USBReadInput (InputInfoPtr local)
int prox = priv->acecadOldProximity;
int buttons = priv->acecadOldButtons;
int is_core_pointer = 0;
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
- is_core_pointer = xf86IsCorePointer(local->dev);
-#endif
/* Is autodev active? */
int autodev = priv->flags & AUTODEV_FLAG;
/* Was the device available last time we checked? */
diff --git a/src/acecad.h b/src/acecad.h
index bd8e997..b9291c7 100644
--- src/acecad.h
+++ src/acecad.h
@@ -105,12 +105,7 @@ static Bool ConvertProc (InputInfoPtr, int, int, int, int, int, int, int, int, i
static Bool QueryHardware (AceCadPrivatePtr);
static void NewPacket (AceCadPrivatePtr priv);
static Bool AceCadGetPacket (AceCadPrivatePtr);
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
-static InputInfoPtr AceCadPreInit(InputDriverPtr, IDevPtr , int);
-static Bool ReverseConvertProc(InputInfoPtr , int , int , int*);
-#else
static int AceCadPreInit(InputDriverPtr, InputInfoPtr , int);
-#endif
#ifdef HAVE_LINUX_INPUT_H
static void USBReadInput (InputInfoPtr);
static Bool USBQueryHardware (InputInfoPtr);
--
cgit v0.10.2

View file

@ -0,0 +1,121 @@
From 21f7f1705d2c0b46ce19367d5ac8a4c225d755ef Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Fri, 3 Jun 2011 15:59:15 +0200
Subject: Remove checks on the ABI now that 12 or higher is required.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Cyril Brulebois <kibi@debian.org>
diff --git a/src/acecad.c b/src/acecad.c
index 17e141f..de2577e 100644
--- src/acecad.c
+++ src/acecad.c
@@ -79,10 +79,8 @@
#endif
#endif
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
#include <X11/Xatom.h>
#include <xserver-properties.h>
-#endif
/* Previously found in xf86Xinput.h */
#ifdef DBG
@@ -130,9 +128,7 @@ _X_EXPORT InputDriverRec ACECAD =
AceCadPreInit,
NULL,
NULL,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
default_options
-#endif
};
static XF86ModuleVersionInfo VersionRec =
@@ -599,7 +595,6 @@ DeviceInit (DeviceIntPtr dev)
AceCadPrivatePtr priv = (AceCadPrivatePtr) (local->private);
unsigned char map[] = {0, 1, 2, 3};
int history_size;
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
Atom btn_labels[3];
Atom axes_labels[3];
@@ -618,15 +613,12 @@ DeviceInit (DeviceIntPtr dev)
axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Z);
}
-#endif
xf86MsgVerb(X_INFO, 4, "%s Init\n", local->name);
/* 3 boutons */
if (InitButtonClassDeviceStruct (dev, 3,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
btn_labels,
-#endif
map) == FALSE)
{
xf86Msg(X_ERROR, "%s: unable to allocate ButtonClassDeviceStruct\n", local->name);
@@ -648,9 +640,7 @@ DeviceInit (DeviceIntPtr dev)
/* 3 axes */
if (InitValuatorClassDeviceStruct (dev, 3,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
axes_labels,
-#endif
history_size,
((priv->flags & ABSOLUTE_FLAG)? Absolute: Relative)|OutOfProximity)
== FALSE)
@@ -663,9 +653,7 @@ DeviceInit (DeviceIntPtr dev)
InitValuatorAxisStruct(dev,
0,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
axes_labels[0],
-#endif
0, /* min val */
#if XORG_BOTCHED_INPUT
screenInfo.screens[0]->width,
@@ -675,15 +663,11 @@ DeviceInit (DeviceIntPtr dev)
1000, /* resolution */
0, /* min_res */
1000 /* max_res */
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
, Absolute
-#endif
);
InitValuatorAxisStruct(dev,
1,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
axes_labels[1],
-#endif
0, /* min val */
#if XORG_BOTCHED_INPUT
screenInfo.screens[0]->height,
@@ -693,23 +677,17 @@ DeviceInit (DeviceIntPtr dev)
1000, /* resolution */
0, /* min_res */
1000 /* max_res */
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
, Absolute
-#endif
);
InitValuatorAxisStruct(dev,
2,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
axes_labels[2],
-#endif
0, /* min val */
priv->acecadMaxZ, /* max val */
1000, /* resolution */
0, /* min_res */
1000 /* max_res */
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
, Absolute
-#endif
);
}
--
cgit v0.10.2

View file

@ -0,0 +1,97 @@
From 9385ae905aca9e679e698f0491e0bf7e30a35092 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Fri, 3 Jun 2011 15:59:16 +0200
Subject: Remove pointless checks on is_core_pointer.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Cyril Brulebois <kibi@debian.org>
diff --git a/src/acecad.c b/src/acecad.c
index de2577e..ad6d793 100644
--- src/acecad.c
+++ src/acecad.c
@@ -729,7 +729,7 @@ ReadInput (InputInfoPtr local)
{
int x, y, z;
int prox, buttons;
- int is_core_pointer = 0, is_absolute;
+ int is_absolute;
AceCadPrivatePtr priv = (AceCadPrivatePtr) (local->private);
/*xf86Msg(X_INFO, "ACECAD Tablet Read Input\n");*/
@@ -772,11 +772,10 @@ ReadInput (InputInfoPtr local)
if (prox)
{
if (!(priv->acecadOldProximity))
- if (!is_core_pointer)
- {
- /*xf86Msg(X_INFO, "ACECAD Tablet ProxIN %d %d %d\n",x, y, z);*/
- xf86PostProximityEvent(local->dev, 1, 0, 3 , x, y, z);
- }
+ {
+ /*xf86Msg(X_INFO, "ACECAD Tablet ProxIN %d %d %d\n",x, y, z);*/
+ xf86PostProximityEvent(local->dev, 1, 0, 3 , x, y, z);
+ }
if ((is_absolute && ((priv->acecadOldX != x) || (priv->acecadOldY != y) || (priv->acecadOldZ != z)))
|| (!is_absolute && (x || y)))
@@ -809,12 +808,11 @@ ReadInput (InputInfoPtr local)
}
else
{
- if (!is_core_pointer)
- if (priv->acecadOldProximity)
- {
- /*xf86Msg(X_INFO, "ACECAD Tablet ProxOUT %d %d %d\n",x, y, z);*/
- xf86PostProximityEvent(local->dev, 0, 0, 3, x,y,z);
- }
+ if (priv->acecadOldProximity)
+ {
+ /*xf86Msg(X_INFO, "ACECAD Tablet ProxOUT %d %d %d\n",x, y, z);*/
+ xf86PostProximityEvent(local->dev, 0, 0, 3, x,y,z);
+ }
priv->acecadOldProximity = 0;
}
}
@@ -836,7 +834,6 @@ USBReadInput (InputInfoPtr local)
int report_x = 0, report_y = 0;
int prox = priv->acecadOldProximity;
int buttons = priv->acecadOldButtons;
- int is_core_pointer = 0;
/* Is autodev active? */
int autodev = priv->flags & AUTODEV_FLAG;
/* Was the device available last time we checked? */
@@ -935,10 +932,9 @@ USBReadInput (InputInfoPtr local)
report_y = y;
#endif
if (!(priv->acecadOldProximity))
- if (!is_core_pointer)
- {
- xf86PostProximityEvent(local->dev, 1, 0, 3 , report_x, report_y, z);
- }
+ {
+ xf86PostProximityEvent(local->dev, 1, 0, 3 , report_x, report_y, z);
+ }
xf86PostMotionEvent(local->dev, 1, 0, 3, report_x, report_y, z);
@@ -957,11 +953,10 @@ USBReadInput (InputInfoPtr local)
}
else
{
- if (!is_core_pointer)
- if (priv->acecadOldProximity)
- {
- xf86PostProximityEvent(local->dev, 0, 0, 3, report_x, report_y, z);
- }
+ if (priv->acecadOldProximity)
+ {
+ xf86PostProximityEvent(local->dev, 0, 0, 3, report_x, report_y, z);
+ }
priv->acecadOldProximity = 0;
}
--
cgit v0.10.2

View file

@ -0,0 +1,25 @@
From ec2c4ead497133ef20d5ef5a9b481b38e1e0f7a2 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Mon, 27 Jun 2011 13:13:54 +1000
Subject: Assign local->private after allocating.
It is detrimental to the user experience when the driver tries to derefernce
null pointers.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/acecad.c b/src/acecad.c
index ad6d793..604fe91 100644
--- src/acecad.c
+++ src/acecad.c
@@ -343,6 +343,7 @@ AceCadPreInit(InputDriverPtr drv, InputInfoPtr local, int flags)
return BadAlloc;
memset(priv, 0, sizeof(AceCadPrivateRec));
+ local->private = priv;
local->device_control = DeviceControl;
--
cgit v0.10.2

View file

@ -0,0 +1,26 @@
From 39b97cc0138417141b245179fc8555bbb365e879 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri, 8 Jul 2011 12:24:16 +1000
Subject: Always set the type name.
The server assigns "UNKNOWN", override it with something more specific.
Introduced in f85c4b580c074f7054eac98753d1f4e91f08305e.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/acecad.c b/src/acecad.c
index 604fe91..2b6aa45 100644
--- src/acecad.c
+++ src/acecad.c
@@ -346,6 +346,7 @@ AceCadPreInit(InputDriverPtr drv, InputInfoPtr local, int flags)
local->private = priv;
local->device_control = DeviceControl;
+ local->type_name = XI_TABLET;
priv->acecadInc = xf86SetIntOption(local->options, "Increment", 0 );
--
cgit v0.10.2

View file

@ -0,0 +1,26 @@
From e76e20d4d4a39e139a778411a2ed09ec35c2046e Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 19 Jul 2011 09:29:28 +1000
Subject: Dont call xf86DeleteInput on PreInit failure.
The server calls this for us once PreInit returns with an error,
calling it during PreInit means the server continues to use
already free'd memory.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/acecad.c b/src/acecad.c
index 2b6aa45..a3326a0 100644
--- src/acecad.c
+++ src/acecad.c
@@ -471,7 +471,6 @@ SetupProc_fail:
if (local)
local->private = NULL;
}
- xf86DeleteInput(local, 0);
return BadAlloc;
}
--
cgit v0.10.2

View file

@ -0,0 +1,72 @@
From 2f1a5b44f62028f2608c0c94e58154df09e9ada3 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 19 Jul 2011 14:13:33 +1000
Subject: Don't free anything in PreInit, provide an UnInit instead.
Also fixes:
- leaking priv->buffer
- fd closure bug
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/acecad.c b/src/acecad.c
index a3326a0..6a0b347 100644
--- src/acecad.c
+++ src/acecad.c
@@ -126,7 +126,7 @@ _X_EXPORT InputDriverRec ACECAD =
"acecad",
NULL,
AceCadPreInit,
- NULL,
+ AceCadUnInit,
NULL,
default_options
};
@@ -462,16 +462,26 @@ AceCadPreInit(InputDriverPtr drv, InputInfoPtr local, int flags)
* If something went wrong, cleanup and return NULL
*/
SetupProc_fail:
- if ((local) && (local->fd))
+ return BadAlloc;
+}
+
+static void
+AceCadUnInit(InputDriverPtr drv, InputInfoPtr local, int flags)
+{
+ AceCadPrivatePtr priv = (AceCadPrivatePtr) (local->private);
+
+ if (local->fd > -1)
+ {
xf86CloseSerial (local->fd);
- if ((priv) && (priv->buffer))
- XisbFree (priv->buffer);
+ local->fd = -1;
+ }
+
if (priv) {
+ if (priv->buffer)
+ XisbFree (priv->buffer);
free (priv);
- if (local)
- local->private = NULL;
+ local->private = NULL;
}
- return BadAlloc;
}
static Bool
diff --git a/src/acecad.h b/src/acecad.h
index b9291c7..48fa38a 100644
--- src/acecad.h
+++ src/acecad.h
@@ -106,6 +106,7 @@ static Bool QueryHardware (AceCadPrivatePtr);
static void NewPacket (AceCadPrivatePtr priv);
static Bool AceCadGetPacket (AceCadPrivatePtr);
static int AceCadPreInit(InputDriverPtr, InputInfoPtr , int);
+static void AceCadUnInit(InputDriverPtr, InputInfoPtr , int);
#ifdef HAVE_LINUX_INPUT_H
static void USBReadInput (InputInfoPtr);
static Bool USBQueryHardware (InputInfoPtr);
--
cgit v0.10.2

View file

@ -0,0 +1,31 @@
# Finish converting RemoveEnabledDevice to xf86RemoveEnabledDevice
#
--- src/acecad.c.orig 2016-11-24 00:26:03 UTC
+++ src/acecad.c
@@ -491,7 +491,7 @@ AceCadPreInit(InputDriverPtr drv, InputI
if (local->fd != -1)
{
- RemoveEnabledDevice (local->fd);
+ xf86RemoveEnabledDevice (local);
if (priv->buffer)
{
XisbFree(priv->buffer);
@@ -499,7 +499,7 @@ AceCadPreInit(InputDriverPtr drv, InputI
}
xf86CloseSerial(local->fd);
}
- RemoveEnabledDevice (local->fd);
+ xf86RemoveEnabledDevice (local);
local->fd = -1;
return Success;
@@ -601,7 +601,7 @@ DeviceOff (DeviceIntPtr dev)
if (local->fd != -1)
{
- RemoveEnabledDevice (local->fd);
+ xf86RemoveEnabledDevice (local);
if (priv->buffer)
{
XisbFree(priv->buffer);