Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2802046imu; Thu, 29 Nov 2018 10:26:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/W78uv1Aw19RWJjdBmdkvsCHBUAhSTX59dX2/0GxLTMpgH4fORpfQ6pU6QgGRiAKYaEyNGN X-Received: by 2002:a62:868b:: with SMTP id x133mr2576125pfd.252.1543515959964; Thu, 29 Nov 2018 10:25:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543515959; cv=none; d=google.com; s=arc-20160816; b=vu07eMxW3Ai6vCy/qA6kbyWFog+ZlDMuYVOKMNR35kb8neoqutK2TsSVy4+jcigGYZ X3WBseDRQcyAMhn/Bb8lCAkj9+9WpDxxU0z5CeUSlOTMrf0JWdNf0yZGExjCpJWKVxUd SoP7jXH7gN6vC5LFQSwcnav3jnlolVGRkpmfku4Le2c2abQG8XIR1ZXugce6NUmuRYfB +bZNZLjmuW8VZG1QIbnrcOCTRwiem335nMo63TUB8oN4VmFcQNwbZFtYfTA7Z8DhoqJC sDxpAzil6/vlYqQUzcrW4CiHPMUrH3wEAYP29JgGfMHcgRXC8q8whg1Nb4MVqwGpTdfH zcEA== 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=pIQ1B2Qzx2B7Np1NrQKwklpZ+YCuch6JtqG3jXtwMNk=; b=ergg+QW7Sx+ji9w8uu09rhtE0MuZf8ampvnnsJWwnVxlXkcdJ+VvFgkEyUnjV43jD2 hCTMaV4vEXLhqLuZxcqX/il8Ney5ZtH6Hho6p5reR/YnCcJrHBomhkpSlcHIyOEc5gIb w6l9SQxczleO/vSRS4s6q8vyxwtYcitOmxRDiBfoMMYHXp6Lf9C6ctaSRcRjk36/8Vxp w0DeMhSUcY6o7BpTTfPS3A5Mw9AD0tsc/dJvy/SLKdNVhyTS0TtNocU8RB4n+bnojyBh LTw0jXhEDTafX3CY9DTRCQhd4TGZhFnyNcN2tk0xpfPNhHOVZ/pShSukJDAboS6HtKqa lq9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UlMSsuNR; 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 m142si3112937pfd.171.2018.11.29.10.25.45; Thu, 29 Nov 2018 10:25:59 -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=UlMSsuNR; 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 S1729613AbeK3BU5 (ORCPT + 99 others); Thu, 29 Nov 2018 20:20:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:42044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728241AbeK3BU4 (ORCPT ); Thu, 29 Nov 2018 20:20:56 -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 664B1205C9; Thu, 29 Nov 2018 14:15:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543500925; bh=Ml46sLZ2I7XA1lA1VHb7Lc/qMDJbTsvhonaSnoL5fTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UlMSsuNR+QpfBrKvj/Gqw4UsS1sJIJQwmPzZNSH5Br8dstR6YuqWXwpGe6D7HlB8P z1BMbyjfU8e3mLRu9exAnvhwVksGRuQ/vx8zoQArAfrHVuBvz1rvnIPNivBK+14pCk VldsToGnRBSjDoCRu/jpBxtpEmo57JDW3SaUmhY0= 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 3.18 54/83] Input: xpad - move reporting xbox one home button to common function Date: Thu, 29 Nov 2018 15:12:12 +0100 Message-Id: <20181129140140.689705391@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140138.002176596@linuxfoundation.org> References: <20181129140138.002176596@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 3.18-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