This diff shouldn't impact any other uvideo(4) devices so I would welcome somebody brave to OK this :-)
Thanks, Marcus On Fri, 26 Mar 2021 10:15:58 +0100 Martijn van Duren <openbsd+t...@list.imperialat.at> wrote: > I'm in no way qualified to OK this, but I'd like to see this get in, > because it does help me out :-) > > martijn@ > > On Mon, 2021-03-15 at 08:35 +0100, Marcus Glocker wrote: > > martijn@ has recently reported that in his machine he has two cams > > of which one is doing IR, which isn't really supported by uvideo(4). > > This IR device attaches always first as uvideo0, so he needs to swap > > that regularly with his working cam which by default attaches to > > uvideo1. > > > > I came up with a new quirk flag to *not* attach certain devices. > > Tested successfully by martijn@, the IR cam attaches to ugen0 and > > the supported cam to uvideo0. > > > > This patch shouldn't affect any supported uvideo(4) devices. > > > > OK? > > > > > > Index: sys/dev/usb/uvideo.c > > =================================================================== > > RCS file: /cvs/src/sys/dev/usb/uvideo.c,v > > retrieving revision 1.211 > > diff -u -p -u -p -r1.211 uvideo.c > > --- sys/dev/usb/uvideo.c 27 Jan 2021 17:28:19 -0000 > > 1.211 +++ sys/dev/usb/uvideo.c 8 Mar 2021 22:06:51 -0000 > > @@ -307,6 +307,7 @@ struct video_hw_if uvideo_hw_if = { > > #define UVIDEO_FLAG_ISIGHT_STREAM_HEADER 0x1 > > #define UVIDEO_FLAG_REATTACH 0x2 > > #define UVIDEO_FLAG_VENDOR_CLASS 0x4 > > +#define UVIDEO_FLAG_NOATTACH 0x8 > > struct uvideo_devs { > > struct usb_devno uv_dev; > > char *ucode_name; > > @@ -382,6 +383,12 @@ struct uvideo_devs { > > NULL, > > UVIDEO_FLAG_VENDOR_CLASS > > }, > > + { /* Infrared camera not supported */ > > + { USB_VENDOR_CHICONY, USB_PRODUCT_CHICONY_IRCAMERA }, > > + NULL, > > + NULL, > > + UVIDEO_FLAG_NOATTACH > > + }, > > }; > > #define uvideo_lookup(v, p) \ > > ((struct uvideo_devs *)usb_lookup(uvideo_devs, v, p)) > > @@ -480,13 +487,12 @@ uvideo_match(struct device *parent, void > > if (id == NULL) > > return (UMATCH_NONE); > > > > - if (id->bInterfaceClass == UICLASS_VIDEO && > > - id->bInterfaceSubClass == UISUBCLASS_VIDEOCONTROL) > > - return (UMATCH_VENDOR_PRODUCT_CONF_IFACE); > > - > > - /* quirk devices which we want to attach */ > > + /* quirk devices */ > > quirk = uvideo_lookup(uaa->vendor, uaa->product); > > if (quirk != NULL) { > > + if (quirk->flags & UVIDEO_FLAG_NOATTACH) > > + return (UMATCH_NONE); > > + > > if (quirk->flags & UVIDEO_FLAG_REATTACH) > > return (UMATCH_VENDOR_PRODUCT_CONF_IFACE); > > > > @@ -495,6 +501,10 @@ uvideo_match(struct device *parent, void > > id->bInterfaceSubClass == > > UISUBCLASS_VIDEOCONTROL) return (UMATCH_VENDOR_PRODUCT_CONF_IFACE); > > } > > + > > + if (id->bInterfaceClass == UICLASS_VIDEO && > > + id->bInterfaceSubClass == UISUBCLASS_VIDEOCONTROL) > > + return (UMATCH_VENDOR_PRODUCT_CONF_IFACE); > > > > return (UMATCH_NONE); > > } > > Index: sys/dev/usb/usbdevs > > =================================================================== > > RCS file: /cvs/src/sys/dev/usb/usbdevs,v > > retrieving revision 1.731 > > diff -u -p -u -p -r1.731 usbdevs > > --- sys/dev/usb/usbdevs 27 Feb 2021 03:03:40 -0000 1.731 > > +++ sys/dev/usb/usbdevs 8 Mar 2021 22:06:53 -0000 > > @@ -1336,6 +1336,7 @@ product CHICONY RTL8188CUS_3 0xaff9 RTL8 > > product CHICONY RTL8188CUS_4 0xaffa RTL8188CUS > > product CHICONY RTL8188CUS_5 0xaffb RTL8188CUS > > product CHICONY RTL8188CUS_6 0xaffc RTL8188CUS > > +product CHICONY IRCAMERA 0xb615 Integrated IR Camera > > > > /* CH Products */ > > product CHPRODUCTS PROTHROTTLE 0x00f1 Pro Throttle > > > >