From patchwork Thu Oct 20 01:03:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gerecke X-Patchwork-Id: 9385691 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 F376E607D0 for ; Thu, 20 Oct 2016 01:04:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E434F28DD7 for ; Thu, 20 Oct 2016 01:04:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D883F296F3; Thu, 20 Oct 2016 01:04:24 +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 7B41128DD7 for ; Thu, 20 Oct 2016 01:04:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754231AbcJTBEX (ORCPT ); Wed, 19 Oct 2016 21:04:23 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35310 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753662AbcJTBEW (ORCPT ); Wed, 19 Oct 2016 21:04:22 -0400 Received: by mail-pf0-f193.google.com with SMTP id s8so3833539pfj.2 for ; Wed, 19 Oct 2016 18:04:22 -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=MiwKGx3u9FKhVaOQzxgoUc8OEXx7I3Tj4CbdKiO6hUI=; b=DeMyVAbN01I4vSa/8junxsr9U9QYNeIq0Qj3okMBtwSaaEEQowoxQHGcpU3aidLvNh 7of8ui15Dozu1DlI+trSULyM+CcIUvqLjbpGRWxWeKlH8Q6lbWybgzEiHPPpZk0J428L RUgrYVyng1KVz1EdMcCb0IgKfwSL+noV52mX4wg+vKabUOVd+aUBmTm0wyLXgxJpJwNm Jx6wL1Rs1W1WDPCDCn8BfnzLnpjCEx8LCWe7srzfINtoEfAtkk6sMwr4Kvybr5crxD7e RmG09wBEODepLtCnZ07tIoXOzA+m2buB8a5fzi4EX/KZU7BeLdN9fgbCAzk3OuY2bYrm 0ZFw== 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=MiwKGx3u9FKhVaOQzxgoUc8OEXx7I3Tj4CbdKiO6hUI=; b=SUqWADe9rcA4sbokqwRDVLiC9xI1a4pZdNao21gZQjCK4ziUxXA+Os3F77tRRUBPi3 bZDHSdZL9Q8g8snI5tA2Z7arMwZXCuWK9TZP7pdn7uKIbZzISerabVF+MHAr69YJF/xk Kf9v5CgbA+Gdp5ZPHV7HT/jZXom4MAZsXF1C6vJucBNIQd2ynCVw7osz91qJGHx5j6MW 3Wd+AGSK2P4QbDXcSnDa+8oHvoP3yTFFoxwDkl1hTNVP3je5dFsTgDJ//zFgTUkg1reU 1MeuV/CMggju/3nuUffEUIAiK+eIFvAxVLkXnFDNqLrKgEU12CpvR+D6AEzBCqsApvEy +FSg== X-Gm-Message-State: AA6/9RlHmd+Z7Vj/s7qhHixKGKgp4DLezc3xVNstKHhRpdajs7o4K/dXMdPewRXkSFr8dA== X-Received: by 10.98.97.68 with SMTP id v65mr16237580pfb.81.1476925461830; Wed, 19 Oct 2016 18:04:21 -0700 (PDT) Received: from wtc005007.corp.onewacom.com ([50.225.60.4]) by smtp.gmail.com with ESMTPSA id d15sm877372pfl.90.2016.10.19.18.04.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Oct 2016 18:04:21 -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 v3 05/18] HID: wacom: generic: Strip off excessive name prefixing Date: Wed, 19 Oct 2016 18:03:41 -0700 Message-Id: <20161020010354.4049-5-killertofu@gmail.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161020010354.4049-1-killertofu@gmail.com> References: <20161006212231.31440-1-killertofu@gmail.com> <20161020010354.4049-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 Reviewed-by: Benjamin Tissoires --- 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';