linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] HID: pidff: Compatibility update and new devices
@ 2025-02-08 17:36 Tomasz Pakuła
  2025-02-08 17:36 ` [PATCH 1/3] MAINTAINERS: Update hid-universal-pidff entry Tomasz Pakuła
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Tomasz Pakuła @ 2025-02-08 17:36 UTC (permalink / raw)
  To: jikos, bentiss; +Cc: anssi.hannula, oleg, linux-input, linux-usb

This is a small series based on top of hid.git#for-6.15/pidff.
Add Oleg Makarenko as hid-universal-pidff co-maintainer as he fixed
his email server and will be able to respond to LKML inquiries.

Small compatibility patch for situations, where POOL report haven't
been properly initiated and adding Asetek vendor and 4 of their
wheelbases.

Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>

---
Tomasz Pakuła (3):
  MAINTAINERS: Update hid-universal-pidff entry
  HID: pidff: Make sure to fetch pool before checking SIMULTANEOUS_MAX
  HID: hid-universal-pidff: Add Asetek wheelbases support

 MAINTAINERS                       |  3 ++-
 drivers/hid/hid-ids.h             |  6 ++++++
 drivers/hid/hid-universal-pidff.c |  4 ++++
 drivers/hid/usbhid/hid-pidff.c    | 34 +++++++++++++++----------------
 4 files changed, 28 insertions(+), 19 deletions(-)


base-commit: 5d98079b2d0186e1f586301a9c00144a669416a8
-- 
2.48.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] MAINTAINERS: Update hid-universal-pidff entry
  2025-02-08 17:36 [PATCH 0/3] HID: pidff: Compatibility update and new devices Tomasz Pakuła
@ 2025-02-08 17:36 ` Tomasz Pakuła
  2025-02-08 17:36 ` [PATCH 2/3] HID: pidff: Make sure to fetch pool before checking SIMULTANEOUS_MAX Tomasz Pakuła
  2025-02-08 17:36 ` [PATCH 3/3] HID: hid-universal-pidff: Add Asetek wheelbases support Tomasz Pakuła
  2 siblings, 0 replies; 6+ messages in thread
From: Tomasz Pakuła @ 2025-02-08 17:36 UTC (permalink / raw)
  To: jikos, bentiss; +Cc: anssi.hannula, oleg, linux-input, linux-usb

Add Makarenko Oleg as co-maintainer

Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
---
 MAINTAINERS | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index a7c37bb8f083..174d25d87371 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10258,9 +10258,10 @@ F:	include/linux/hid-sensor-*
 
 HID UNIVERSAL PIDFF DRIVER
 M:	Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
+M:	Makarenko Oleg <oleg.makarenk.ooo>
 L:	linux-input@vger.kernel.org
 S:	Maintained
-B:	https://github.com/Lawstorant/hid-universal-pidff/issues
+B:	https://github.com/JacKeTUs/universal-pidff/issues
 F:	drivers/hid/hid-universal-pidff.c
 
 HID VRC-2 CAR CONTROLLER DRIVER
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] HID: pidff: Make sure to fetch pool before checking SIMULTANEOUS_MAX
  2025-02-08 17:36 [PATCH 0/3] HID: pidff: Compatibility update and new devices Tomasz Pakuła
  2025-02-08 17:36 ` [PATCH 1/3] MAINTAINERS: Update hid-universal-pidff entry Tomasz Pakuła
@ 2025-02-08 17:36 ` Tomasz Pakuła
  2025-02-10  8:52   ` Jiri Kosina
  2025-02-08 17:36 ` [PATCH 3/3] HID: hid-universal-pidff: Add Asetek wheelbases support Tomasz Pakuła
  2 siblings, 1 reply; 6+ messages in thread
From: Tomasz Pakuła @ 2025-02-08 17:36 UTC (permalink / raw)
  To: jikos, bentiss; +Cc: anssi.hannula, oleg, linux-input, linux-usb

As noted by Anssi some 20 years ago, pool report is sometimes messed up.
This worked fine on many devices but casued oops on VRS DirectForce PRO.

Here, we're making sure pool report is refetched before trying to access
any of it's fields. While loop was replaced with a for loop + exit
conditions were moved aroud to decrease the possibility of creating an
infinite loop scenario.

Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
---
 drivers/hid/usbhid/hid-pidff.c | 34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c
index f23381b6e344..acdcc0af86ba 100644
--- a/drivers/hid/usbhid/hid-pidff.c
+++ b/drivers/hid/usbhid/hid-pidff.c
@@ -604,28 +604,26 @@ static void pidff_reset(struct pidff_device *pidff)
 }
 
 /*
- * Refetch pool report
+ * Fetch pool report
  */
 static void pidff_fetch_pool(struct pidff_device *pidff)
 {
-	if (!pidff->pool[PID_SIMULTANEOUS_MAX].value)
-		return;
-
-	int i = 0;
-	while (pidff->pool[PID_SIMULTANEOUS_MAX].value[0] < 2) {
-		hid_dbg(pidff->hid, "pid_pool requested again\n");
-		hid_hw_request(pidff->hid, pidff->reports[PID_POOL],
-				HID_REQ_GET_REPORT);
-		hid_hw_wait(pidff->hid);
-
-		/* break after 20 tries with SIMULTANEOUS_MAX < 2 */
-		if (i++ > 20) {
-			hid_warn(pidff->hid,
-				 "device reports %d simultaneous effects\n",
-				 pidff->pool[PID_SIMULTANEOUS_MAX].value[0]);
-			break;
-		}
+	int i;
+	struct hid_device *hid = pidff->hid;
+
+	/* Try 20 times if PID_SIMULTANEOUS_MAX < 2.
+	   We must make sure this isn't just an error */
+	for(i = 0; i < 20; i++) {
+		hid_hw_request(hid, pidff->reports[PID_POOL], HID_REQ_GET_REPORT);
+		hid_hw_wait(hid);
+
+		if (!pidff->pool[PID_SIMULTANEOUS_MAX].value)
+			return;
+		if (pidff->pool[PID_SIMULTANEOUS_MAX].value[0] >= 2)
+			return;
 	}
+	hid_warn(hid, "device reports %d simultaneous effects\n",
+		 pidff->pool[PID_SIMULTANEOUS_MAX].value[0]);
 }
 
 /*
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] HID: hid-universal-pidff: Add Asetek wheelbases support
  2025-02-08 17:36 [PATCH 0/3] HID: pidff: Compatibility update and new devices Tomasz Pakuła
  2025-02-08 17:36 ` [PATCH 1/3] MAINTAINERS: Update hid-universal-pidff entry Tomasz Pakuła
  2025-02-08 17:36 ` [PATCH 2/3] HID: pidff: Make sure to fetch pool before checking SIMULTANEOUS_MAX Tomasz Pakuła
@ 2025-02-08 17:36 ` Tomasz Pakuła
  2 siblings, 0 replies; 6+ messages in thread
From: Tomasz Pakuła @ 2025-02-08 17:36 UTC (permalink / raw)
  To: jikos, bentiss; +Cc: anssi.hannula, oleg, linux-input, linux-usb

Adds Asetek vendor id and product ids for:
- Invicta
- Forte
- La Prima
- Tony Kanaan

Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
---
 drivers/hid/hid-ids.h             | 6 ++++++
 drivers/hid/hid-universal-pidff.c | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index dbac05649e9d..860adabbc625 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -189,6 +189,12 @@
 #define USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT 0x8102
 #define USB_DEVICE_ID_APPLE_TOUCHBAR_DISPLAY 0x8302
 
+#define USB_VENDOR_ID_ASETEK			0x2433
+#define USB_DEVICE_ID_ASETEK_INVICTA		0xf300
+#define USB_DEVICE_ID_ASETEK_FORTE		0xf301
+#define USB_DEVICE_ID_ASETEK_LA_PRIMA		0xf303
+#define USB_DEVICE_ID_ASETEK_TONY_KANAAN	0xf306
+
 #define USB_VENDOR_ID_ASUS		0x0486
 #define USB_DEVICE_ID_ASUS_T91MT	0x0185
 #define USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO	0x0186
diff --git a/drivers/hid/hid-universal-pidff.c b/drivers/hid/hid-universal-pidff.c
index 1b713b741d19..32f1c26f4cf4 100644
--- a/drivers/hid/hid-universal-pidff.c
+++ b/drivers/hid/hid-universal-pidff.c
@@ -179,6 +179,10 @@ static const struct hid_device_id universal_pidff_devices[] = {
 		.driver_data = HID_PIDFF_QUIRK_PERIODIC_SINE_ONLY },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LITE_STAR, USB_DEVICE_LITE_STAR_GT987_FF),
 		.driver_data = HID_PIDFF_QUIRK_PERIODIC_SINE_ONLY },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_INVICTA) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_FORTE) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_LA_PRIMA) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_TONY_KANAAN) },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, universal_pidff_devices);
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] HID: pidff: Make sure to fetch pool before checking SIMULTANEOUS_MAX
  2025-02-08 17:36 ` [PATCH 2/3] HID: pidff: Make sure to fetch pool before checking SIMULTANEOUS_MAX Tomasz Pakuła
@ 2025-02-10  8:52   ` Jiri Kosina
  2025-02-10  9:57     ` Tomasz Pakuła
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Kosina @ 2025-02-10  8:52 UTC (permalink / raw)
  To: Tomasz Pakuła; +Cc: bentiss, anssi.hannula, oleg, linux-input, linux-usb

On Sat, 8 Feb 2025, Tomasz Pakuła wrote:

> As noted by Anssi some 20 years ago, pool report is sometimes messed up.
> This worked fine on many devices but casued oops on VRS DirectForce PRO.
> 
> Here, we're making sure pool report is refetched before trying to access
> any of it's fields. While loop was replaced with a for loop + exit
> conditions were moved aroud to decrease the possibility of creating an
> infinite loop scenario.
> 
> Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
> ---
>  drivers/hid/usbhid/hid-pidff.c | 34 ++++++++++++++++------------------
>  1 file changed, 16 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c
> index f23381b6e344..acdcc0af86ba 100644
> --- a/drivers/hid/usbhid/hid-pidff.c
> +++ b/drivers/hid/usbhid/hid-pidff.c
> @@ -604,28 +604,26 @@ static void pidff_reset(struct pidff_device *pidff)
>  }
>  
>  /*
> - * Refetch pool report
> + * Fetch pool report
>   */
>  static void pidff_fetch_pool(struct pidff_device *pidff)
>  {
> -	if (!pidff->pool[PID_SIMULTANEOUS_MAX].value)
> -		return;
> -
> -	int i = 0;
> -	while (pidff->pool[PID_SIMULTANEOUS_MAX].value[0] < 2) {
> -		hid_dbg(pidff->hid, "pid_pool requested again\n");
> -		hid_hw_request(pidff->hid, pidff->reports[PID_POOL],
> -				HID_REQ_GET_REPORT);
> -		hid_hw_wait(pidff->hid);
> -
> -		/* break after 20 tries with SIMULTANEOUS_MAX < 2 */
> -		if (i++ > 20) {
> -			hid_warn(pidff->hid,
> -				 "device reports %d simultaneous effects\n",
> -				 pidff->pool[PID_SIMULTANEOUS_MAX].value[0]);
> -			break;
> -		}
> +	int i;
> +	struct hid_device *hid = pidff->hid;
> +
> +	/* Try 20 times if PID_SIMULTANEOUS_MAX < 2.
> +	   We must make sure this isn't just an error */

Sorry for annoying nit: this is not really consistent with Kernel / HID 
comment style :)

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] HID: pidff: Make sure to fetch pool before checking SIMULTANEOUS_MAX
  2025-02-10  8:52   ` Jiri Kosina
@ 2025-02-10  9:57     ` Tomasz Pakuła
  0 siblings, 0 replies; 6+ messages in thread
From: Tomasz Pakuła @ 2025-02-10  9:57 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: bentiss, anssi.hannula, oleg, linux-input, linux-usb

On Mon, 10 Feb 2025 at 09:52, Jiri Kosina <jikos@kernel.org> wrote:
> On Sat, 8 Feb 2025, Tomasz Pakuła wrote:
> > +     /* Try 20 times if PID_SIMULTANEOUS_MAX < 2.
> > +        We must make sure this isn't just an error */
>
> Sorry for annoying nit: this is not really consistent with Kernel / HID
> comment style :)
>
> --
> Jiri Kosina
> SUSE Labs

No problem! I must say I did think this might seem janky as simple two-line
comment didn't feel right when it took up 4 lines, but on the other hand, this
looks just a bit out of place as well.

I'll send out an improved v2 today.

Thanks, Tomasz

P.S.
Thank you for merging this. I worried we'd have to wait for Anssi to leave
his comments/reviews as he told me recently he's quite busy and doesn't
have much time to go over all this PID work but he appreciates the CCs.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-02-10  9:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-08 17:36 [PATCH 0/3] HID: pidff: Compatibility update and new devices Tomasz Pakuła
2025-02-08 17:36 ` [PATCH 1/3] MAINTAINERS: Update hid-universal-pidff entry Tomasz Pakuła
2025-02-08 17:36 ` [PATCH 2/3] HID: pidff: Make sure to fetch pool before checking SIMULTANEOUS_MAX Tomasz Pakuła
2025-02-10  8:52   ` Jiri Kosina
2025-02-10  9:57     ` Tomasz Pakuła
2025-02-08 17:36 ` [PATCH 3/3] HID: hid-universal-pidff: Add Asetek wheelbases support Tomasz Pakuła

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).