Add support for selecting from multiple tuners.

Suggested by:	usleepless <usleepless@gmail.com>
This commit is contained in:
Greg Lehey 2007-02-25 01:28:37 +00:00
parent f65f25a187
commit 825df58b28
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=166960
2 changed files with 27 additions and 8 deletions

View File

@ -36,11 +36,8 @@
.Pp
.Sh DESCRIPTION
.Nm
provides support for selecting channels on the PVR250 and PVR350 via
.Pa /dev/cxm0
(or
.Pa /dev/bktr0
on FreeBSD 4.x)
provides support for selecting channels on Hauppauge WinTV cards,
including the PVR 150, PVR 250, PVR 350 and PVR 500.
.Pp
The following options are available:
.Bl -tag -width indent
@ -50,6 +47,14 @@ Enable AFC.
Disable AFC.
.It Fl c
Select composite input.
.It Fl d
Select the tuner unit number.
This is appended to the base device file name
.Pa /dev/cxm
to form a device name such as
.Pa /dev/cxm0
or
.Pa /dev/cxm1 .
.It Fl r
Select radio input.
.It Fl s

View File

@ -31,6 +31,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
@ -55,6 +56,7 @@ usage()
"[-g geom] [-m chnl_set] [chnl | freq]\n"
" -a Enable / disable AFC.\n"
" -c Select composite input.\n"
" -d Select tuner unit number.\n"
" -r Select radio input.\n"
" -s Select svideo input.\n"
" -t Select tuner.\n"
@ -78,6 +80,9 @@ usage()
CHNLSET_JPNCABLE, CHNLSET_AUSTRALIA, CHNLSET_FRANCE);
}
#define DEVNAME_BASE "/dev/cxm"
char dev_name[16];
int
main(int argc, char *argv[])
{
@ -89,6 +94,7 @@ main(int argc, char *argv[])
int channel_set;
int i;
int status;
int unit;
int tfd;
unsigned int channel;
unsigned int fraction;
@ -105,11 +111,13 @@ main(int argc, char *argv[])
device = 0;
freq = 0;
status = 0;
unit = 0;
x_size = 0;
y_size = 0;
while ((c = getopt(argc, argv, "a:crg:m:st")) != -1)
while ((c = getopt(argc, argv, "a:cd:rg:m:st")) != -1)
switch (c) {
case 'a':
if (strcasecmp(optarg, "on") == 0)
afc = 1;
@ -126,6 +134,10 @@ main(int argc, char *argv[])
audio = -1;
break;
case 'd':
unit = atoi(optarg);
break;
case 'r':
device = 0;
audio = AUDIO_INTERN;
@ -202,9 +214,11 @@ main(int argc, char *argv[])
exit(1);
}
tfd = open("/dev/cxm0", O_RDONLY);
sprintf(dev_name, DEVNAME_BASE "%d", unit);
tfd = open(dev_name, O_RDONLY);
if (tfd < 0) {
perror("open() of /dev/cxm0 failed.");
fprintf(stderr, "Can't open %s: %s (%d)\n", dev_name,
strerror(errno), errno);
exit(1);
}