From patchwork Sun Jun 7 13:31:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Rojtberg X-Patchwork-Id: 6561391 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 061CAC0433 for ; Sun, 7 Jun 2015 13:33:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B32F20595 for ; Sun, 7 Jun 2015 13:33:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1D5B6205B1 for ; Sun, 7 Jun 2015 13:33:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751152AbbFGNds (ORCPT ); Sun, 7 Jun 2015 09:33:48 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:37496 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751151AbbFGNdr (ORCPT ); Sun, 7 Jun 2015 09:33:47 -0400 Received: by wifx6 with SMTP id x6so60722674wif.0 for ; Sun, 07 Jun 2015 06:33:46 -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=RKwD1e6kPKmRIWAJhdpJ2v0g7i63ApHk0yRUuAPIzh4=; b=eeK3ARTlMyXGEkuTLlZydWBOvqTipvnF/J65sMnUe6T+tWiFae7EGbHUQL5he3NJEm CNBu+rPE36Z/k/fDhDAA/cckRuk1mNN51qbqWVVVbybLfoimPjC2uqYWh7bKxpnIEOjM uxi2DdbbwKT/bT5y7jyfzYr8Xt+fgds4XsvFbobPI9tJ5HR3o90P/iC4bDRiL2IOy1F4 Y0pa0tYN0Crpw6zj0fCB1cmdGMul1YLI+hLfkmSPHS3fTGY2OA5SKAQrkYH6qEMUyFys jYJdeXJ8vVbJ+/445ksWO2Ir21FMXUuRfEP6QRDkRYqwvdRv61N67zYgooNxhdYMhZxh 0sbA== X-Received: by 10.180.103.227 with SMTP id fz3mr13338211wib.45.1433684026389; Sun, 07 Jun 2015 06:33:46 -0700 (PDT) Received: from deepwhite.fritz.box (p5DDCF55B.dip0.t-ipconnect.de. [93.220.245.91]) by mx.google.com with ESMTPSA id v3sm3696092wix.8.2015.06.07.06.33.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 07 Jun 2015 06:33:45 -0700 (PDT) From: Pavel Rojtberg X-Google-Original-From: Pavel Rojtberg < rojtberg@gmail.com > To: linux-input@vger.kernel.org, pgriffais@valvesoftware.com, dmitry.torokhov@gmail.com, gregkh@linuxfoundation.org Cc: Pavel Rojtberg Subject: [PATCH 2/2] Input: xpad: re-send led command for xbox360 wireless after controller becomes present. move led_no to xpad struct to this end. Date: Sun, 7 Jun 2015 15:31:06 +0200 Message-Id: <1433683866-8785-3-git-send-email-rojtberg@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1433683866-8785-1-git-send-email-rojtberg@gmail.com> References: <1433683866-8785-1-git-send-email-rojtberg@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Pavel Rojtberg Signed-off-by: Pavel Rojtberg --- drivers/input/joystick/xpad.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 3e4d3e2..76bdbb7 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -344,6 +344,7 @@ struct usb_xpad { int mapping; /* map d-pad to buttons or to axes */ int xtype; /* type of xbox device */ + unsigned long led_no; /* led to lit on xbox360 controllers */ }; /* @@ -488,6 +489,8 @@ static void xpad360_process_packet(struct usb_xpad *xpad, input_sync(dev); } +static void xpad_send_led_command(struct usb_xpad *xpad, int command); + /* * xpad360w_process_packet * @@ -510,6 +513,8 @@ static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned cha if (data[1] & 0x80) { xpad->pad_present = 1; usb_submit_urb(xpad->bulk_out, GFP_ATOMIC); + /* Light up the segment corresponding to controller number */ + xpad_send_led_command(xpad, (xpad->led_no % 4) + 2); } else xpad->pad_present = 0; } @@ -945,7 +950,6 @@ static void xpad_led_set(struct led_classdev *led_cdev, static int xpad_led_probe(struct usb_xpad *xpad) { static atomic_t led_seq = ATOMIC_INIT(-1); - unsigned long led_no; struct xpad_led *led; struct led_classdev *led_cdev; int error; @@ -957,9 +961,9 @@ static int xpad_led_probe(struct usb_xpad *xpad) if (!led) return -ENOMEM; - led_no = atomic_inc_return(&led_seq); + xpad->led_no = atomic_inc_return(&led_seq); - snprintf(led->name, sizeof(led->name), "xpad%lu", led_no); + snprintf(led->name, sizeof(led->name), "xpad%lu", xpad->led_no); led->xpad = xpad; led_cdev = &led->led_cdev; @@ -973,10 +977,8 @@ static int xpad_led_probe(struct usb_xpad *xpad) return error; } - /* - * Light up the segment corresponding to controller number - */ - xpad_send_led_command(xpad, (led_no % 4) + 2); + /* Light up the segment corresponding to controller number */ + xpad_send_led_command(xpad, (xpad->led_no % 4) + 2); return 0; } @@ -993,6 +995,7 @@ static void xpad_led_disconnect(struct usb_xpad *xpad) #else static int xpad_led_probe(struct usb_xpad *xpad) { return 0; } static void xpad_led_disconnect(struct usb_xpad *xpad) { } +static void xpad_send_led_command(struct usb_xpad *xpad, int command) { } #endif