Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2567848imu; Thu, 29 Nov 2018 07:02:05 -0800 (PST) X-Google-Smtp-Source: AFSGD/XEmxlsiavnb5YcwF1aup4sU96rZ+9nVLigODePsYfj48HuqW6+c3gfc3xq6s1VVlZA0t3k X-Received: by 2002:a17:902:3283:: with SMTP id z3mr1843665plb.76.1543503725422; Thu, 29 Nov 2018 07:02:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543503725; cv=none; d=google.com; s=arc-20160816; b=zT4k3jmp8SLUU5o22l13LVAfiQ+cEvVhw2b+tPN6pq3aENSdXmNmTewUYQIz5faPlA cZpa0mhpYZsE+9fFhrFfHDpaW7o/F4Zrb3OLzIEJC1D8198xE+v3iUZLqk3nwbo8dKBF 9vcfqYlaoVrfi0yBSFt8luBwY3cDsVIs6HKLFjHj6g5td/rsX+ayIJG1S2iEmLDOiV9J Tn6gl0aZkuPyi6SvypQ5HcBietFrUwwB1cNh1OotW6m+j3Z2Jcz6OCNRnYtxEs9aKn1+ riZlCMj+pCOci0vwi5a4geW/cngoNEkbZGvskHRfXh4bfuCHswwiORxwN98OcmUwUk8z M/gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FwAD2eNW/SGRS1KcQJMa33wjYLmMGXtjs/Oy7L3jBHg=; b=PPH6x/ES21UVvGSFS4jwc3tkVfyk3ZRdc61t/OPa2B1DlWUClzPeMzHlsWDtwy94yK Piz8E0Xkn9vLY13Y+M9Gu1EWf3G0j0r1abuQj2kGVi6n639rsuolN0D8Eot3mW3WQ7kX bksUrDkph6g4dC19+z1WrJT52obMw8K8LEW9TtIGJoPetHLr7IL+CRaRA41HJQVH5N8e SOST16CBkHH9ZOd4yRKiuJbEr4r2dHDZTtg8092dpXCNczX8O5SVmmhcH5tLyggR9QbW RYKB3btEaVN9Qq7gBOgiJnzehR0N8wDa4eqXHV0Vtvt2dOl7nPsceBRYcd8UAW5zWdfj J2QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bjwzqg3D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 23si2376197pfz.20.2018.11.29.07.01.47; Thu, 29 Nov 2018 07:02:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bjwzqg3D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730779AbeK3BYD (ORCPT + 99 others); Thu, 29 Nov 2018 20:24:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:46574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729264AbeK3BYD (ORCPT ); Thu, 29 Nov 2018 20:24:03 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 94A55208E7; Thu, 29 Nov 2018 14:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501112; bh=0oZ5M1I8EJEDDbBqG6UbEwpw2Q/7ZMJv02jBVGBhUMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bjwzqg3DaEAxlaAKUKDN1d1NYZrOF8B+CdrttTcGu+40VfohLf9Ul+NU8jy9mFhlO nYV/HGhO0MYXDsEGQ/W51uUhw9Lx8n4qiFwyuA14z7r9koiSD9eE9Dr9zFFjmu0S4W utyld+Wg6CJkPp46QIOS2HYlpEXemy6lwkXddLhc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Rojtberg , Dmitry Torokhov , Sasha Levin Subject: [PATCH 4.4 48/86] Input: xpad - move reporting xbox one home button to common function Date: Thu, 29 Nov 2018 15:12:13 +0100 Message-Id: <20181129140114.239467954@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140109.832117862@linuxfoundation.org> References: <20181129140109.832117862@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 4f88476c75429ba9ab71c428b4cd2f67575bc9c1 ] xbox one was the only device that has a *_process_buttons routine. Signed-off-by: Pavel Rojtberg Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/joystick/xpad.c | 52 +++++++++++++---------------------- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 8b7fc47f7ffb..b06f4b0785f7 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -610,14 +610,28 @@ static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned cha } /* - * xpadone_process_buttons + * xpadone_process_packet * - * Process a button update packet from an Xbox one controller. + * Completes a request by converting the data into events for the + * input subsystem. This version is for the Xbox One controller. + * + * The report format was gleaned from + * https://github.com/kylelemons/xbox/blob/master/xbox.go */ -static void xpadone_process_buttons(struct usb_xpad *xpad, - struct input_dev *dev, - unsigned char *data) +static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *data) { + struct input_dev *dev = xpad->dev; + + /* the xbox button has its own special report */ + if (data[0] == 0X07) { + input_report_key(dev, BTN_MODE, data[4] & 0x01); + input_sync(dev); + return; + } + /* check invalid packet */ + else if (data[0] != 0X20) + return; + /* menu/view buttons */ input_report_key(dev, BTN_START, data[4] & 0x04); input_report_key(dev, BTN_SELECT, data[4] & 0x08); @@ -680,34 +694,6 @@ static void xpadone_process_buttons(struct usb_xpad *xpad, input_sync(dev); } -/* - * xpadone_process_packet - * - * Completes a request by converting the data into events for the - * input subsystem. This version is for the Xbox One controller. - * - * The report format was gleaned from - * https://github.com/kylelemons/xbox/blob/master/xbox.go - */ - -static void xpadone_process_packet(struct usb_xpad *xpad, - u16 cmd, unsigned char *data) -{ - struct input_dev *dev = xpad->dev; - - switch (data[0]) { - case 0x20: - xpadone_process_buttons(xpad, dev, data); - break; - - case 0x07: - /* the xbox button has its own special report */ - input_report_key(dev, BTN_MODE, data[4] & 0x01); - input_sync(dev); - break; - } -} - static void xpad_irq_in(struct urb *urb) { struct usb_xpad *xpad = urb->context; -- 2.17.1