Add support for /very/ experimental -e (exposure) option.

Not documented yet, because it's for grownups and geeks for now.
This commit is contained in:
pst 1996-03-21 08:19:10 +00:00
parent 514b5c2840
commit 5e12d8b427
2 changed files with 20 additions and 7 deletions

View File

@ -41,7 +41,7 @@
#define QC_GET _IOR('S', 1, struct qcam) /* get parameter structure */
#define QC_SET _IOW('S', 2, struct qcam) /* set parameter structure */
#define QC_IOCTL_VERSION 2 /* version of the structure */
#define QC_IOCTL_VERSION 3 /* version of the structure */
struct qcam {
int qc_version; /* version of qcam structure */
@ -51,6 +51,7 @@ struct qcam {
int qc_yorigin; /* y origin */
int qc_bpp; /* bits per pixel (4 or 6) */
int qc_zoom; /* zoom mode */
int qc_exposure; /* length of exposure */
u_char qc_brightness; /* 0..255 */
u_char qc_whitebalance; /* 0..255 */
u_char qc_contrast; /* 0..255 */

View File

@ -6,13 +6,14 @@
void print_data(struct qcam *data)
{
fprintf(stderr, "version=%d, (%d,%d) at (%d,%d) @%dbpp,"
"zoom=%d, b/w/c=%d/%d/%d\n",
fprintf(stderr, "version=%d, (%d,%d) at (%d,%d) @%dbpp "
"zoom=%d, exp=%d, b/w/c=%d/%d/%d\n",
data->qc_version,
data->qc_xsize, data->qc_ysize,
data->qc_xorigin, data->qc_yorigin,
data->qc_bpp,
data->qc_zoom,
data->qc_exposure,
data->qc_brightness,
data->qc_whitebalance,
data->qc_contrast);
@ -23,7 +24,7 @@ usage(void)
fprintf(stderr, "usage: qcamcontrol [-p port] [-x xsize] [-y ysize] "
"[-z zoom] [-d depth]\n"
" [-b brightness] [-w whitebal] "
"[-c contrast]\n");
"[-c contrast] [-e exposure]\n");
exit(2);
}
@ -37,15 +38,16 @@ main(int argc, char **argv)
static char buffer[QC_MAX_XSIZE*QC_MAX_YSIZE];
char *port = "/dev/qcam0";
int x_size, y_size, zoom, depth, brightness, whitebalance, contrast;
int x_size, y_size, zoom, depth, brightness, whitebalance, contrast,
exposure;
/*
* Default everything to unset.
*/
x_size = y_size = zoom = depth = brightness = whitebalance =
contrast = -1;
contrast = exposure = -1;
while ((opt = getopt(argc, argv, "p:x:y:z:d:b;w:c:")) != EOF) {
while ((opt = getopt(argc, argv, "p:x:y:z:d:b;w:c:e:")) != EOF) {
switch (opt) {
case 'p':
port = optarg;
@ -109,6 +111,14 @@ main(int argc, char **argv)
}
break;
case 'e':
exposure = atoi(optarg);
if (exposure < 100) {
fprintf(stderr, "bad exposure (min 100)\n");
exit(2);
}
break;
default:
usage();
}
@ -143,6 +153,8 @@ main(int argc, char **argv)
info.qc_whitebalance = whitebalance;
if (contrast > -1)
info.qc_contrast = contrast;
if (exposure > -1)
info.qc_exposure = exposure;
/*
* make sure we're in sync with the kernel version of the driver