From 7a0415a8088e8a80a1d1d76d359e5c8f7ba49407 Mon Sep 17 00:00:00 2001 From: miod Date: Sun, 10 Dec 2023 19:03:37 +0000 Subject: [PATCH] The new cinematic to get sensor information as soon as possible sometimes runs too fast for the device and causes it to stutter its identification string. Check if the second string chunk matches the first one, and ignore it in this case, the correct data will come later. --- sys/dev/usb/ugold.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/ugold.c b/sys/dev/usb/ugold.c index 9d1a30b2da8..7f7dfad213c 100644 --- a/sys/dev/usb/ugold.c +++ b/sys/dev/usb/ugold.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ugold.c,v 1.25 2023/12/08 06:33:48 miod Exp $ */ +/* $OpenBSD: ugold.c,v 1.26 2023/12/10 19:03:37 miod Exp $ */ /* * Copyright (c) 2013 Takayoshi SASANO @@ -609,6 +609,18 @@ ugold_intr(struct uhidev *addr, void *ibuf, u_int len) break; default: if (!sc->sc_type) { + /* + * During initialization, some devices need a bit + * more time to submit their identification string. + */ + if (len == sc->sc_model_len && + !memcmp(sc->sc_model, buf, len)) { +#ifdef UGOLD_DEBUG + printf("%s: duplicate string component\n", + sc->sc_hdev.sc_dev.dv_xname); +#endif + break; + } /* * Exact sensor type is not known yet, type command * returns arbitrary string. -- 2.20.1