From patchwork Thu Oct 6 21:22:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 9365329 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2E3D56077E for ; Thu, 6 Oct 2016 21:22:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1950E29253 for ; Thu, 6 Oct 2016 21:22:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E29629256; Thu, 6 Oct 2016 21:22:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A130C29253 for ; Thu, 6 Oct 2016 21:22:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935173AbcJFVWu (ORCPT ); Thu, 6 Oct 2016 17:22:50 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:36468 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935171AbcJFVWt (ORCPT ); Thu, 6 Oct 2016 17:22:49 -0400 Received: by mail-qk0-f195.google.com with SMTP id z190so1660593qkc.3 for ; Thu, 06 Oct 2016 14:22:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8WzC06XIEoRyMn5OXDpgPLufoqFSqJn6l2ZfQCSkLG4=; b=RZYc92QVe6ywFuQFwM4bQ4lQ4/z+I6troO/X/LppKnTRbAxUhtEOeeawW2iU+/7tX4 euTUV3/K18KMn1uxJkhng4MIijekkfOu3ZHeapAXxzMFpcyJRi9SCnzwYXblAZSJSefg psFzAO0zWKHiY1+YQ6ySSegj2bs4UMr9zYmkc4s3pZnat73OYxAN8y5BGdO6ss41Ju0Z 8bxdCYDxM+n/k1bQ8iqs/s01hENf/fOx+qBSpToQ1Ey01JOTHT8qD6xr2NdkipdX5zpa o9mEQOcN4DVDACeH98tacHOl9Opt0nKNIMYO/aBNDsJTZ9SP3xkW2ul2SBLhYxKbeDVr VI+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8WzC06XIEoRyMn5OXDpgPLufoqFSqJn6l2ZfQCSkLG4=; b=YPtmkAwErfzuaKO5WsMlONXuXEIaaAWj8ZVnqsZ6GDMc89FoPS4l0Y408WUrcxDxC0 Xdy4pe4XvVVuhgEfJPraGhA7DI7oAYHg58Q1OKMeywWfPoAsCZeUUzrjBss+bivVzi0a ZsBNdlDFCWxO0bGCZTMc/EB4xqHpZprCoYft3mZpFNYdM4qjWIXem56j+vDR98k5y6S0 FsbTtuJLdc8/ma8VM5cwZBdzYwuV5PX5XqVg9md3e4rqOXOOVb0s3eRb6H8bhFYitABQ 7du8opG6eXoGaD4Zq1birSyBk7cRa79tzRBXGQY7yTUG0EB3ettPQF7l4ww/lmiOlrHZ /dPQ== X-Gm-Message-State: AA6/9RnSDrytb8J1x0wWVKG5pkNrQqbCCLBYjbSO22feH+1nmO7PYAH/bFga0OpaUQhsVw== X-Received: by 10.55.25.211 with SMTP id 80mr16768184qkz.230.1475788968362; Thu, 06 Oct 2016 14:22:48 -0700 (PDT) Received: from wacom-arch2.corp.onewacom.com ([50.225.60.4]) by smtp.gmail.com with ESMTPSA id m4sm5773714qkf.29.2016.10.06.14.22.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Oct 2016 14:22:47 -0700 (PDT) From: Jason Gerecke To: linux-input@vger.kernel.org, Jiri Kosina Cc: Benjamin Tissoires , Ping Cheng , Ping Cheng , Aaron Skomra , Jason Gerecke , Jason Gerecke Subject: [PATCH 05/19] HID: wacom: generic: Strip off excessive name prefixing Date: Thu, 6 Oct 2016 14:22:17 -0700 Message-Id: <20161006212231.31440-6-killertofu@gmail.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161006212231.31440-1-killertofu@gmail.com> References: <20161006212231.31440-1-killertofu@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/hid/wacom_sys.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 033cc03..7b9bff2 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -1940,6 +1940,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';