提交 7eaf4966 编写于 作者: H Hans Verkuil 提交者: Mauro Carvalho Chehab

[media] ivtv: fix v4l2-compliance errors for the radio device

- fix error code when attempting to read from write-only streams.
- fix error code when attempting to write to read-only streams.
- don't start capturing when polling on a radio node.
- give the radio node its own file operations struct.
Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 f659f0e7
...@@ -435,7 +435,7 @@ int ivtv_start_capture(struct ivtv_open_id *id) ...@@ -435,7 +435,7 @@ int ivtv_start_capture(struct ivtv_open_id *id)
s->type == IVTV_DEC_STREAM_TYPE_YUV || s->type == IVTV_DEC_STREAM_TYPE_YUV ||
s->type == IVTV_DEC_STREAM_TYPE_VOUT) { s->type == IVTV_DEC_STREAM_TYPE_VOUT) {
/* you cannot read from these stream types. */ /* you cannot read from these stream types. */
return -EPERM; return -EINVAL;
} }
/* Try to claim this stream. */ /* Try to claim this stream. */
...@@ -564,7 +564,7 @@ static ssize_t ivtv_write(struct file *filp, const char __user *user_buf, size_t ...@@ -564,7 +564,7 @@ static ssize_t ivtv_write(struct file *filp, const char __user *user_buf, size_t
s->type != IVTV_DEC_STREAM_TYPE_YUV && s->type != IVTV_DEC_STREAM_TYPE_YUV &&
s->type != IVTV_DEC_STREAM_TYPE_VOUT) s->type != IVTV_DEC_STREAM_TYPE_VOUT)
/* not decoder streams */ /* not decoder streams */
return -EPERM; return -EINVAL;
/* Try to claim this stream */ /* Try to claim this stream */
if (ivtv_claim_stream(id, s->type)) if (ivtv_claim_stream(id, s->type))
...@@ -775,6 +775,7 @@ unsigned int ivtv_v4l2_enc_poll(struct file *filp, poll_table *wait) ...@@ -775,6 +775,7 @@ unsigned int ivtv_v4l2_enc_poll(struct file *filp, poll_table *wait)
/* Start a capture if there is none */ /* Start a capture if there is none */
if (!eof && !test_bit(IVTV_F_S_STREAMING, &s->s_flags) && if (!eof && !test_bit(IVTV_F_S_STREAMING, &s->s_flags) &&
s->type != IVTV_ENC_STREAM_TYPE_RAD &&
(req_events & (POLLIN | POLLRDNORM))) { (req_events & (POLLIN | POLLRDNORM))) {
int rc; int rc;
......
...@@ -65,6 +65,14 @@ static const struct v4l2_file_operations ivtv_v4l2_dec_fops = { ...@@ -65,6 +65,14 @@ static const struct v4l2_file_operations ivtv_v4l2_dec_fops = {
.poll = ivtv_v4l2_dec_poll, .poll = ivtv_v4l2_dec_poll,
}; };
static const struct v4l2_file_operations ivtv_v4l2_radio_fops = {
.owner = THIS_MODULE,
.open = ivtv_v4l2_open,
.unlocked_ioctl = video_ioctl2,
.release = ivtv_v4l2_close,
.poll = ivtv_v4l2_enc_poll,
};
#define IVTV_V4L2_DEC_MPG_OFFSET 16 /* offset from 0 to register decoder mpg v4l2 minors on */ #define IVTV_V4L2_DEC_MPG_OFFSET 16 /* offset from 0 to register decoder mpg v4l2 minors on */
#define IVTV_V4L2_ENC_PCM_OFFSET 24 /* offset from 0 to register pcm v4l2 minors on */ #define IVTV_V4L2_ENC_PCM_OFFSET 24 /* offset from 0 to register pcm v4l2 minors on */
#define IVTV_V4L2_ENC_YUV_OFFSET 32 /* offset from 0 to register yuv v4l2 minors on */ #define IVTV_V4L2_ENC_YUV_OFFSET 32 /* offset from 0 to register yuv v4l2 minors on */
...@@ -116,7 +124,7 @@ static struct { ...@@ -116,7 +124,7 @@ static struct {
VFL_TYPE_RADIO, 0, VFL_TYPE_RADIO, 0,
PCI_DMA_NONE, 1, PCI_DMA_NONE, 1,
V4L2_CAP_RADIO | V4L2_CAP_TUNER, V4L2_CAP_RADIO | V4L2_CAP_TUNER,
&ivtv_v4l2_enc_fops &ivtv_v4l2_radio_fops
}, },
{ /* IVTV_DEC_STREAM_TYPE_MPG */ { /* IVTV_DEC_STREAM_TYPE_MPG */
"decoder MPG", "decoder MPG",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册