Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev VIDIOC_QUERYCAP changes:
details: https://anonhg.NetBSD.org/src/rev/41efabc187ee
branches: trunk
changeset: 760037:41efabc187ee
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Fri Dec 24 20:54:28 2010 +0000
description:
VIDIOC_QUERYCAP changes:
- use driver name instead of device instance name in 'driver' field
- add 'get_businfo' callback to fill in 'bus_info' field instead of
hard-coding "USB"
- use the kernel version for the 'version' field instead of 1
- adapt pseye and uvideo drivers to changes in struct video_hw_if
diffstat:
sys/dev/usb/pseye.c | 19 +++++++++++++++++--
sys/dev/usb/uvideo.c | 19 +++++++++++++++++--
sys/dev/video.c | 16 ++++++++++------
sys/dev/video_if.h | 3 ++-
4 files changed, 46 insertions(+), 11 deletions(-)
diffs (220 lines):
diff -r 533937619bb4 -r 41efabc187ee sys/dev/usb/pseye.c
--- a/sys/dev/usb/pseye.c Fri Dec 24 20:49:55 2010 +0000
+++ b/sys/dev/usb/pseye.c Fri Dec 24 20:54:28 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pseye.c,v 1.18 2010/11/13 13:52:12 uebayasi Exp $ */
+/* $NetBSD: pseye.c,v 1.19 2010/12/24 20:54:28 jmcneill Exp $ */
/*-
* Copyright (c) 2008 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pseye.c,v 1.18 2010/11/13 13:52:12 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pseye.c,v 1.19 2010/12/24 20:54:28 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -54,6 +54,7 @@
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
+#include <dev/usb/usbdivar.h>
#include <dev/usb/usbdi_util.h>
#include <dev/usb/usbdevs.h>
#include <dev/usb/uvideoreg.h>
@@ -97,6 +98,8 @@
int sc_bulkin_bufferlen;
char sc_dying;
+
+ char sc_businfo[32];
};
static int pseye_match(device_t, cfdata_t, void *);
@@ -126,6 +129,7 @@
static int pseye_open(void *, int);
static void pseye_close(void *);
static const char * pseye_get_devname(void *);
+static const char * pseye_get_businfo(void *);
static int pseye_enum_format(void *, uint32_t,
struct video_format *);
static int pseye_get_format(void *, struct video_format *);
@@ -142,6 +146,7 @@
.open = pseye_open,
.close = pseye_close,
.get_devname = pseye_get_devname,
+ .get_businfo = pseye_get_businfo,
.enum_format = pseye_enum_format,
.get_format = pseye_get_format,
.set_format = pseye_set_format,
@@ -196,6 +201,8 @@
sc->sc_dev = self;
sc->sc_udev = dev;
sc->sc_iface = uaa->iface;
+ snprintf(sc->sc_businfo, sizeof(sc->sc_businfo), "usb:%08x",
+ sc->sc_udev->cookie.cookie);
sc->sc_bulkin_bufferlen = PSEYE_BULKIN_BUFLEN;
sc->sc_dying = sc->sc_running = 0;
@@ -741,6 +748,14 @@
return "PlayStation Eye";
}
+static const char *
+pseye_get_businfo(void *opaque)
+{
+ struct pseye_softc *sc = opaque;
+
+ return sc->sc_businfo;
+}
+
static int
pseye_enum_format(void *opaque, uint32_t index, struct video_format *format)
{
diff -r 533937619bb4 -r 41efabc187ee sys/dev/usb/uvideo.c
--- a/sys/dev/usb/uvideo.c Fri Dec 24 20:49:55 2010 +0000
+++ b/sys/dev/usb/uvideo.c Fri Dec 24 20:54:28 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvideo.c,v 1.32 2010/11/03 22:34:24 dyoung Exp $ */
+/* $NetBSD: uvideo.c,v 1.33 2010/12/24 20:54:28 jmcneill Exp $ */
/*
* Copyright (c) 2008 Patrick Mahoney
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.32 2010/11/03 22:34:24 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.33 2010/12/24 20:54:28 jmcneill Exp $");
#ifdef _MODULE
#include <sys/module.h>
@@ -64,12 +64,14 @@
#include <sys/poll.h>
#include <sys/queue.h> /* SLIST */
#include <sys/kthread.h>
+#include <sys/bus.h>
#include <sys/videoio.h>
#include <dev/video_if.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
+#include <dev/usb/usbdivar.h>
#include <dev/usb/usbdi_util.h>
#include <dev/usb/usb_quirks.h>
@@ -255,6 +257,8 @@
struct uvideo_stream *sc_stream_in;
struct uvideo_stream_list sc_stream_list;
+
+ char sc_businfo[32];
};
int uvideo_match(device_t, cfdata_t, void *);
@@ -266,6 +270,7 @@
static int uvideo_open(void *, int);
static void uvideo_close(void *);
static const char * uvideo_get_devname(void *);
+static const char * uvideo_get_businfo(void *);
static int uvideo_enum_format(void *, uint32_t, struct video_format *);
static int uvideo_get_format(void *, struct video_format *);
@@ -377,6 +382,7 @@
.open = uvideo_open,
.close = uvideo_close,
.get_devname = uvideo_get_devname,
+ .get_businfo = uvideo_get_businfo,
.enum_format = uvideo_enum_format,
.get_format = uvideo_get_format,
.set_format = uvideo_set_format,
@@ -501,6 +507,8 @@
sc->sc_dying = 0;
sc->sc_state = UVIDEO_STATE_CLOSED;
SLIST_INIT(&sc->sc_stream_list);
+ snprintf(sc->sc_businfo, sizeof(sc->sc_businfo), "usb:%08x",
+ sc->sc_udev->cookie.cookie);
#ifdef UVIDEO_DEBUG
/* Debugging dump of descriptors. TODO: move this to userspace
@@ -1913,6 +1921,13 @@
return sc->sc_devname;
}
+static const char *
+uvideo_get_businfo(void *addr)
+{
+ struct uvideo_softc *sc = addr;
+ return sc->sc_businfo;
+}
+
static int
uvideo_enum_format(void *addr, uint32_t index, struct video_format *format)
{
diff -r 533937619bb4 -r 41efabc187ee sys/dev/video.c
--- a/sys/dev/video.c Fri Dec 24 20:49:55 2010 +0000
+++ b/sys/dev/video.c Fri Dec 24 20:54:28 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: video.c,v 1.24 2010/12/14 03:25:16 jmcneill Exp $ */
+/* $NetBSD: video.c,v 1.25 2010/12/24 20:54:28 jmcneill Exp $ */
/*
* Copyright (c) 2008 Patrick Mahoney <pat%polycrystal.org@localhost>
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: video.c,v 1.24 2010/12/14 03:25:16 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: video.c,v 1.25 2010/12/24 20:54:28 jmcneill Exp $");
#include "video.h"
#if NVIDEO > 0
@@ -71,7 +71,10 @@
#define PAGE_ALIGN(a) (((a) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
-#define VIDEO_DRIVER_VERSION 1
+#define VIDEO_DRIVER_VERSION \
+ (((__NetBSD_Version__ / 100000000) << 16) | \
+ ((__NetBSD_Version__ / 1000000 % 100) << 8) | \
+ (__NetBSD_Version__ / 100 % 100))
/* TODO: move to sys/intr.h */
#define IPL_VIDEO IPL_VM
@@ -1844,12 +1847,13 @@
case VIDIOC_QUERYCAP:
cap = data;
memset(cap, 0, sizeof(*cap));
- strlcpy(cap->driver, device_xname(sc->hw_dev),
+ strlcpy(cap->driver,
+ device_cfdriver(sc->hw_dev)->cd_name,
sizeof(cap->driver));
strlcpy(cap->card, hw->get_devname(sc->hw_softc),
sizeof(cap->card));
- /* FIXME: bus_info is wrongly hardcoded to USB */
- strlcpy(cap->bus_info, "USB", sizeof(cap->bus_info));
+ strlcpy(cap->bus_info, hw->get_businfo(sc->hw_softc),
+ sizeof(cap->bus_info));
cap->version = VIDEO_DRIVER_VERSION;
cap->capabilities = 0;
if (hw->start_transfer != NULL && hw->stop_transfer != NULL)
diff -r 533937619bb4 -r 41efabc187ee sys/dev/video_if.h
--- a/sys/dev/video_if.h Fri Dec 24 20:49:55 2010 +0000
+++ b/sys/dev/video_if.h Fri Dec 24 20:54:28 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: video_if.h,v 1.6 2010/12/14 03:25:16 jmcneill Exp $ */
+/* $NetBSD: video_if.h,v 1.7 2010/12/24 20:54:28 jmcneill Exp $ */
/*
* Copyright (c) 2008 Patrick Mahoney <pat%polycrystal.org@localhost>
@@ -454,6 +454,7 @@
void (*close)(void *); /* close hardware */
const char * (*get_devname)(void *);
+ const char * (*get_businfo)(void *);
int (*enum_format)(void *, uint32_t, struct video_format *);
int (*get_format)(void *, struct video_format *);
Home |
Main Index |
Thread Index |
Old Index