diff options
author | pst <pst@FreeBSD.org> | 1996-03-01 06:14:47 +0000 |
---|---|---|
committer | pst <pst@FreeBSD.org> | 1996-03-01 06:14:47 +0000 |
commit | 28abcfcb35bb32810c5afca3cfecc041ec510c8c (patch) | |
tree | 514bb1727251964ba827cc1906336d2689bdb972 | |
parent | c7a6efe93377d02246c6f8387329b2fb0d0ddbc0 (diff) | |
parent | 6074a89ffd9cfd153f2636b2e6fc56a70bc506e8 (diff) | |
download | FreeBSD-src-28abcfcb35bb32810c5afca3cfecc041ec510c8c.zip FreeBSD-src-28abcfcb35bb32810c5afca3cfecc041ec510c8c.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r14306,
which included commits to RCS files with non-trunk default branches.
-rw-r--r-- | usr.sbin/qcamcontrol/Makefile | 3 | ||||
-rw-r--r-- | usr.sbin/qcamcontrol/qcamcontrol.1 | 64 | ||||
-rw-r--r-- | usr.sbin/qcamcontrol/qcamcontrol.c | 12 | ||||
-rw-r--r-- | usr.sbin/qcamcontrol/qcamtime/Makefile | 8 | ||||
-rw-r--r-- | usr.sbin/qcamcontrol/qcamtime/qcamtime.c | 111 |
5 files changed, 195 insertions, 3 deletions
diff --git a/usr.sbin/qcamcontrol/Makefile b/usr.sbin/qcamcontrol/Makefile index f4fcc96..d5f42cf 100644 --- a/usr.sbin/qcamcontrol/Makefile +++ b/usr.sbin/qcamcontrol/Makefile @@ -1,6 +1,3 @@ PROG= qcamcontrol -# soon... very soon... I promise (pst 3-Feb-1996) -NOMAN= - .include <bsd.prog.mk> diff --git a/usr.sbin/qcamcontrol/qcamcontrol.1 b/usr.sbin/qcamcontrol/qcamcontrol.1 new file mode 100644 index 0000000..33f7a96 --- /dev/null +++ b/usr.sbin/qcamcontrol/qcamcontrol.1 @@ -0,0 +1,64 @@ +.Dd Feburary 29, 1996 +.Dt QCAMCONTROL 1 +.Os FreeBSD +.Sh NAME +.Nm qcamcontrol +.Nd Connectix QuickCam control utility +.Sh SYNOPSIS +.Nm qcamcontrol +.Op Fl b Ar brightness +.Op Fl c Ar contrast +.Op Fl d Ar depth +.Op Fl p Ar device +.Op Fl w Ar whitebalance +.Op Fl x Ar xsize +.Op Fl y Ar ysize +.Op Fl z Ar zoom +.Sh DESCRIPTION +.Nm qcamcontrol +is a program to demonstrate control over the Connectix QuickCam(TM) +parallel port camera and to take a single frame picture. +.Pp +If the device not specified, "/dev/qcam0" is assumed. +If no command is given, then +.Nm qcamcontrol +will use its defaults to grab a single frame from the camera. The control +program will output a portable pixmap (ppm) file to stdout. +.Pp +The following options are available: +.Bl -tag -width "flag whitebalance" +.It Fl b Ar brightness +control the brightness of the picture (0..255) +.It Fl c Ar contrast +control the contrast of the picture (0..255) +.It Fl d Ar depth +16 or 64 shades of gray (specified as 4 or 6 bits per pixel) +.It Fl p Ar device +quickcam device (port) (default is /dev/qcam0) +.It Fl w Ar whitebalance +amount of white in the picture (0..255) +.It Fl x Ar xsize +width of image (320 or less) +.It Fl y Ar ysize +height of image (240 or less) +.It Fl z Ar zoom +zoom in (1, 1.5x, or 2x) +.El +.Sh BUGS +.Nm qcamcontrol +does not enforce a proper aspect ratio for x y sizes. +In practice, standard picture sizes are 320x240 and 180x160 and all smaller +sizes that maintain a similar aspect ratio. +Also, the camera is notoriously finicky until you get just the right +combination of white-balance, contrast, and brightness. Improper values +will return all-black or all-white pictures. +.Sh FILES +.Bl -tag -width /dev/qcam0 -compact +.It Pa /dev/qcam0 +.El +.Sh AUTHOR +Paul Traina +.Sh HISTORY +The +.Nm qcamcontrol +command appeared in FreeBSD 2.1.1 diff --git a/usr.sbin/qcamcontrol/qcamcontrol.c b/usr.sbin/qcamcontrol/qcamcontrol.c index 263d336..9dc5cc6 100644 --- a/usr.sbin/qcamcontrol/qcamcontrol.c +++ b/usr.sbin/qcamcontrol/qcamcontrol.c @@ -18,6 +18,15 @@ void print_data(struct qcam *data) data->qc_contrast); } +usage(void) +{ + fprintf(stderr, "usage: qcamcontrol [-p port] [-x xsize] [-y ysize] " + "[-z zoom] [-d depth]\n" + " [-b brightness] [-w whitebal] " + "[-c contrast]\n"); + exit(2); +} + main(int argc, char **argv) { struct qcam info; @@ -99,6 +108,9 @@ main(int argc, char **argv) exit(2); } break; + + default: + usage(); } argc--; argv++; diff --git a/usr.sbin/qcamcontrol/qcamtime/Makefile b/usr.sbin/qcamcontrol/qcamtime/Makefile new file mode 100644 index 0000000..03c040c --- /dev/null +++ b/usr.sbin/qcamcontrol/qcamtime/Makefile @@ -0,0 +1,8 @@ +# +# qcamtime is a program for snarfing timing histograms out of the kernel +# it is only meant for use by driver developers +# +PROG= qcamtime +NOMAN= + +.include <bsd.prog.mk> diff --git a/usr.sbin/qcamcontrol/qcamtime/qcamtime.c b/usr.sbin/qcamcontrol/qcamtime/qcamtime.c new file mode 100644 index 0000000..5ed58a1 --- /dev/null +++ b/usr.sbin/qcamcontrol/qcamtime/qcamtime.c @@ -0,0 +1,111 @@ +/* + * Print out timing statistics from a QuickCam scan run yes, this is ugly, + * it's just for simple analysis of driver timing. This is not normally + * part of the system. + * + * Paul Traina, Feburary 1996 + */ + +#include <stdio.h> +#include <stdlib.h> +#include <sys/fcntl.h> +#include <paths.h> +#include <nlist.h> + +#include <machine/qcam.h> + +int kmem = -1; + +struct nlist names[] = { + {"_qcam_rsbhigh"}, + {"_qcam_rsblow"} +}; +#define MAX_SYMBOLS 2 + +#define FBUFSIZE (QC_MAX_XSIZE*QC_MAX_YSIZE)+50 +static u_short high_times[FBUFSIZE]; +static u_short low_times[FBUFSIZE]; + +void +getaddrs(void) +{ + int i; + + if (kmem < 0) { + if ((kmem = open(_PATH_KMEM, 0, 0)) < 0) { + perror("open kmem"); + exit(1); + } + (void) fcntl(kmem, F_SETFD, 1); + + for (i = 0; i < MAX_SYMBOLS; i++) { + if (nlist("/kernel", &names[i]) < 0) { + perror("nlist"); + exit(1); + } + if (names[i].n_value == 0) { + fprintf(stderr, "couldn't find names[%d]\n", i); + exit(1); + } + } + } +} + +void +getdata(void) +{ + if (lseek(kmem, (off_t) names[0].n_value, SEEK_SET) < 0) { + perror("lseek high"); + exit(1); + } + if (read(kmem, (u_short *) high_times, sizeof(high_times)) < 0) { + perror("read high"); + exit(1); + } + if (lseek(kmem, (off_t) names[1].n_value, SEEK_SET) < 0) { + perror("lseek low"); + exit(1); + } + if (read(kmem, (u_short *) low_times, sizeof(low_times)) < 0) { + perror("read low"); + exit(1); + } +} + + +/* + * slow and stupid, who cares? we're just learning about the camera's + * behavior + */ +int +printdata(u_short * p, int length) +{ + int i, j, non_zero; + + for (i = 0; i < length;) { + non_zero = 0; + for (j = 0; j < 16; j++) + if (p[j]) + non_zero++; + + if (non_zero) { + printf("%8d:", i); + + for (j = 0; j < 16; j++) { + printf(" %d", *p++); + i++; + } + printf("\n"); + } else + i += 16; + } +} + +void +main(void) +{ + getaddrs(); + getdata(); + printdata(high_times, FBUFSIZE); + printdata(low_times, FBUFSIZE); +} |