The product name received from the string descriptor in the new MobileStudio
Pro line of tablets begins with "Wacom", which leads to unnecessary visual
noise in the device name when appended to the vendor name which also includes
"Wacom". Look for and fix cases like this.

Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoi...@redhat.com>
[jason.gere...@wacom.com: Imported into input-wacom repository (f2209d4)]
Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>
[jason.gere...@wacom.com: backported from input-wacom repository (b0fa322)]
Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>
---
 3.17/wacom_sys.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/3.17/wacom_sys.c b/3.17/wacom_sys.c
index c6f1da1..16c8083 100644
--- a/3.17/wacom_sys.c
+++ b/3.17/wacom_sys.c
@@ -1765,6 +1765,19 @@ static void wacom_update_name(struct wacom *wacom, const 
char *suffix)
                                /* shift everything including the terminator */
                                memmove(gap, gap+1, strlen(gap));
                        }
+
+                       /* strip off excessive prefixing */
+                       if (strstr(name, "Wacom Co.,Ltd. Wacom ") == name) {
+                               int n = strlen(name);
+                               int x = strlen("Wacom Co.,Ltd. ");
+                               memmove(name, name+x, n-x+1);
+                       }
+                       if (strstr(name, "Wacom Co., Ltd. Wacom ") == name) {
+                               int n = strlen(name);
+                               int x = strlen("Wacom Co., Ltd. ");
+                               memmove(name, name+x, n-x+1);
+                       }
+
                        /* get rid of trailing whitespace */
                        if (name[strlen(name)-1] == ' ')
                                name[strlen(name)-1] = '\0';
-- 
2.10.2


------------------------------------------------------------------------------
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to