From patchwork Sun Feb 5 00:30:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cameron Gutman X-Patchwork-Id: 9555807 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 C536C60236 for ; Sun, 5 Feb 2017 00:32:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B26C9269DA for ; Sun, 5 Feb 2017 00:32:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A717926BE9; Sun, 5 Feb 2017 00:32:11 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 61E5A269DA for ; Sun, 5 Feb 2017 00:32:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751955AbdBEAcF (ORCPT ); Sat, 4 Feb 2017 19:32:05 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:35875 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751893AbdBEAbk (ORCPT ); Sat, 4 Feb 2017 19:31:40 -0500 Received: by mail-pg0-f66.google.com with SMTP id 75so5458659pgf.3; Sat, 04 Feb 2017 16:31:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yuRkw6Dcn1HJJTYdBzZJVoWxnGhbcaWVHroETfjfRf0=; b=R5cjnT7Ug/hDJ1qAnru//ebNaGdB2DGcASBWAZ4QRlHk7WESlhRqRWA5zLie3Ox4D7 h+mBgcZG7r+wzHbxUOLD54KVD/CrIkpbJYL+jE8qfaeZXR4wZN2QRkVyCsryXsEw65QD KVUlVPvjIE+ejJzkVg8x0vVKM7EcnvJJhUYPnhVYIFgTLamjcVmJIqhjXl1i1U7z5H1k Bp6h4my85Ww220B0qBiuNkXuYeIYm2MqNU7ABQedAV4CZcrrCh3v71JLMHMKhNexHY1H pb/Zc+6Y+udzsUbqQD1FKyED/jJ0sZzst95L4P95SENHU/KTGp6lYDvEaZaoG9IDd7P7 97AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yuRkw6Dcn1HJJTYdBzZJVoWxnGhbcaWVHroETfjfRf0=; b=Qervn41sBxRr0mHfDOmHKbQ9GddZflYPK2EEvZOe4egozUA6zGw9EAXATPjf0f7ONG zQtGyTSLHDf791NUyHHYYcoLPpU2K0YfteBdM75f3x/deBfcyZSBeHIkQvifk80yhMpF DnzSv4pFqJGV85wFJfRMR1VwdwLh04hQWKPI6Oh1WLuUEUYvKSePOCQKJ+s2TjNqnTkr OQkeZUx778p7goZYSLQFm2JsCznTdJLX8dmOlQjvjK4cOwoxSmtMPHhDalRGiuRjP8T+ AqDEUIPul9ptj+Bf4xtPlyhvVFxvq31iD4QmH5hQFrAVJPNsycguZFycSq6XXN2WsDPa WspA== X-Gm-Message-State: AIkVDXJN6YDnW/k1Idv7xOwbFNzvovVeuTlmNqrl6hgwWkLLIHMtBBzKWLCxV98je+Eixw== X-Received: by 10.98.252.203 with SMTP id e194mr5304150pfh.8.1486254699588; Sat, 04 Feb 2017 16:31:39 -0800 (PST) Received: from localhost.localdomain ([174.127.240.168]) by smtp.gmail.com with ESMTPSA id s8sm77744303pfj.30.2017.02.04.16.31.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Feb 2017 16:31:39 -0800 (PST) From: Cameron Gutman To: dmitry.torokhov@gmail.com, rojtberg@gmail.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Cameron Gutman Subject: [PATCH 4/5] Input: xpad - restore LED state after device resume Date: Sat, 4 Feb 2017 16:30:01 -0800 Message-Id: <20170205003002.28160-5-aicommander@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170205003002.28160-1-aicommander@gmail.com> References: <20170205003002.28160-1-aicommander@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 state of pad LEDs can be inconsistent when the system is woken up after sleep. Rather than leaving the controllers blinking, let's resend the last LED command to Xbox 360 pads on resume. Since Xbox One pads stop flashing only when reinitialized, we'll send them the initialization packet so they calm down too. Signed-off-by: Cameron Gutman --- drivers/input/joystick/xpad.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 13f298d..1179266 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -1683,11 +1683,23 @@ static int xpad_resume(struct usb_interface *intf) retval = xpad360w_start_input(xpad); } else { mutex_lock(&input->mutex); - if (input->users) + if (input->users) { retval = xpad_start_input(xpad); + } else if (xpad->xtype == XTYPE_XBOXONE) { + /* + * Even if there are no users, we'll send Xbox One pads + * the startup sequence so they don't sit there and + * blink until somebody opens the input device again. + */ + retval = xpad_start_xbox_one(xpad); + } mutex_unlock(&input->mutex); } + /* LED state is lost across resume, so resend the last command */ + if (xpad->led) + xpad_send_led_command(xpad, xpad->led->led_cdev.brightness); + return retval; }