Re: [Spca50x-devs] Add support light frequency banding filters (gspcaV1/V2)
- Date: Sun, 27 Aug 2006 20:20:27 +0200
- From: "Serge A. Suchkov" <Serge.Suchkov@xxxxxxxxxxxxxxxxxxxxxxxx>
- Subject: Re: [Spca50x-devs] Add support light frequency banding filters (gspcaV1/V2)
Hi Michel, > Please, focus to gspcav2 OK. In this letter I'm enclosed patch for gspcaV2 (V4L2) which add support light frequency banding filters ( previously need apply patch for add fv0250 support) and patch for luvcview-20060706 which implement (in draft) V4L2_CID_POWER_LINE_FREQUENCY private ioctl for switch light frequency banding filters. My main problem in coding of extensions for V4L2 driver in absence stable documented API for future compatibility with userspace tools. UVC project looks good in this case. Regards, Serge A. Suchkov -- Justice is incidental to law and order. -- J. Edgar Hoover
diff -u -r -N /usr/src/WebCam/luvcview-20060706/luvcview.c /usr/local/luvcview-20060706/luvcview.c
--- /usr/src/WebCam/luvcview-20060706/luvcview.c 2006-07-06 15:16:18.000000000 +0200
+++ /usr/local/luvcview-20060706/luvcview.c 2006-08-27 18:19:37.000000000 +0200
@@ -64,10 +64,10 @@
A_NOT0_UP,
A_SCREENSHOT,
A_RESET,
- A_PAN_UP,
+ A_PAN_UP,
A_TILT_UP,
A_PAN_RESET,
- A_NOT1_UP,
+ A_SWITCH_LIGHTFREQFILT,
A_NOT2_UP,
A_NOT3_UP,
A_NOT4_UP,
@@ -81,7 +81,7 @@
A_NOT0_DOWN,
A_RECORD_TOGGLE,
A_QUIT,
- A_PAN_DOWN,
+ A_PAN_DOWN,
A_TILT_DOWN,
A_TILT_RESET,
A_NOT1_DOWN,
@@ -122,6 +122,7 @@
{SDLK_t, A_PAN_DOWN},
{SDLK_s, A_SCREENSHOT},
{SDLK_p, A_RECORD_TOGGLE},
+ {SDLK_f, A_SWITCH_LIGHTFREQFILT},
{SDLK_l, A_RESET},
{SDLK_q, A_QUIT},
{SDLK_m, A_VIDEO},
@@ -142,7 +143,7 @@
{ A_PAN_UP,"Pan +angle"},
{ A_TILT_UP,"Tilt +angle"},
{ A_PAN_RESET,"Pan reset"},
- { A_NOT1_UP,"Nothing"},
+ { A_SWITCH_LIGHTFREQFILT,"Switch light freq filter"},
{ A_NOT2_UP,"Nothing"},
{ A_NOT3_UP,"Nothing"},
{ A_NOT4_UP,"Nothing"},
@@ -631,6 +632,27 @@
videoIn->toggleAvi = !videoIn->toggleAvi;
value = videoIn->toggleAvi;
break;
+ case A_SWITCH_LIGHTFREQFILT:
+ if ((value =v4l2GetControl(videoIn,V4L2_CID_POWER_LINE_FREQUENCY)) < 0)
+ printf("Get value of light frequency filter error\n");
+
+ if(value < 2) // round switch 50->60->NoFliker->.
+ value++; // \_______________;
+ else
+ value=0;
+
+ if(value == 0)
+ printf("Current light frequency filter: 50Hz\n");
+ else if(value == 1)
+ printf("Current light frequency filter: 60Hz\n");
+ else if(value == 2)
+ printf("Current light frequency filter: NoFliker\n");
+
+ if ((value =v4l2SetLightFrequencyFilter(videoIn,value)) < 0)
+ printf("Switch light frequency filter error\n");
+
+
+ break;
case A_QUIT:
videoIn->signalquit = 0;
break;
diff -u -r -N /usr/src/WebCam/luvcview-20060706/README /usr/local/luvcview-20060706/README
--- /usr/src/WebCam/luvcview-20060706/README 2006-02-07 19:21:15.000000000 +0100
+++ /usr/local/luvcview-20060706/README 2006-08-27 16:21:28.000000000 +0200
@@ -94,6 +94,7 @@
{SDLK_e, A_SHARPNESS_DOWN},
{SDLK_y, A_CUSTOM_A},
{SDLK_t, A_CUSTOM_B},
+ {SDLK_f, A_SWITCH_LIGHTFREQFILT},
{SDLK_s, A_SCREENSHOT},
{SDLK_p, A_RECORD_TOGGLE},
{SDLK_l, A_RESET},
diff -u -r -N /usr/src/WebCam/luvcview-20060706/v4l2uvc.c /usr/local/luvcview-20060706/v4l2uvc.c
--- /usr/src/WebCam/luvcview-20060706/v4l2uvc.c 2006-07-06 15:13:01.000000000 +0200
+++ /usr/local/luvcview-20060706/v4l2uvc.c 2006-08-27 18:19:07.000000000 +0200
@@ -579,3 +579,21 @@
}
return 0;
}
+
+int v4l2SetLightFrequencyFilter(struct vdIn *vd, int flt)
+{ int control = V4L2_CID_POWER_LINE_FREQUENCY;
+ struct v4l2_control control_s;
+ struct v4l2_queryctrl queryctrl;
+ int err;
+ control_s.id = control;
+ if (isv4l2Control(vd, control, &queryctrl) < 0)
+ return -1;
+
+ control_s.value = flt;
+
+ if ((err = ioctl(vd->fd, VIDIOC_S_CTRL, &control_s)) < 0) {
+ printf("ioctl set_light_frequency_filter error\n");
+ return -1;
+ }
+ return 0;
+}
diff -u -r -N /usr/src/WebCam/luvcview-20060706/v4l2uvc.h /usr/local/luvcview-20060706/v4l2uvc.h
--- /usr/src/WebCam/luvcview-20060706/v4l2uvc.h 2006-07-06 15:17:58.000000000 +0200
+++ /usr/local/luvcview-20060706/v4l2uvc.h 2006-08-27 18:17:18.000000000 +0200
@@ -94,3 +94,4 @@
int v4l2ResetPanTilt(struct vdIn *vd,int pantilt);
int v4L2UpDownPan(struct vdIn *vd, short inc);
int v4L2UpDownTilt(struct vdIn *vd,short inc);
+int v4l2SetLightFrequencyFilter(struct vdIn *vd,int flt);
Attachment:
gspcav2-add-lightfreq.diff.bz2
Description: BZip2 compressed data
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Spca50x-devs mailing list Spca50x-devs@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/spca50x-devs
- References:
- [Spca50x-devs] Functions/structures naming in gspca1 and another questions ...
- From: Serge A. Suchkov
- [Spca50x-devs] Add support light frequency banding filters (gspcaV1)
- From: Serge A. Suchkov
- Re: [Spca50x-devs] Add support light frequency banding filters (gspcaV1)
- From: michel Xhaard
- [Spca50x-devs] Functions/structures naming in gspca1 and another questions ...
- Prev by Date: Re: [Spca50x-devs] Add support Creative Live! Cam Notebook Pro (gspcaV2)
- Next by Date: [Spca50x-devs] Need gspcav2.c driver information
- Previous by thread: Re: [Spca50x-devs] Add support light frequency banding filters (gspcaV1)
- Next by thread: [Spca50x-devs] Logitech Quickcam chat 0x046d:0x092e
- Index(es):