Index | Thread | Search

From:
Marcus Glocker <marcus@nazgul.ch>
Subject:
Re: sys/uvideo: fill v4l2_capability the right way
To:
"Kirill A. Korinsky" <kirill@korins.ky>
Cc:
tech@openbsd.org
Date:
Sat, 28 Dec 2024 22:39:08 +0100

Download raw body.

Thread
  • Marcus Glocker:

    sys/uvideo: fill v4l2_capability the right way

  • On Sat, Dec 28, 2024 at 04:18:57PM GMT, Kirill A. Korinsky wrote:
    
    > tech@,
    > 
    > Some V4L consumers, for example libwebrtc which is used by firefox, uses
    > bus_info to find the desired webcam.
    > 
    > Our logic with hardcoded string leads that firefox uses /dev/video0, and
    > switch to another webcam simple doesn't work.
    > 
    > This behaviour of Linux uvc_meta_v4l2_querycap which uses constant as
    > driver name, and device as bus_info.
    > 
    > Ok?
    
    As discussed over the other mails, I'm OK with that after understanding
    the requirement.  I also did run the patch quickly against
    /usr/src/regress/sys/dev/video.
    
    ok mglocker@
     
    > Index: sys/dev/usb/uvideo.c
    > ===================================================================
    > RCS file: /home/cvs/src/sys/dev/usb/uvideo.c,v
    > diff -u -p -u -p -r1.231 uvideo.c
    > --- sys/dev/usb/uvideo.c	22 Dec 2024 20:30:04 -0000	1.231
    > +++ sys/dev/usb/uvideo.c	28 Dec 2024 15:08:42 -0000
    > @@ -2931,9 +2931,9 @@ uvideo_querycap(void *v, struct v4l2_cap
    >  	struct uvideo_softc *sc = v;
    > 
    >  	bzero(caps, sizeof(*caps));
    > -	strlcpy(caps->driver, DEVNAME(sc), sizeof(caps->driver));
    > +	strlcpy(caps->driver, "uvideo", sizeof(caps->driver));
    >  	strlcpy(caps->card, sc->sc_udev->product, sizeof(caps->card));
    > -	strlcpy(caps->bus_info, "usb", sizeof(caps->bus_info));
    > +	strlcpy(caps->bus_info, DEVNAME(sc), sizeof(caps->bus_info));
    > 
    >  	caps->version = 1;
    >  	caps->device_caps = V4L2_CAP_VIDEO_CAPTURE
    > 
    > 
    > --
    > wbr, Kirill
    > 
    
    
    
  • Marcus Glocker:

    sys/uvideo: fill v4l2_capability the right way