Skip to content

Commit

Permalink
Fill the 'card' member of v4l2_capability struct with the usb product
Browse files Browse the repository at this point in the history
name coming from usbd_devinfo_vp() instead of the dummy "Generic USB
video class device" string, makes it easier to differentiate multiple
webcams in firefox's webrtc permission dialog.

ok/help mpi@
  • Loading branch information
landryb committed Apr 24, 2018
1 parent e6f936a commit 954d25e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 1 addition & 3 deletions sys/dev/usb/usb_subr.c
@@ -1,4 +1,4 @@
/* $OpenBSD: usb_subr.c,v 1.134 2017/04/08 02:57:25 deraadt Exp $ */
/* $OpenBSD: usb_subr.c,v 1.135 2018/04/24 17:22:33 landry Exp $ */
/* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */

Expand Down Expand Up @@ -61,8 +61,6 @@ extern int usbdebug;

usbd_status usbd_set_config(struct usbd_device *, int);
void usbd_devinfo(struct usbd_device *, int, char *, size_t);
void usbd_devinfo_vp(struct usbd_device *, char *, size_t,
char *, size_t, int);
char *usbd_get_device_string(struct usbd_device *, uByte);
char *usbd_get_string(struct usbd_device *, int, char *, size_t);
int usbd_getnewaddr(struct usbd_bus *);
Expand Down
4 changes: 3 additions & 1 deletion sys/dev/usb/usbdivar.h
@@ -1,4 +1,4 @@
/* $OpenBSD: usbdivar.h,v 1.73 2018/02/03 13:37:37 mpi Exp $ */
/* $OpenBSD: usbdivar.h,v 1.74 2018/04/24 17:22:33 landry Exp $ */
/* $NetBSD: usbdivar.h,v 1.70 2002/07/11 21:14:36 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $ */

Expand Down Expand Up @@ -257,6 +257,8 @@ usbd_status usbd_fill_iface_data(struct usbd_device *, int, int);
usbd_status usb_insert_transfer(struct usbd_xfer *);
void usb_transfer_complete(struct usbd_xfer *);
int usbd_detach(struct usbd_device *, struct device *);
void usbd_devinfo_vp(struct usbd_device *, char *, size_t,
char *, size_t, int);

/* Routines from usb.c */
void usb_needs_explore(struct usbd_device *, int);
Expand Down
9 changes: 6 additions & 3 deletions sys/dev/usb/uvideo.c
@@ -1,4 +1,4 @@
/* $OpenBSD: uvideo.c,v 1.196 2017/12/30 23:08:29 guenther Exp $ */
/* $OpenBSD: uvideo.c,v 1.197 2018/04/24 17:22:33 landry Exp $ */

/*
* Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
Expand Down Expand Up @@ -2781,11 +2781,14 @@ int
uvideo_querycap(void *v, struct v4l2_capability *caps)
{
struct uvideo_softc *sc = v;
char vendor[USB_MAX_STRING_LEN];
char product[USB_MAX_STRING_LEN];

bzero(caps, sizeof(*caps));
strlcpy(caps->driver, DEVNAME(sc), sizeof(caps->driver));
strlcpy(caps->card, "Generic USB video class device",
sizeof(caps->card));
usbd_devinfo_vp(sc->sc_udev, vendor, sizeof (vendor), product,
sizeof (product), 0);
strlcpy(caps->card, product, sizeof(caps->card));
strlcpy(caps->bus_info, "usb", sizeof(caps->bus_info));

caps->version = 1;
Expand Down

0 comments on commit 954d25e

Please sign in to comment.