summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c')
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c478
1 files changed, 117 insertions, 361 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index dd207fae4..f4284f927 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -30,17 +30,9 @@
#include "pvrusb2-debug.h"
#include "pvrusb2-v4l2.h"
#include "pvrusb2-ioread.h"
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
#include <media/v4l2-common.h>
-
-#define PVR_WIDTH_DVD 720
-#define PVR_WIDTH_SVCD 480
-#define PVR_WIDTH_VCD 352
-
-#define PVR_HEIGHT_PAL 480
-#define PVR_HEIGHT_NTSC 576
-
struct pvr2_v4l2_dev;
struct pvr2_v4l2_fh;
struct pvr2_v4l2;
@@ -80,22 +72,6 @@ static int video_nr[PVR_NUM] = {[0 ... PVR_NUM-1] = -1};
module_param_array(video_nr, int, NULL, 0444);
MODULE_PARM_DESC(video_nr, "Offset for device's minor");
-#define V4L2_CID_PVR_SRATE (V4L2_CID_PRIVATE_BASE)
-#define V4L2_CID_PVR_AUDIOBITRATE (V4L2_CID_PRIVATE_BASE+1)
-#define V4L2_CID_PVR_AUDIOCRC (V4L2_CID_PRIVATE_BASE+2)
-#define V4L2_CID_PVR_AUDIOEMPHASIS (V4L2_CID_PRIVATE_BASE+3)
-#define V4L2_CID_PVR_VBR (V4L2_CID_PRIVATE_BASE+4)
-#define V4L2_CID_PVR_VIDEOBITRATE (V4L2_CID_PRIVATE_BASE+5)
-#define V4L2_CID_PVR_VIDEOPEAK (V4L2_CID_PRIVATE_BASE+6)
-#define V4L2_CID_PVR_VIDEOSTANDARD (V4L2_CID_PRIVATE_BASE+7)
-#define V4L2_CID_PVR_INPUT (V4L2_CID_PRIVATE_BASE+8)
-#define V4L2_CID_PVR_AUDIOMODE (V4L2_CID_PRIVATE_BASE+9)
-#define V4L2_CID_PVR_FREQUENCY (V4L2_CID_PRIVATE_BASE+10)
-#define V4L2_CID_PVR_HRES (V4L2_CID_PRIVATE_BASE+11)
-#define V4L2_CID_PVR_VRES (V4L2_CID_PRIVATE_BASE+12)
-
-#define V4L2_CID_PVR_MAX (V4L2_CID_PRIVATE_BASE+12)
-
struct v4l2_capability pvr_capability ={
.driver = "pvrusb2",
.card = "Hauppauge WinTV pvr-usb2",
@@ -141,69 +117,6 @@ static struct v4l2_tuner pvr_v4l2_tuners[]= {
#endif
};
-struct v4l2_standard pvr_standards[] = {
- [PVR2_CVAL_VIDEOSTANDARD_PAL_BG] = {
- .id = V4L2_STD_PAL_BG,
- .frameperiod =
- {
- .numerator = 1,
- .denominator= 25
- },
- .framelines = 625,
- .reserved = {0,0,0,0}
- },
- [PVR2_CVAL_VIDEOSTANDARD_PAL_I] = {
- .id = V4L2_STD_PAL_I,
- .frameperiod =
- {
- .numerator = 1,
- .denominator= 25
- },
- .framelines = 625,
- .reserved = {0,0,0,0}
- },
- [PVR2_CVAL_VIDEOSTANDARD_PAL_DK] = {
- .id = V4L2_STD_PAL_DK,
- .frameperiod =
- {
- .numerator = 1,
- .denominator= 25
- },
- .framelines = 625,
- .reserved = {0,0,0,0}
- },
- [PVR2_CVAL_VIDEOSTANDARD_SECAM_L] = {
- .id = V4L2_STD_SECAM,
- .frameperiod =
- {
- .numerator = 1,
- .denominator= 25
- },
- .framelines = 625,
- .reserved = {0,0,0,0}
- },
- [PVR2_CVAL_VIDEOSTANDARD_NTSC_M] = {
- .id = V4L2_STD_NTSC_M,
- .frameperiod =
- {
- .numerator = 1001,
- .denominator= 30000
- },
- .framelines = 525,
- .reserved = {0,0,0,0}
- },
- [PVR2_CVAL_VIDEOSTANDARD_PAL_M] = {
- .id = V4L2_STD_PAL_M,
- .frameperiod =
- {
- .numerator = 1001,
- .denominator= 30000
- },
- .framelines = 525,
- .reserved = {0,0,0,0}
- }
-};
-
struct v4l2_fmtdesc pvr_fmtdesc [] = {
{
.index = 0,
@@ -257,84 +170,6 @@ struct v4l2_format pvr_format [] = {
}
};
-static int cnv_cid_v4l2_pvr2(int id)
-{
- switch (id) {
- case V4L2_CID_BRIGHTNESS:
- return PVR2_CID_BRIGHTNESS;
- case V4L2_CID_SATURATION:
- return PVR2_CID_SATURATION;
- case V4L2_CID_CONTRAST:
- return PVR2_CID_CONTRAST;
- case V4L2_CID_HUE:
- return PVR2_CID_HUE;
- case V4L2_CID_AUDIO_VOLUME:
- return PVR2_CID_VOLUME;
- case V4L2_CID_AUDIO_BALANCE:
- return PVR2_CID_BALANCE;
- case V4L2_CID_AUDIO_BASS:
- return PVR2_CID_BASS;
- case V4L2_CID_AUDIO_TREBLE:
- return PVR2_CID_TREBLE;
- case V4L2_CID_AUDIO_MUTE:
- return PVR2_CID_MUTE;
- case V4L2_CID_PVR_SRATE:
- return PVR2_CID_SRATE;
- case V4L2_CID_PVR_AUDIOBITRATE:
- return PVR2_CID_AUDIOBITRATE;
- case V4L2_CID_PVR_AUDIOCRC:
- return PVR2_CID_AUDIOCRC;
- case V4L2_CID_PVR_AUDIOEMPHASIS:
- return PVR2_CID_AUDIOEMPHASIS;
- case V4L2_CID_PVR_VBR:
- return PVR2_CID_VBR;
- case V4L2_CID_PVR_VIDEOBITRATE:
- return PVR2_CID_AVERAGEVIDEOBITRATE;
- case V4L2_CID_PVR_VIDEOPEAK:
- return PVR2_CID_PEAKVIDEOBITRATE;
- case V4L2_CID_PVR_INPUT:
- return PVR2_CID_INPUT;
- case V4L2_CID_PVR_AUDIOMODE:
- return PVR2_CID_AUDIOMODE;
- case V4L2_CID_PVR_FREQUENCY:
- return PVR2_CID_FREQUENCY;
- case V4L2_CID_PVR_HRES:
- return PVR2_CID_HRES;
- case V4L2_CID_PVR_VRES:
- return PVR2_CID_VRES;
- }
- return -1;
-}
-
-#if 0
-static int cnv_cid_pvr2_v4l2(int id)
-{
- switch (id) {
- case PVR2_CID_BRIGHTNESS:
- return V4L2_CID_BRIGHTNESS;
- case PVR2_CID_SATURATION:
- return V4L2_CID_SATURATION;
- case PVR2_CID_CONTRAST:
- return V4L2_CID_CONTRAST;
- case PVR2_CID_HUE:
- return V4L2_CID_HUE;
- case PVR2_CID_VOLUME:
- return V4L2_CID_AUDIO_VOLUME;
- case PVR2_CID_BALANCE:
- return V4L2_CID_AUDIO_BALANCE;
- case PVR2_CID_BASS:
- return V4L2_CID_AUDIO_BASS;
- case PVR2_CID_TREBLE:
- return V4L2_CID_AUDIO_TREBLE;
- case PVR2_CID_MUTE:
- return V4L2_CID_AUDIO_MUTE;
-
- return id + V4L2_CID_PRIVATE_BASE;
- }
- return -1;
-}
-#endif
-
/*
* pvr_ioctl()
*
@@ -402,92 +237,41 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
case VIDIOC_ENUMSTD:
{
-
struct v4l2_standard *vs = (struct v4l2_standard *)arg;
int idx = vs->index;
-
- if ((vs->index < PVR2_CVAL_VIDEOSTANDARD_MIN) ||
- (vs->index > PVR2_CVAL_VIDEOSTANDARD_MAX)) {
- break;
- }
-
- memcpy(vs, &pvr_standards[idx], sizeof(struct v4l2_standard));
- vs->index = idx;
- strlcpy(vs->name,
- pvr2_hdw_get_ctl_value_name(hdw,
- PVR2_CID_VIDEOSTANDARD,
- idx),
- sizeof(vs->name));
-
- ret = 0;
+ ret = pvr2_hdw_get_stdenum_value(hdw,vs,idx+1);
break;
}
case VIDIOC_G_STD:
{
- v4l2_std_id *vs = (v4l2_std_id *)arg;
-
- switch (pvr2_hdw_get_ctl_value(hdw,PVR2_CID_VIDEOSTANDARD)) {
- default:
- case PVR2_CVAL_VIDEOSTANDARD_NTSC_M:
- *vs = V4L2_STD_NTSC_M;
- break;
- case PVR2_CVAL_VIDEOSTANDARD_PAL_M:
- *vs = V4L2_STD_PAL_M;
- break;
- case PVR2_CVAL_VIDEOSTANDARD_SECAM_L:
- *vs = V4L2_STD_SECAM;
- break;
- case PVR2_CVAL_VIDEOSTANDARD_PAL_BG:
- *vs = V4L2_STD_PAL_BG;
- break;
- case PVR2_CVAL_VIDEOSTANDARD_PAL_I:
- *vs = V4L2_STD_PAL_I;
- break;
- case PVR2_CVAL_VIDEOSTANDARD_PAL_DK:
- *vs = V4L2_STD_PAL_DK;
- break;
- }
- ret = 0;
+ int val = 0;
+ ret = pvr2_ctrl_get_value(
+ pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_STDCUR),&val);
+ *(v4l2_std_id *)arg = val;
break;
}
case VIDIOC_S_STD:
{
- v4l2_std_id *vs = (v4l2_std_id *)arg;
- int val = PVR2_CVAL_VIDEOSTANDARD_NTSC_M;
-
- if (*vs & V4L2_STD_NTSC_M){
- val = PVR2_CVAL_VIDEOSTANDARD_NTSC_M;
- } else if (*vs & V4L2_STD_PAL_BG){
- val = PVR2_CVAL_VIDEOSTANDARD_PAL_BG;
- } else if (*vs & V4L2_STD_PAL_I){
- val = PVR2_CVAL_VIDEOSTANDARD_PAL_I;
- } else if (*vs & V4L2_STD_PAL_DK){
- val = PVR2_CVAL_VIDEOSTANDARD_PAL_DK;
- } else if (*vs & V4L2_STD_SECAM){
- val = PVR2_CVAL_VIDEOSTANDARD_SECAM_L;
- } else if (*vs & V4L2_STD_PAL_M){
- val = PVR2_CVAL_VIDEOSTANDARD_PAL_M;
- }
-
- pvr2_hdw_set_ctl_value(hdw,PVR2_CID_VIDEOSTANDARD,val);
-
+ ret = pvr2_ctrl_set_value(
+ pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_STDCUR),
+ *(v4l2_std_id *)arg);
break;
}
case VIDIOC_ENUMINPUT:
{
+ struct pvr2_ctrl *cptr;
struct v4l2_input *vi = (struct v4l2_input *)arg;
struct v4l2_input tmp;
+ unsigned int cnt;
- if ((vi->index > PVR2_CVAL_INPUT_MAX) ||
- (vi->index < PVR2_CVAL_INPUT_MIN)) {
- break;
- }
+ cptr = pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_INPUT);
memset(&tmp,0,sizeof(tmp));
tmp.index = vi->index;
+ ret = 0;
switch (vi->index) {
case PVR2_CVAL_INPUT_TV:
case PVR2_CVAL_INPUT_RADIO:
@@ -497,12 +281,16 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
case PVR2_CVAL_INPUT_COMPOSITE:
tmp.type = V4L2_INPUT_TYPE_CAMERA;
break;
+ default:
+ ret = -EINVAL;
+ break;
}
+ if (ret < 0) break;
- strlcpy(tmp.name,
- pvr2_hdw_get_ctl_value_name(hdw,PVR2_CID_INPUT,
- vi->index),
- sizeof(tmp.name));
+ cnt = 0;
+ pvr2_ctrl_get_valname(cptr,vi->index,
+ tmp.name,sizeof(tmp.name)-1,&cnt);
+ tmp.name[cnt] = 0;
/* Don't bother with audioset, since this driver currently
always switches the audio whenever the video is
@@ -522,19 +310,22 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
case VIDIOC_G_INPUT:
{
+ struct pvr2_ctrl *cptr;
struct v4l2_input *vi = (struct v4l2_input *)arg;
- vi->index = pvr2_hdw_get_ctl_value(hdw,PVR2_CID_INPUT);
- ret = 0;
+ int val;
+ cptr = pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_INPUT);
+ val = 0;
+ ret = pvr2_ctrl_get_value(cptr,&val);
+ vi->index = val;
break;
}
case VIDIOC_S_INPUT:
{
struct v4l2_input *vi = (struct v4l2_input *)arg;
- ret = 0;
- if (pvr2_hdw_set_ctl_value(hdw,PVR2_CID_INPUT,vi->index)) {
- ret = -EINVAL;
- }
+ ret = pvr2_ctrl_set_value(
+ pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_INPUT),
+ vi->index);
break;
}
@@ -559,6 +350,7 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
{
struct v4l2_tuner *vt = (struct v4l2_tuner *)arg;
unsigned int status_mask;
+ int val;
if (vt->index !=0) break;
status_mask = pvr2_hdw_get_signal_status(hdw);
@@ -580,83 +372,44 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
vt->signal = 65535;
}
- switch (pvr2_hdw_get_ctl_value(hdw,PVR2_CID_AUDIOMODE)) {
- case PVR2_CVAL_AUDIOMODE_MONO:
- vt->audmode = V4L2_TUNER_MODE_MONO;
- break;
- case PVR2_CVAL_AUDIOMODE_STEREO:
- vt->audmode = V4L2_TUNER_MODE_STEREO;
- break;
- case PVR2_CVAL_AUDIOMODE_LANG1:
- vt->audmode = V4L2_TUNER_MODE_LANG1;
- break;
- case PVR2_CVAL_AUDIOMODE_LANG2:
- vt->audmode = V4L2_TUNER_MODE_LANG2;
- break;
- case PVR2_CVAL_AUDIOMODE_LANG1_LANG2:
- vt->audmode = V4L2_TUNER_MODE_LANG1_LANG2;
- break;
- case PVR2_CVAL_AUDIOMODE_SAP:
- vt->audmode = V4L2_TUNER_MODE_SAP;
- break;
- }
-
- ret = 0;
+ val = 0;
+ ret = pvr2_ctrl_get_value(
+ pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_AUDIOMODE),
+ &val);
+ vt->audmode = val;
break;
}
case VIDIOC_S_TUNER:
{
struct v4l2_tuner *vt=(struct v4l2_tuner *)arg;
- int val = PVR2_CVAL_AUDIOMODE_STEREO;
if (vt->index != 0)
break;
- switch (vt->audmode) {
- case V4L2_TUNER_MODE_MONO:
- val = PVR2_CVAL_AUDIOMODE_MONO;
- break;
- case V4L2_TUNER_MODE_STEREO:
- val = PVR2_CVAL_AUDIOMODE_STEREO;
- break;
- case V4L2_TUNER_MODE_LANG1:
- val = PVR2_CVAL_AUDIOMODE_LANG1;
- break;
- case V4L2_TUNER_MODE_LANG1_LANG2:
- val = PVR2_CVAL_AUDIOMODE_LANG1_LANG2;
- break;
- case V4L2_TUNER_MODE_SAP: // Also LANG2
- val = PVR2_CVAL_AUDIOMODE_SAP;
- break;
- }
-
- pvr2_hdw_set_ctl_value(hdw,PVR2_CID_AUDIOMODE,val);
- ret = 0;
+ ret = pvr2_ctrl_set_value(
+ pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_AUDIOMODE),
+ vt->audmode);
}
case VIDIOC_S_FREQUENCY:
{
const struct v4l2_frequency *vf = (struct v4l2_frequency *)arg;
-
- pvr2_hdw_set_ctl_value(hdw,PVR2_CID_FREQUENCY,
- vf->frequency * 62500);
-
- ret = 0;
+ ret = pvr2_ctrl_set_value(
+ pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_FREQUENCY),
+ vf->frequency * 62500);
break;
}
case VIDIOC_G_FREQUENCY:
{
struct v4l2_frequency *vf = (struct v4l2_frequency *)arg;
- int val;
-
- val = pvr2_hdw_get_ctl_value(hdw,PVR2_CID_FREQUENCY);
-
+ int val = 0;
+ ret = pvr2_ctrl_get_value(
+ pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_FREQUENCY),
+ &val);
val /= 62500;
vf->frequency = val;
-
- ret = 0;
break;
}
@@ -676,18 +429,27 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
case VIDIOC_G_FMT:
{
struct v4l2_format *vf = (struct v4l2_format *)arg;
-
+ int val;
switch(vf->type) {
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
memcpy(vf, &pvr_format[PVR_FORMAT_PIX],
sizeof(struct v4l2_format));
- vf->fmt.pix.width =
- pvr2_hdw_get_ctl_value(hdw,PVR2_CID_HRES);
- if (pvr2_hdw_get_ctl_value(hdw,PVR2_CID_INTERLACE)) {
- vf->fmt.pix.width /= 2;
- }
- vf->fmt.pix.height =
- pvr2_hdw_get_ctl_value(hdw,PVR2_CID_VRES);
+ val = 0;
+ pvr2_ctrl_get_value(
+ pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_HRES),
+ &val);
+ vf->fmt.pix.width = val;
+ val = 0;
+ pvr2_ctrl_get_value(
+ pvr2_hdw_get_ctrl_by_id(hdw,
+ PVR2_CID_INTERLACE),
+ &val);
+ if (val) vf->fmt.pix.width /= 2;
+ val = 0;
+ pvr2_ctrl_get_value(
+ pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_VRES),
+ &val);
+ vf->fmt.pix.height = val;
ret = 0;
break;
case V4L2_BUF_TYPE_VBI_CAPTURE:
@@ -713,16 +475,14 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
int w = vf->fmt.pix.width;
int vd_std, hf, hh;
- vd_std = pvr2_hdw_get_ctl_value(hdw,
- PVR2_CID_VIDEOSTANDARD);
- switch (vd_std) {
- case PVR2_CVAL_VIDEOSTANDARD_NTSC_M:
- case PVR2_CVAL_VIDEOSTANDARD_PAL_M:
+ vd_std = 0;
+ pvr2_ctrl_get_value(
+ pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_STDCUR),
+ &vd_std);
+ if (vd_std & V4L2_STD_525_60) {
hf=480;
- break;
- default:
+ } else {
hf=576;
- break;
}
hh = (int) (hf / 2);
@@ -733,16 +493,19 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
vf->fmt.pix.width &= 0xff0;
vf->fmt.pix.height = (h > hh) ? hf : hh;
- if (cmd == VIDIOC_S_FMT){
- pvr2_hdw_set_ctl_value(
- hdw,PVR2_CID_HRES,
+ if (cmd == VIDIOC_S_FMT) {
+ pvr2_ctrl_set_value(
+ pvr2_hdw_get_ctrl_by_id(hdw,
+ PVR2_CID_HRES),
vf->fmt.pix.width);
- pvr2_hdw_set_ctl_value(
- hdw,PVR2_CID_VRES,
+ pvr2_ctrl_set_value(
+ pvr2_hdw_get_ctrl_by_id(hdw,
+ PVR2_CID_VRES),
vf->fmt.pix.height);
- pvr2_hdw_set_ctl_value(
- hdw,PVR2_CID_INTERLACE,
- (vf->fmt.pix.height != hf));
+ pvr2_ctrl_set_value(
+ pvr2_hdw_get_ctrl_by_id(
+ hdw,PVR2_CID_INTERLACE),
+ vf->fmt.pix.height != hf);
}
} break;
case V4L2_BUF_TYPE_VBI_CAPTURE:
@@ -772,82 +535,75 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
case VIDIOC_QUERYCTRL:
{
+ struct pvr2_ctrl *cptr;
struct v4l2_queryctrl *vc = (struct v4l2_queryctrl *)arg;
- int pvr2_id = cnv_cid_v4l2_pvr2(vc->id);
- if (pvr2_id < 0) {
+ ret = 0;
+ cptr = pvr2_hdw_get_ctrl_v4l(hdw,vc->id);
+ if (!cptr) {
ret = -EINVAL;
break;
}
- if (pvr2_hdw_get_ctl_value_name(hdw,pvr2_id,0)) {
+ strlcpy(vc->name,pvr2_ctrl_get_name(cptr),sizeof(vc->name));
+ vc->default_value = pvr2_ctrl_get_def(cptr);
+ switch (pvr2_ctrl_get_type(cptr)) {
+ case pvr2_ctl_enum:
vc->type = V4L2_CTRL_TYPE_MENU;
- } else {
+ vc->minimum = 0;
+ vc->maximum = pvr2_ctrl_get_cnt(cptr) - 1;
+ vc->step = 1;
+ break;
+ case pvr2_ctl_int:
vc->type = V4L2_CTRL_TYPE_INTEGER;
+ vc->minimum = pvr2_ctrl_get_min(cptr);
+ vc->maximum = pvr2_ctrl_get_max(cptr);
+ vc->step = 1;
+ break;
+ default:
+ ret = -EINVAL;
+ break;
}
- strlcpy(vc->name,pvr2_hdw_get_ctl_name(hdw,pvr2_id),
- sizeof(vc->name));
- vc->minimum = pvr2_hdw_get_ctl_min_value(hdw,pvr2_id);
- vc->maximum = pvr2_hdw_get_ctl_max_value(hdw,pvr2_id);
- vc->step = 1;
- ret = 0;
break;
}
case VIDIOC_QUERYMENU:
{
struct v4l2_querymenu *vm = (struct v4l2_querymenu *)arg;
- int pvr2_id = cnv_cid_v4l2_pvr2(vm->id);
- const char *value_name;
- if (pvr2_id < 0) {
- ret = -EINVAL;
- break;
- }
-
- value_name = pvr2_hdw_get_ctl_value_name(hdw,pvr2_id,
- vm->index);
- if (value_name) {
- strlcpy(vm->name,value_name,sizeof(vm->name));
- ret = 0;
- } else {
- ret = -EINVAL;
- }
-
+ unsigned int cnt = 0;
+ ret = pvr2_ctrl_get_valname(pvr2_hdw_get_ctrl_v4l(hdw,vm->id),
+ vm->index,
+ vm->name,sizeof(vm->name)-1,
+ &cnt);
+ vm->name[cnt] = 0;
break;
}
case VIDIOC_G_CTRL:
{
struct v4l2_control *vc = (struct v4l2_control *)arg;
- int pvr2_id;
-
- pvr2_id = cnv_cid_v4l2_pvr2(vc->id);
- if (pvr2_id < 0) {
- ret = -EINVAL;
- break;
- }
- ret = 0;
- vc->value = pvr2_hdw_get_ctl_value(hdw,pvr2_id);
+ int val = 0;
+ ret = pvr2_ctrl_get_value(pvr2_hdw_get_ctrl_v4l(hdw,vc->id),
+ &val);
+ vc->value = val;
break;
}
case VIDIOC_S_CTRL:
{
struct v4l2_control *vc = (struct v4l2_control *)arg;
- int pvr2_id;
-
- pvr2_id = cnv_cid_v4l2_pvr2(vc->id);
- if (pvr2_id < 0) {
- ret = -EINVAL;
- break;
- }
-
- ret = pvr2_hdw_set_ctl_value(hdw,pvr2_id,vc->value);
+ ret = pvr2_ctrl_set_value(pvr2_hdw_get_ctrl_v4l(hdw,vc->id),
+ vc->value);
break;
}
case VIDIOC_LOG_STATUS:
{
+ int nr = pvr2_hdw_get_unit_number(hdw);
+
+ printk(KERN_INFO "pvrusb2: ================= START STATUS CARD #%d =================\n", nr);
pvr2_hdw_trigger_module_log(hdw);
+ printk(KERN_INFO "pvrusb2: ================== END STATUS CARD #%d ==================\n", nr);
+ ret = 0;
break;
}