summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2021-11-26 11:06:19 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2021-12-20 15:01:56 +1000
commita7506f139d60934c04dab33554fba07c371ca61b (patch)
tree7ed427e51b01c596736fbc76f6f2179591b6b96b /src
parent759f919d808971fa015fd3016e15538b4301aedd (diff)
downloadxf86-input-wacom-a7506f139d60934c04dab33554fba07c371ca61b.tar.gz
Add a hook to update the device's name in the driver
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/WacomInterface.h2
-rw-r--r--src/wcmConfig.c6
-rw-r--r--src/xf86Wacom.c8
3 files changed, 12 insertions, 4 deletions
diff --git a/src/WacomInterface.h b/src/WacomInterface.h
index ef12e83..1794d1c 100644
--- a/src/WacomInterface.h
+++ b/src/WacomInterface.h
@@ -107,6 +107,8 @@ void wcmClose(WacomDevicePtr priv);
int wcmGetFd(WacomDevicePtr priv);
void wcmSetFd(WacomDevicePtr priv, int fd);
+/* Update the driver implementation's name, if any */
+void wcmSetName(WacomDevicePtr priv, const char *name);
static inline void wcmAxisSet(WacomAxisData *data,
diff --git a/src/wcmConfig.c b/src/wcmConfig.c
index b8a4858..3a89cb8 100644
--- a/src/wcmConfig.c
+++ b/src/wcmConfig.c
@@ -693,7 +693,6 @@ static inline WacomType getType(const char *type)
* "wacom" */
int wcmPreInit(WacomDevicePtr priv)
{
- InputInfoPtr pInfo = priv->pInfo;
WacomCommonPtr common = NULL;
char *type = NULL, *device = NULL;
char *oldname = NULL;
@@ -750,10 +749,9 @@ int wcmPreInit(WacomDevicePtr priv)
char *new_name;
if (asprintf(&new_name, "%s %s", priv->name, type) == -1)
new_name = strdup(priv->name);
- free(pInfo->name);
free(priv->name);
- pInfo->name = new_name;
- priv->name = strdup(new_name);
+ priv->name = new_name;
+ wcmSetName(priv, new_name);
}
/* check if the type is valid for those don't need hotplug */
diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
index 296ed5c..d8ca5c4 100644
--- a/src/xf86Wacom.c
+++ b/src/xf86Wacom.c
@@ -587,6 +587,14 @@ void wcmSetFd(WacomDevicePtr priv, int fd)
priv->pInfo->fd = fd;
}
+void wcmSetName(WacomDevicePtr priv, const char *name)
+{
+ InputInfoPtr pInfo = priv->pInfo;
+
+ free(pInfo->name);
+ pInfo->name = strdup(name);
+}
+
/*****************************************************************************
* wcmOpen --
****************************************************************************/