All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Pavel Rojtberg <rojtberg@gmail.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com,
	lawl <github@dumbinter.net>
Subject: Re: [PATCH 3/3] Input: xpad - Poweroff XBOX360W on mode button long press
Date: Mon, 18 Apr 2022 08:18:15 +0200	[thread overview]
Message-ID: <Yl0Cp2H6CRIsFsKT@kroah.com> (raw)
In-Reply-To: <20220417161526.138019-4-rojtberg@gmail.com>

On Sun, Apr 17, 2022 at 06:15:26PM +0200, Pavel Rojtberg wrote:
> From: Pavel Rojtberg <rojtberg@gmail.com>

Wait, who wrote this, "lawl" or you?


> Newer gamepads turn themselves off when the mode button is held down.
> For XBOX360W gamepads we must do this this in the driver.
> 
> Signed-off-by: lawl <github@dumbinter.net>

We need a real name here please.

> Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com>
> ---
>  drivers/input/joystick/xpad.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index 7640cbb..a9894a6 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
> @@ -620,11 +620,13 @@ struct usb_xpad {
>  	int pad_nr;			/* the order x360 pads were attached */
>  	const char *name;		/* name of the device */
>  	struct work_struct work;	/* init/remove device from callback */
> +	time64_t mode_btn_down_ts;
>  };
>  
>  static int xpad_init_input(struct usb_xpad *xpad);
>  static void xpad_deinit_input(struct usb_xpad *xpad);
>  static void xpadone_ack_mode_report(struct usb_xpad *xpad, u8 seq_num);
> +static void xpad360w_poweroff_controller(struct usb_xpad *xpad);
>  
>  /*
>   *	xpad_process_packet
> @@ -776,6 +778,23 @@ static void xpad360_process_packet(struct usb_xpad *xpad, struct input_dev *dev,
>  	}
>  
>  	input_sync(dev);
> +
> +	/* XBOX360W controllers can't be turned off without driver assistance */
> +	if (xpad->xtype == XTYPE_XBOX360W) {
> +		if (xpad->mode_btn_down_ts > 0
> +		&& xpad->pad_present
> +		&& (ktime_get_seconds() - xpad->mode_btn_down_ts) >= 5) {

Did you run this through checkpatch?  Please indent properly and put the
"&&" on the end of the lines.

And what does "5" mean here?

> +			xpad360w_poweroff_controller(xpad);
> +			xpad->mode_btn_down_ts = 0;
> +			return;
> +		}
> +
> +		/* mode button down/up */
> +		if (data[3] & 0x04)

BIT(2)?

thanks,

greg k-h

  reply	other threads:[~2022-04-18  6:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-17 16:15 [PATCH 0/3] Input: xpad - sync with github fork Pavel Rojtberg
2022-04-17 16:15 ` [PATCH 1/3] Input: xpad - add supported devices as contributed on github Pavel Rojtberg
2022-04-18  6:16   ` Greg KH
2022-04-17 16:15 ` [PATCH 2/3] Input: xpad - fix wireless 360 controller breaking after suspend Pavel Rojtberg
2022-04-17 16:15 ` [PATCH 3/3] Input: xpad - Poweroff XBOX360W on mode button long press Pavel Rojtberg
2022-04-18  6:18   ` Greg KH [this message]
2022-04-18  6:45     ` Santosh De Massari
2022-04-18  6:58       ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yl0Cp2H6CRIsFsKT@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=github@dumbinter.net \
    --cc=linux-input@vger.kernel.org \
    --cc=rojtberg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.