summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2021-11-26 11:26:10 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2021-12-20 15:01:56 +1000
commit9caf26360367a8b28ca7c6961887052509d61fbd (patch)
treec2c179a38dcd54692b992e399a5af87f7ae3e008 /src
parent493ccdc8f2d1e94dde7f45b2062ac7f91b9a3cf4 (diff)
downloadxf86-input-wacom-9caf26360367a8b28ca7c6961887052509d61fbd.tar.gz
Allow building the driver without serial ISDV4 support
If configured with -Disdv4=false, the ISDV4 serial bits will not be built, including the udev rules and the inputattach helper and service files. This is meson only. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/wcmConfig.c22
-rw-r--r--src/wcmISDV4-stub.c2
-rw-r--r--src/wcmISDV4.c3
-rw-r--r--src/wcmUSB.c3
-rw-r--r--src/xf86WacomDefs.h12
5 files changed, 26 insertions, 16 deletions
diff --git a/src/wcmConfig.c b/src/wcmConfig.c
index 7f83c9a..0bbbda5 100644
--- a/src/wcmConfig.c
+++ b/src/wcmConfig.c
@@ -423,19 +423,25 @@ static Bool
wcmDetectDeviceClass(WacomDevicePtr priv)
{
WacomCommonPtr common = priv->common;
+ WacomHWClass *classes[] = {
+ WacomGetClassISDV4(),
+ WacomGetClassUSB(),
+ };
if (common->wcmDevCls)
return TRUE;
- /* Bluetooth is also considered as USB */
- if (gWacomISDV4Device.Detect(priv))
- common->wcmDevCls = &gWacomISDV4Device;
- else if (gWacomUSBDevice.Detect(priv))
- common->wcmDevCls = &gWacomUSBDevice;
- else
- wcmLog(priv, W_ERROR, "cannot identify device class.\n");
+ for (size_t i = 0; i < ARRAY_SIZE(classes); i++) {
+ WacomHWClass *cls = classes[i];
+ if (cls && cls->Detect(priv)) {
+ common->wcmDevCls = cls;
+ return TRUE;
+ }
+ }
+
+ wcmLog(priv, W_ERROR, "cannot identify device class.\n");
- return (common->wcmDevCls != NULL);
+ return FALSE;
}
static Bool
diff --git a/src/wcmISDV4-stub.c b/src/wcmISDV4-stub.c
new file mode 100644
index 0000000..f537448
--- /dev/null
+++ b/src/wcmISDV4-stub.c
@@ -0,0 +1,2 @@
+extern void* WacomGetClassISDV4(void);
+void* WacomGetClassISDV4(void) { return (void*)0; }
diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c
index 8a07493..30dde6d 100644
--- a/src/wcmISDV4.c
+++ b/src/wcmISDV4.c
@@ -79,13 +79,14 @@ static int wcmSerialValidate(WacomDevicePtr priv, const unsigned char* data);
static int wcmWaitForTablet(WacomDevicePtr priv, char * data, int size);
static int wcmWriteWait(WacomDevicePtr priv, const char* request);
-WacomDeviceClass gWacomISDV4Device =
+static WacomHWClass gWacomISDV4Device =
{
.Detect = isdv4Detect,
.ProbeKeys = isdv4ProbeKeys,
.ParseOptions = isdv4ParseOptions,
.Init = isdv4Init,
};
+WacomHWClass *WacomGetClassISDV4(void) { return &gWacomISDV4Device; }
static WacomModel isdv4General =
{
diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 9125dbd..dd9b619 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -64,13 +64,14 @@ static void usbParseMscEvent(WacomDevicePtr priv,
static void usbDispatchEvents(WacomDevicePtr priv);
static int usbChooseChannel(WacomCommonPtr common, int device_type, unsigned int serial);
-WacomDeviceClass gWacomUSBDevice =
+static WacomHWClass gWacomUSBDevice =
{
.Detect = usbDetect,
.ProbeKeys = usbProbeKeys,
.ParseOptions = usbParseOptions,
.Init = usbWcmInit,
};
+WacomHWClass *WacomGetClassUSB(void) { return &gWacomUSBDevice; }
#define DEFINE_MODEL(mname, identifier, protocol) \
static struct _WacomModel mname = \
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index 6e2aff9..c4ec4d4 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -76,7 +76,7 @@ typedef struct _WacomDeviceState WacomDeviceState, *WacomDeviceStatePtr;
typedef struct _WacomChannel WacomChannel, *WacomChannelPtr;
typedef struct _WacomCommonRec WacomCommonRec, *WacomCommonPtr;
typedef struct _WacomFilterState WacomFilterState, *WacomFilterStatePtr;
-typedef struct _WacomDeviceClass WacomDeviceClass, *WacomDeviceClassPtr;
+typedef struct _WacomHWClass WacomHWClass, *WacomHWClassPtr;
typedef struct _WacomTool WacomTool, *WacomToolPtr;
/******************************************************************************
@@ -336,11 +336,11 @@ struct _WacomChannel
};
/******************************************************************************
- * WacomDeviceClass
+ * WacomHWClass
*****************************************************************************/
/* Functions are called in the order as listed in the struct */
-struct _WacomDeviceClass
+struct _WacomHWClass
{
Bool (*Detect)(WacomDevicePtr priv); /* detect device */
int (*ProbeKeys)(WacomDevicePtr priv); /* set the bits for the keys supported */
@@ -348,8 +348,8 @@ struct _WacomDeviceClass
Bool (*Init)(WacomDevicePtr priv); /* initialize device */
};
-extern WacomDeviceClass gWacomUSBDevice;
-extern WacomDeviceClass gWacomISDV4Device;
+extern WacomHWClass *WacomGetClassISDV4(void);
+extern WacomHWClass *WacomGetClassUSB(void);
/******************************************************************************
* WacomCommonRec
@@ -438,7 +438,7 @@ struct _WacomCommonRec
int wcmThreshold; /* Threshold for button pressure */
WacomChannel wcmChannel[MAX_CHANNELS]; /* channel device state */
- WacomDeviceClassPtr wcmDevCls; /* device class functions */
+ WacomHWClassPtr wcmDevCls; /* device class functions */
WacomModelPtr wcmModel; /* model-specific functions */
int wcmTPCButton; /* set Tablet PC button on/off */
int wcmTouch; /* disable/enable touch event */