From 5614b02143171a99e0e6eb6c7d1d2f8750d2957f Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 23 Aug 2007 17:48:41 -0300 Subject: V4L/DVB (6095): ivtv: fix VIDIOC_G_ENC_INDEX flag handling Due to a documentation bug (the type mask is 3 bits long, not 2) the wrong frame types were filled in: the B and P frame types were swapped. This bug also hid a second bug: when a capture is stopped a last entry is written into the pgm index buffer with internal type 0, denoting the end of the program. This entry wasn't ignored, instead it was accidentally returned to the caller as a P frame. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-fileops.c | 6 ++++-- drivers/media/video/ivtv/ivtv-ioctl.c | 17 ++++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'drivers') diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c index 5dd519caf81d..0285c4a830eb 100644 --- a/drivers/media/video/ivtv/ivtv-fileops.c +++ b/drivers/media/video/ivtv/ivtv-fileops.c @@ -190,7 +190,9 @@ static void ivtv_update_pgm_info(struct ivtv *itv) int idx = (itv->pgm_info_write_idx + i) % itv->pgm_info_num; struct v4l2_enc_idx_entry *e = itv->pgm_info + idx; u32 addr = itv->pgm_info_offset + 4 + idx * 24; - const int mapping[] = { V4L2_ENC_IDX_FRAME_P, V4L2_ENC_IDX_FRAME_I, V4L2_ENC_IDX_FRAME_B, 0 }; + const int mapping[8] = { -1, V4L2_ENC_IDX_FRAME_I, V4L2_ENC_IDX_FRAME_P, -1, + V4L2_ENC_IDX_FRAME_B, -1, -1, -1 }; + // 1=I, 2=P, 4=B e->offset = read_enc(addr + 4) + ((u64)read_enc(addr + 8) << 32); if (e->offset > itv->mpg_data_received) { @@ -199,7 +201,7 @@ static void ivtv_update_pgm_info(struct ivtv *itv) e->offset += itv->vbi_data_inserted; e->length = read_enc(addr); e->pts = read_enc(addr + 16) + ((u64)(read_enc(addr + 20) & 1) << 32); - e->flags = mapping[read_enc(addr + 12) & 3]; + e->flags = mapping[read_enc(addr + 12) & 7]; i++; } itv->pgm_info_write_idx = (itv->pgm_info_write_idx + i) % itv->pgm_info_num; diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 5977a79619c2..dfe0aedc60fd 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c @@ -1099,14 +1099,21 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void case VIDIOC_G_ENC_INDEX: { struct v4l2_enc_idx *idx = arg; + struct v4l2_enc_idx_entry *e = idx->entry; + int entries; int i; - idx->entries = (itv->pgm_info_write_idx + IVTV_MAX_PGM_INDEX - itv->pgm_info_read_idx) % + entries = (itv->pgm_info_write_idx + IVTV_MAX_PGM_INDEX - itv->pgm_info_read_idx) % IVTV_MAX_PGM_INDEX; - if (idx->entries > V4L2_ENC_IDX_ENTRIES) - idx->entries = V4L2_ENC_IDX_ENTRIES; - for (i = 0; i < idx->entries; i++) { - idx->entry[i] = itv->pgm_info[(itv->pgm_info_read_idx + i) % IVTV_MAX_PGM_INDEX]; + if (entries > V4L2_ENC_IDX_ENTRIES) + entries = V4L2_ENC_IDX_ENTRIES; + idx->entries = 0; + for (i = 0; i < entries; i++) { + *e = itv->pgm_info[(itv->pgm_info_read_idx + i) % IVTV_MAX_PGM_INDEX]; + if ((e->flags & V4L2_ENC_IDX_FRAME_MASK) <= V4L2_ENC_IDX_FRAME_B) { + idx->entries++; + e++; + } } itv->pgm_info_read_idx = (itv->pgm_info_read_idx + idx->entries) % IVTV_MAX_PGM_INDEX; break; -- cgit v1.2.3 From f5e4feead773cb449212eacfa254a238a953d4d5 Mon Sep 17 00:00:00 2001 From: Stas Sergeev Date: Sun, 2 Sep 2007 03:56:18 -0300 Subject: V4L/DVB (6144): Fix mux setup for composite sound on AverTV 307 Right now the composite sound input doesn't work on AverTV 307 because of the wrong mux setup. The composite sound is routed via an external 4channel multiplexer controlled by GPIO, while the code assumes an internal multiplexer instead. Presumably this was a copy/paste error, and noone have ever tested the functionality. With the attached patch it works properly, which gives me an ability to finally watch the cable TV under linux. Signed-off-by: Stas Sergeev Signed-off-by: Andrew Morton Acked-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7134/saa7134-cards.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 8ec83bd70094..25ec16810818 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -1537,18 +1537,18 @@ struct saa7134_board saa7134_boards[] = { },{ .name = name_comp1, .vmux = 0, - .amux = LINE2, - .gpio = 0x00, + .amux = LINE1, + .gpio = 0x02, },{ .name = name_comp2, .vmux = 3, - .amux = LINE2, - .gpio = 0x00, + .amux = LINE1, + .gpio = 0x02, },{ .name = name_svideo, .vmux = 8, - .amux = LINE2, - .gpio = 0x00, + .amux = LINE1, + .gpio = 0x02, }}, .radio = { .name = name_radio, -- cgit v1.2.3 From 7b9fbc3e30f785412a26819aa4daf0b6c27f6c53 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 3 Sep 2007 11:51:51 -0300 Subject: V4L/DVB (6147): Pwc: Fix a broken debug message Commit 85237f202d46d55c1bffe0c5b1aa3ddc0f1dce4d introduced the following warning (with CONFIG_USB_PWC_DEBUG=y): drivers/media/video/pwc/pwc-if.c: In function "pwc_video_close": drivers/media/video/pwc/pwc-if.c:1211: warning: "i" may be used uninitialized in this function This is true, and can cause a broken debug message to be logged. Here's a fix. Signed-off-by: Jean Delvare Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pwc/pwc-if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index 3d81966d8c42..931b274bffca 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -1243,7 +1243,7 @@ static int pwc_video_close(struct inode *inode, struct file *file) PWC_ERROR("Failed to power down camera (%d)\n", i); } pdev->vopen--; - PWC_DEBUG_OPEN("<< video_close() vopen=%d\n", i); + PWC_DEBUG_OPEN("<< video_close() vopen=%d\n", pdev->vopen); } else { pwc_cleanup(pdev); /* Free memory (don't set pdev to 0 just yet) */ -- cgit v1.2.3 From f5ab272bbff2a37d6d8f84328b6d25d0cdbda605 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 3 Sep 2007 12:01:51 -0300 Subject: V4L/DVB (6148): Fix a warning at saa7191_probe saa7191.c: In function 'saa7191_probe': saa7191.c:596: warning: passing argument 3 of 'saa7191_write_block' discards qualifiers from pointer target type Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7191.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/media/video/saa7191.c b/drivers/media/video/saa7191.c index 8615a6081a5d..b4018cce3285 100644 --- a/drivers/media/video/saa7191.c +++ b/drivers/media/video/saa7191.c @@ -130,7 +130,7 @@ static int saa7191_write_reg(struct i2c_client *client, u8 reg, /* the first byte of data must be the first subaddress number (register) */ static int saa7191_write_block(struct i2c_client *client, - u8 length, u8 *data) + u8 length, const u8 *data) { int i; int ret; @@ -592,7 +592,7 @@ static int saa7191_attach(struct i2c_adapter *adap, int addr, int kind) if (err) goto out_free_decoder; - err = saa7191_write_block(client, sizeof(initseq), (u8 *)initseq); + err = saa7191_write_block(client, sizeof(initseq), initseq); if (err) { printk(KERN_ERR "SAA7191 initialization failed\n"); goto out_detach_client; -- cgit v1.2.3 From 48200baeab95fd39a7f4c4f3536c7142a64ac335 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 6 Sep 2007 22:48:35 -0300 Subject: V4L/DVB (6188): Avoid a NULL pointer dereference during mpeg_open() Bug: With a hardware encoder board installed as cx88[1] and a non-encoder boards installed as cx88[0], an OOPS is generated during cx8802_get_device() called from mpeg_open(). Signed-off-by: Steven Toth Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-mpeg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index 317a2a3f9cc1..da7a6b591a67 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -580,7 +580,7 @@ struct cx8802_dev * cx8802_get_device(struct inode *inode) list_for_each(list,&cx8802_devlist) { h = list_entry(list, struct cx8802_dev, devlist); - if (h->mpeg_dev->minor == minor) + if (h->mpeg_dev && h->mpeg_dev->minor == minor) return h; } -- cgit v1.2.3