mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	HID: wacom: generic: Strip off excessive name prefixing
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.gerecke@wacom.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
		
							parent
							
								
									6005a13c90
								
							
						
					
					
						commit
						f2209d4aef
					
				
					 1 changed files with 13 additions and 0 deletions
				
			
		| 
						 | 
					@ -1940,6 +1940,19 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix)
 | 
				
			||||||
				/* shift everything including the terminator */
 | 
									/* shift everything including the terminator */
 | 
				
			||||||
				memmove(gap, gap+1, strlen(gap));
 | 
									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 */
 | 
								/* get rid of trailing whitespace */
 | 
				
			||||||
			if (name[strlen(name)-1] == ' ')
 | 
								if (name[strlen(name)-1] == ' ')
 | 
				
			||||||
				name[strlen(name)-1] = '\0';
 | 
									name[strlen(name)-1] = '\0';
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue