Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933174AbbLSVRP (ORCPT ); Sat, 19 Dec 2015 16:17:15 -0500 Received: from smtp6-g21.free.fr ([212.27.42.6]:20379 "EHLO smtp6-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750835AbbLSVRN (ORCPT ); Sat, 19 Dec 2015 16:17:13 -0500 Date: Sat, 19 Dec 2015 22:17:09 +0100 From: Clement Calmels To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, Pavel Rojtberg , "Pierre-Loup A. Griffais" , linux-kernel@vger.kernel.org Subject: Re: [PATCH] Input: xpad - use LED API when identifying wireless controllers Message-ID: <20151219221709.5b5947ec@gromit> In-Reply-To: <20151216224408.GA14261@dtor-ws> References: <20151216224408.GA14261@dtor-ws> X-Mailer: Claws Mail 3.13.0 (GTK+ 2.24.29; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2077 Lines: 58 On Wed, 16 Dec 2015 14:44:08 -0800 Dmitry Torokhov wrote: > When lighting up the segment identifying wireless controller, Instead > of sending command directly to the controller, let's do it via LED > API (usinf led_set_brightness) so that LED object state is in sync > with controller state and we'll light up the correct segment on > resume as well. > > Signed-off-by: Dmitry Torokhov > --- > > I do not have the hardware so please try this out. > > drivers/input/joystick/xpad.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/input/joystick/xpad.c > b/drivers/input/joystick/xpad.c index 36328b3..00a766b 100644 > --- a/drivers/input/joystick/xpad.c > +++ b/drivers/input/joystick/xpad.c > @@ -1118,7 +1118,7 @@ static void xpad_send_led_command(struct > usb_xpad *xpad, int command) */ > static void xpad_identify_controller(struct usb_xpad *xpad) > { > - xpad_send_led_command(xpad, (xpad->pad_nr % 4) + 2); > + led_set_brightness(&xpad->led->led_cdev, (xpad->pad_nr % 4) > + 2); } > > static void xpad_led_set(struct led_classdev *led_cdev, Hi Dimitri, My hardware: two wireless xpad 360 using a single usb receiver. Power on the first gamepad => light the "1" led. Power on the second gamepad => light the "2" led. Suspend the PC (systemctl suspend): the two gamepads are "disconnected" => blinking circle. Resume the PC, the two gamepads keep blinking but are working (tested with jstest). Power off and on the gamepad => still blinking. Reload (rmmod/modprobe) the xpad module => still blinking. That said, without your patch, the behavior is exactly the same. It seems that the suspend/resume broke the led feature. Even using the /sys/class/leds/xpad0/brigthness sysfs entry does not work. Best regards, Clement -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/