mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Denis Benato <denis.benato@linux.dev>
To: "Derek J. Clark" <derekjohn.clark@gmail.com>,
	Jiri Kosina <jikos@kernel.org>
Cc: 'Benjamin Tissoires' <bentiss@kernel.org>,
	'Dmitry Torokhov' <dmitry.torokhov@gmail.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] Input: xpad - introduce a static table to ignore devices
Date: Sat, 12 Sep 2026 02:56:00 +0200	[thread overview]
Message-ID: <7c3370ca-d03c-4b99-b653-fd91592ca672@linux.dev> (raw)
In-Reply-To: <F4BC32F9-792B-48C3-A1EF-65BC4E2534C5@gmail.com>


On 9/11/26 17:39, Derek J. Clark wrote:
> On September 11, 2026 8:12:02 AM PDT, Denis Benato <denis.benato@linux.dev> wrote:
>> On 9/11/26 16:11, Jiri Kosina wrote:
>>> On Tue, 11 Aug 2026, Denis Benato wrote:
>>>
>>>> Certain devices can work both as HID and as an xpad device: binding both
>>>> would duplicate inputs causing userspace to receive double inputs; at the
>>>> same time if a HID device is available it is to be preferred as it can
>>>> support additional features such as integrated IMU and additional buttons
>>>> and more, depending on the specific driver, therefore allow only the
>>>> best driver available to bind the device.
>>>>
>>>> Suggested-by: Derek J. Clark <derekjohn.clark@gmail.com>
>>>> Signed-off-by: Denis Benato <denis.benato@linux.dev>
>>> I'd like to have Dmitry's Ack on this one before taking the Flydigi 
>>> support through the HID tree.
>> Hi Jiri,
>>
>> Sure thing! While we wait I will get a v4 going that is reported working better
>> and having battery reporting too by Adolfo.
>>
>> This new table will be used by Derek too for some trustmaster (I think) he's
>> working on that is in the same situation.
>>
> Hi Denis,
>
> I'm waiting for Vicky's GIP driver to land before I do that because I'll need to add a similar table to that driver and I want to avoid getting in their way.
Well that means I am trying to set up something better than some code: a pattern on how to handle these cases :D
> Cheers,
> Derek
>
>> Best regards,
>> Denis Benato 
>>> Thanks.
>>>
>>>> ---
>>>>  drivers/input/joystick/xpad.c | 24 ++++++++++++++++++++++++
>>>>  1 file changed, 24 insertions(+)
>>>>
>>>> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
>>>> index feb8f368f834..545119a4fb36 100644
>>>> --- a/drivers/input/joystick/xpad.c
>>>> +++ b/drivers/input/joystick/xpad.c
>>>> @@ -406,6 +406,18 @@ static const struct xpad_device {
>>>>  	{ 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN }
>>>>  };
>>>>  
>>>> +#define XPAD_SUBSTITUTE(_vid, _pid, _enabled) \
>>>> +	{ .vid = (_vid), .pid = (_pid), .enabled = (_enabled) }
>>>> +
>>>> +static const struct xpad_excluded_device {
>>>> +	u16 vid;
>>>> +	u16 pid;
>>>> +	bool enabled;
>>>> +} xpad_excluded_devices[] = {
>>>> +	XPAD_SUBSTITUTE(0x37d7, 0x2401, IS_ENABLED(CONFIG_HID_FLYDIGI)),
>>>> +	{ }
>>>> +};
>>>> +
>>>>  /* buttons shared with xbox and xbox360 */
>>>>  static const signed short xpad_common_btn[] = {
>>>>  	BTN_A, BTN_B, BTN_X, BTN_Y,			/* "analog" buttons */
>>>> @@ -2044,11 +2056,23 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
>>>>  	struct usb_device *udev = interface_to_usbdev(intf);
>>>>  	struct usb_xpad *xpad;
>>>>  	struct usb_endpoint_descriptor *ep_irq_in, *ep_irq_out;
>>>> +	const struct xpad_excluded_device *excluded;
>>>>  	int i, error;
>>>>  
>>>>  	if (intf->cur_altsetting->desc.bNumEndpoints != 2)
>>>>  		return -ENODEV;
>>>>  
>>>> +	for (excluded = xpad_excluded_devices;
>>>> +	     excluded->vid || excluded->pid;
>>>> +	     excluded++) {
>>>> +		if (!excluded->enabled)
>>>> +			continue;
>>>> +
>>>> +		if (le16_to_cpu(udev->descriptor.idVendor) == excluded->vid &&
>>>> +		    le16_to_cpu(udev->descriptor.idProduct) == excluded->pid)
>>>> +			return -ENODEV;
>>>> +	}
>>>> +
>>>>  	for (i = 0; xpad_device[i].idVendor; i++) {
>>>>  		if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) &&
>>>>  		    (le16_to_cpu(udev->descriptor.idProduct) == xpad_device[i].idProduct))
>>>> -- 
>>>> 2.47.3
>>>>

      reply	other threads:[~2026-09-12  0:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11 12:58 [PATCH v3 0/2] HID: flydigi: add support for vader 5 pro Denis Benato
2026-08-11 12:58 ` [PATCH v3 1/2] " Denis Benato
2026-08-11 12:58 ` [PATCH v3 2/2] Input: xpad - introduce a static table to ignore devices Denis Benato
2026-09-11 14:11   ` Jiri Kosina
2026-09-11 15:12     ` Denis Benato
2026-09-11 15:39       ` Derek J. Clark
2026-09-12  0:56         ` Denis Benato [this message]

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=7c3370ca-d03c-4b99-b653-fd91592ca672@linux.dev \
    --to=denis.benato@linux.dev \
    --cc=bentiss@kernel.org \
    --cc=derekjohn.clark@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®