Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
Re: Support Jabra PanaCast 20 webcam
To:
Marcus Glocker <marcus@nazgul.ch>
Cc:
me@xha.li, tech@openbsd.org
Date:
Sat, 30 Nov 2024 15:38:03 +0100

Download raw body.

Thread
On Sat, 30 Nov 2024 14:58:25 +0100,
Marcus Glocker <marcus@nazgul.ch> wrote:
> 
> On Wed, Nov 27, 2024 at 08:12:51PM GMT, Kirill A. Korinsky wrote:
> 
> > This is a point that I'm thinking a lot. From one hand it makes perfect
> > sense to return error here, from another hand it may break some webcam which
> > doesn't support it, but may continue to work, or may not.
> 
> I was testing your diff with two cams.  One still did work, the other
> one did break.  Although the additional negotiate didn't return an
> error, the cam wasn't able to stream anymore:
> 
> 	video: ioctl VIDIOC_DQBUF: Invalid argument
> 
> Therefore, can you please add an quirk around the new re-negotiation
> code for your cam which requires this?
>

Thanks for testing! Here an updated diff which enables it for this webcam
only which reads as:

        addr 04: 0b0e:3021 GN Jabra A/S, Jabra PanaCast 20

Ok?

Index: sys/dev/usb/uvideo.c
===================================================================
RCS file: /home/cvs/src/sys/dev/usb/uvideo.c,v
diff -u -p -r1.223 uvideo.c
--- sys/dev/usb/uvideo.c	27 Nov 2024 11:37:23 -0000	1.223
+++ sys/dev/usb/uvideo.c	30 Nov 2024 14:21:29 -0000
@@ -298,6 +298,7 @@ const struct video_hw_if uvideo_hw_if = 
 #define UVIDEO_FLAG_REATTACH			0x2
 #define UVIDEO_FLAG_VENDOR_CLASS		0x4
 #define UVIDEO_FLAG_NOATTACH			0x8
+#define UVIDEO_FLAG_RENEGOTIATE_AFTER_SET_ALT	0x16
 const struct uvideo_devs {
 	struct usb_devno	 uv_dev;
 	char			*ucode_name;
@@ -379,6 +380,12 @@ const struct uvideo_devs {
 	    NULL,
 	    UVIDEO_FLAG_NOATTACH
 	},
+	{   /* Needs renegotiate after setting alternate interface */
+	    { USB_VENDOR_GN_NETCOM, USB_PRODUCT_GN_NETCOM_JABRA_PANACAST_20 },
+	    NULL,
+	    NULL,
+	    UVIDEO_FLAG_RENEGOTIATE_AFTER_SET_ALT
+	},
 };
 #define uvideo_lookup(v, p) \
 	((const struct uvideo_devs *)usb_lookup(uvideo_devs, v, p))
@@ -1897,6 +1904,17 @@ uvideo_vs_open(struct uvideo_softc *sc)
 		printf("%s: no endpoint descriptor for VS iface\n",
 		    DEVNAME(sc));
 		return (USBD_INVAL);
+	}
+
+	/* renegotiate with commit after setting alternate interface */
+	if (sc->sc_quirk &&
+	    sc->sc_quirk->flags & UVIDEO_FLAG_RENEGOTIATE_AFTER_SET_ALT) {
+		error = uvideo_vs_negotiation(sc, 1);
+		if (error != USBD_NORMAL_COMPLETION) {
+			printf("%s: could not renegotiate after setting "
+			    "alternate interface!\n", DEVNAME(sc));
+			return (error);
+		}
 	}
 
 	DPRINTF(1, "%s: open pipe for bEndpointAddress=0x%02x\n",
Index: sys/dev/usb/usbdevs
===================================================================
RCS file: /home/cvs/src/sys/dev/usb/usbdevs,v
diff -u -p -r1.771 usbdevs
--- sys/dev/usb/usbdevs	9 Nov 2024 08:37:44 -0000	1.771
+++ sys/dev/usb/usbdevs	30 Nov 2024 14:18:58 -0000
@@ -409,6 +409,7 @@ vendor NEODIO		0x0aec  Neodio
 vendor OPTION		0x0af0  Option
 vendor ASUS		0x0b05	ASUS
 vendor TODOS		0x0b0c	Todos Data System
+vendor GN_NETCOM	0x0b0e	GN Jabra A/S
 vendor GEARHEAD		0x0b38	Gear Head
 vendor OCT		0x0b39	Omnidirectional Control Technology
 vendor TEKRAM		0x0b3b	Tekram Technology
@@ -2203,6 +2204,9 @@ product	GMATE YP3X00		0x1001	YP3X00 PDA
 
 /* GN Otometrics products */
 product GNOTOMETRICS AURICAL	0x0010	Aurical
+
+/* GN Netcom products */
+product GN_NETCOM JABRA_PANACAST_20	0x3021	Jabra PanaCast 20
 
 /* GoHubs products */
 product GOHUBS GOCOM232		0x1001	GoCOM232 Serial converter
Index: sys/dev/usb/usbdevs.h
===================================================================
RCS file: /home/cvs/src/sys/dev/usb/usbdevs.h,v
diff -u -p -r1.783 usbdevs.h
--- sys/dev/usb/usbdevs.h	9 Nov 2024 08:38:05 -0000	1.783
+++ sys/dev/usb/usbdevs.h	30 Nov 2024 14:19:25 -0000
@@ -1,4 +1,4 @@
-/*	$OpenBSD: usbdevs.h,v 1.783 2024/11/09 08:38:05 miod Exp $	*/
+/*	$OpenBSD$	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -416,6 +416,7 @@
 #define	USB_VENDOR_OPTION	0x0af0		/* Option */
 #define	USB_VENDOR_ASUS	0x0b05		/* ASUS */
 #define	USB_VENDOR_TODOS	0x0b0c		/* Todos Data System */
+#define	USB_VENDOR_GN_NETCOM	0x0b0e		/* GN Jabra A/S */
 #define	USB_VENDOR_GEARHEAD	0x0b38		/* Gear Head */
 #define	USB_VENDOR_OCT	0x0b39		/* Omnidirectional Control Technology */
 #define	USB_VENDOR_TEKRAM	0x0b3b		/* Tekram Technology */
@@ -2210,6 +2211,9 @@
 
 /* GN Otometrics products */
 #define	USB_PRODUCT_GNOTOMETRICS_AURICAL	0x0010		/* Aurical */
+
+/* GN Netcom products */
+#define	USB_PRODUCT_GN_NETCOM_JABRA_PANACAST_20	0x3021		/* Jabra PanaCast 20 */
 
 /* GoHubs products */
 #define	USB_PRODUCT_GOHUBS_GOCOM232	0x1001		/* GoCOM232 Serial converter */
Index: sys/dev/usb/usbdevs_data.h
===================================================================
RCS file: /home/cvs/src/sys/dev/usb/usbdevs_data.h,v
diff -u -p -r1.777 usbdevs_data.h
--- sys/dev/usb/usbdevs_data.h	9 Nov 2024 08:38:05 -0000	1.777
+++ sys/dev/usb/usbdevs_data.h	30 Nov 2024 14:19:25 -0000
@@ -1,4 +1,4 @@
-/*	$OpenBSD: usbdevs_data.h,v 1.777 2024/11/09 08:38:05 miod Exp $	*/
+/*	$OpenBSD$	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -4618,6 +4618,10 @@ const struct usb_known_product usb_known
 	    "Aurical",
 	},
 	{
+	    USB_VENDOR_GN_NETCOM, USB_PRODUCT_GN_NETCOM_JABRA_PANACAST_20,
+	    "Jabra PanaCast 20",
+	},
+	{
 	    USB_VENDOR_GOHUBS, USB_PRODUCT_GOHUBS_GOCOM232,
 	    "GoCOM232 Serial converter",
 	},
@@ -13936,6 +13940,10 @@ const struct usb_known_vendor usb_known_
 	{
 	    USB_VENDOR_TODOS,
 	    "Todos Data System",
+	},
+	{
+	    USB_VENDOR_GN_NETCOM,
+	    "GN Jabra A/S",
 	},
 	{
 	    USB_VENDOR_GEARHEAD,


-- 
wbr, Kirill