Import improved quickcam driver control utilities, and

un-installed histogram program for checking driver timing.
This commit is contained in:
pst 1996-03-01 06:14:47 +00:00
parent 9ee94e26ab
commit 6074a89ffd
5 changed files with 195 additions and 3 deletions

View File

@ -1,6 +1,3 @@
PROG= qcamcontrol
# soon... very soon... I promise (pst 3-Feb-1996)
NOMAN=
.include <bsd.prog.mk>

View File

@ -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

View File

@ -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++;

View File

@ -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>

View File

@ -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);
}