summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorRobert Nagy <robert@cvs.openbsd.org>2008-06-11 01:27:32 +0000
committerRobert Nagy <robert@cvs.openbsd.org>2008-06-11 01:27:32 +0000
commit1a1b43b3dabac74b320940db3c70e89e7fa26348 (patch)
treea29077c6401c27711a82b47baf95041f1abe1cf1 /sys/dev
parenta17ec7c9237ff9a039a134c5ec4ddd6f5121c122 (diff)
implement the VIDIOC_STREAMOFF ioctl and remove some unused code
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/uvideo.c21
-rw-r--r--sys/dev/video.c7
-rw-r--r--sys/dev/video_if.h3
3 files changed, 23 insertions, 8 deletions
diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c
index c81ea82150e..b9ed047b9ae 100644
--- a/sys/dev/usb/uvideo.c
+++ b/sys/dev/usb/uvideo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvideo.c,v 1.32 2008/06/11 00:00:37 robert Exp $ */
+/* $OpenBSD: uvideo.c,v 1.33 2008/06/11 01:27:31 robert Exp $ */
/*
* Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
@@ -145,6 +145,7 @@ int uvideo_querybuf(void *, struct v4l2_buffer *);
int uvideo_qbuf(void *, struct v4l2_buffer *);
int uvideo_dqbuf(void *, struct v4l2_buffer *);
int uvideo_streamon(void *, int);
+int uvideo_streamoff(void *, int);
int uvideo_try_fmt(void *, struct v4l2_format *);
/*
@@ -188,6 +189,7 @@ struct video_hw_if uvideo_hw_if = {
uvideo_qbuf, /* VIDIOC_QBUF */
uvideo_dqbuf, /* VIDIOC_DQBUF */
uvideo_streamon, /* VIDIOC_STREAMON */
+ uvideo_streamoff, /* VIDIOC_STREAMOFF */
uvideo_try_fmt, /* VIDIOC_TRY_FMT */
NULL, /* VIDIOC_QUERYCTRL */
uvideo_mappage, /* mmap */
@@ -806,12 +808,10 @@ uvideo_vs_negotation(struct uvideo_softc *sc)
/* set probe */
bzero(probe_data, sizeof(probe_data));
pc = (struct usb_video_probe_commit *)probe_data;
-#if 0
- pc->bFormatIndex = 1;
- pc->bFrameIndex = 1;
-#endif
+
pc->bFormatIndex = sc->sc_desc_format_mjpeg->bFormatIndex;
pc->bFrameIndex = sc->sc_desc_format_mjpeg->bDefaultFrameIndex;
+
error = uvideo_vs_set_probe(sc, probe_data);
if (error != USBD_NORMAL_COMPLETION)
return (error);
@@ -1239,7 +1239,6 @@ uvideo_vs_decode_stream_header(struct uvideo_softc *sc, uint8_t *frame,
fb->fragment = 0;
fb->fid = 0;
- //fb->offset = 0;
}
return (0);
@@ -1945,6 +1944,16 @@ uvideo_streamon(void *v, int type)
}
int
+uvideo_streamoff(void *v, int type)
+{
+ struct uvideo_softc *sc = v;
+
+ uvideo_vs_close(sc);
+
+ return (0);
+}
+
+int
uvideo_try_fmt(void *v, struct v4l2_format *fmt)
{
if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
diff --git a/sys/dev/video.c b/sys/dev/video.c
index a6ec1a54b91..1888d963fbe 100644
--- a/sys/dev/video.c
+++ b/sys/dev/video.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: video.c,v 1.11 2008/06/10 23:39:01 robert Exp $ */
+/* $OpenBSD: video.c,v 1.12 2008/06/11 01:27:30 robert Exp $ */
/*
* Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
*
@@ -228,6 +228,11 @@ videoioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
error = (sc->hw_if->streamon)(sc->hw_hdl,
(int)*data);
break;
+ case VIDIOC_STREAMOFF:
+ if (sc->hw_if->streamoff)
+ error = (sc->hw_if->streamoff)(sc->hw_hdl,
+ (int)*data);
+ break;
case VIDIOC_TRY_FMT:
if (sc->hw_if->try_fmt)
error = (sc->hw_if->try_fmt)(sc->hw_hdl,
diff --git a/sys/dev/video_if.h b/sys/dev/video_if.h
index d096d8c3245..3b232a26d0e 100644
--- a/sys/dev/video_if.h
+++ b/sys/dev/video_if.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: video_if.h,v 1.11 2008/06/10 23:39:01 robert Exp $ */
+/* $OpenBSD: video_if.h,v 1.12 2008/06/11 01:27:30 robert Exp $ */
/*
* Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
*
@@ -44,6 +44,7 @@ struct video_hw_if {
int (*qbuf)(void *, struct v4l2_buffer *);
int (*dqbuf)(void *, struct v4l2_buffer *);
int (*streamon)(void *, int);
+ int (*streamoff)(void *, int);
int (*try_fmt)(void *, struct v4l2_format *);
int (*queryctrl)(void *, struct v4l2_queryctrl *);
caddr_t (*mappage)(void *, off_t, int);