aboutsummaryrefslogtreecommitdiffstats
path: root/util/scan/atsc/us-Cable-IRC-center-frequencies-QAM256
blob: 72842e0c911ac3eefadbdd4acc416d7d56160cd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# US Cable center frequencies
# Incrementally Related Carriers (IRC)
# Channels are in ascending EIA/NCTA channel designation order

#1
A  75000000 QAM256
A  57000000 QAM256
A  63000000 QAM256
A  69000000 QAM256
A  79000000 QAM256
A  85000000 QAM256
A 177000000 QAM256
A 183000000 QAM256
A 189000000 QAM256
#10
A 195000000 QAM256
A 201000000 QAM256
A 207000000 QAM256
A 213000000 QAM256
A 123000000 QAM256
A 129000000 QAM256
A 135000000 QAM256
A 141000000 QAM256
A 147000000 QAM256
A 153000000 QAM256
#20
A 159000000 QAM256
A 165000000 QAM256
A 171000000 QAM256
A 219000000 QAM256
A 225000000 QAM256
A 231000000 QAM256
A 237000000 QAM256
A 243000000 QAM256
A 249000000 QAM256
A 255000000 QAM256
#30
A 261000000 QAM256
A 267000000 QAM256
A 273000000 QAM256
A 279000000 QAM256
A 285000000 QAM256
A 291000000 QAM256
A 297000000 QAM256
A 303000000 QAM256
A 309000000 QAM256
A 315000000 QAM256
#40
A 321000000 QAM256
A 327000000 QAM256
A 333000000 QAM256
A 339000000 QAM256
A 345000000 QAM256
A 351000000 QAM256
A 357000000 QAM256
A 363000000 QAM256
A 369000000 QAM256
A 375000000 QAM256
#50
A 381000000 QAM256
A 387000000 QAM256
A 393000000 QAM256
A 399000000 QAM256
A 405000000 QAM256
A 411000000 QAM256
A 417000000 QAM256
A 423000000 QAM256
A 429000000 QAM256
A 435000000 QAM256
#60
A 441000000 QAM256
A 447000000 QAM256
A 453000000 QAM256
A 459000000 QAM256
A 465000000 QAM256
A 471000000 QAM256
A 477000000 QAM256
A 483000000 QAM256
A 489000000 QAM256
A 495000000 QAM256
#70
A 501000000 QAM256
A 507000000 QAM256
A 513000000 QAM256
A 519000000 QAM256
A 525000000 QAM256
A 531000000 QAM256
A 537000000 QAM256
A 543000000 QAM256
A 549000000 QAM256
A 555000000 QAM256
#80
A 561000000 QAM256
A 567000000 QAM256
A 573000000 QAM256
A 579000000 QAM256
A 585000000 QAM256
A 591000000 QAM256
A 597000000 QAM256
A 603000000 QAM256
A 609000000 QAM256
A 615000000 QAM256
#90
A 621000000 QAM256
A 627000000 QAM256
A 633000000 QAM256
A 639000000 QAM256
A 645000000 QAM256
A  93000000 QAM256
A  99000000 QAM256
A 105000000 QAM256
A 111000000 QAM256
A 117000000 QAM256
#100
A 651000000 QAM256
A 657000000 QAM256
A 663000000 QAM256
A 669000000 QAM256
A 675000000 QAM256
A 681000000 QAM256
A 687000000 QAM256
A 693000000 QAM256
A 699000000 QAM256
A 705000000 QAM256
#110
A 711000000 QAM256
A 717000000 QAM256
A 723000000 QAM256
A 729000000 QAM256
A 735000000 QAM256
A 741000000 QAM256
A 747000000 QAM256
A 753000000 QAM256
A 759000000 QAM256
A 765000000 QAM256
#120
A 771000000 QAM256
A 777000000 QAM256
A 783000000 QAM256
A 789000000 QAM256
A 795000000 QAM256
A 801000000 QAM256
='#n429'>429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457
/* $Id: lcd4linux.c,v 1.34 2002/04/29 11:00:28 reinelt Exp $
 *
 * LCD4Linux
 *
 * Copyright 1999-2002 by Michael Reinelt (reinelt@eunet.at)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *
 * $Log: lcd4linux.c,v $
 * Revision 1.34  2002/04/29 11:00:28  reinelt
 *
 * added Toshiba T6963 driver
 * added ndelay() with nanosecond resolution
 *
 * Revision 1.33  2001/04/27 05:04:57  reinelt
 *
 * replaced OPEN_MAX with sysconf()
 * replaced mktemp() with mkstemp()
 * unlock serial port if open() fails
 *
 * Revision 1.32  2001/03/13 07:41:22  reinelt
 *
 * added NEWS file
 *
 * Revision 1.31  2001/03/12 12:39:36  reinelt
 *
 * reworked autoconf a lot: drivers may be excluded, #define's went to config.h
 *
 * Revision 1.30  2001/03/08 15:25:38  ltoetsch
 * improved exec
 *
 * Revision 1.29  2001/02/14 07:40:16  reinelt
 *
 * first (incomplete) GPO implementation
 *
 * Revision 1.28  2000/10/25 08:10:48  reinelt
 *
 * added restart funnctionality
 * (lots of this code was stolen from sendmail.c)
 *
 * Revision 1.27  2000/08/10 18:42:20  reinelt
 *
 * fixed some bugs with the new syslog code
 *
 * Revision 1.26  2000/08/10 09:44:09  reinelt
 *
 * new debugging scheme: error(), info(), debug()
 * uses syslog if in daemon mode
 *
 * Revision 1.25  2000/08/09 14:14:11  reinelt
 *
 * new switch -F (do not fork)
 * added automatic forking if -F not specified
 *
 * Revision 1.24  2000/08/09 09:50:29  reinelt
 *
 * opened 0.98 development
 * removed driver-specific signal-handlers
 * added 'quit'-function to driver structure
 * added global signal-handler
 *
 * Revision 1.23  2000/04/17 05:14:27  reinelt
 *
 * added README.44780
 *
 * Revision 1.22  2000/04/15 16:56:52  reinelt
 *
 * moved delay loops to udelay.c
 * renamed -d (debugging) switch to -v (verbose)
 * new switch -d to calibrate delay loop
 * 'Delay' entry for HD44780 back again
 * delay loops will not calibrate automatically, because this will fail with hich CPU load
 *
 * Revision 1.21  2000/04/15 11:56:35  reinelt
 *
 * more debug messages
 *
 * Revision 1.20  2000/04/15 11:13:54  reinelt
 *
 * added '-d' (debugging) switch
 * added several debugging messages
 * removed config entry 'Delay' for HD44780 driver
 * delay loop for HD44780 will be calibrated automatically
 *
 * Revision 1.19  2000/04/10 04:40:53  reinelt
 *
 * minor changes and cleanups
 *
 * Revision 1.18  2000/04/07 05:42:20  reinelt
 *
 * UUCP style lockfiles for the serial port
 *
 * Revision 1.17  2000/04/03 17:31:52  reinelt
 *
 * suppress welcome message if display is smaller than 20x2
 * change lcd4linux.ppm to 32 pixel high so KDE won't stretch the icon
 *
 * Revision 1.16  2000/04/03 04:46:38  reinelt
 *
 * added '-c key=val' option
 *
 * Revision 1.15  2000/04/01 22:40:42  herp
 * geometric correction (too many pixelgaps)
 * lcd4linux main should return int, not void
 *
 * Revision 1.14  2000/03/26 18:46:28  reinelt
 *
 * bug in pixmap.c that leaded to empty bars fixed
 * name conflicts with X11 resolved
 *
 * Revision 1.13  2000/03/26 12:55:03  reinelt
 *
 * enhancements to the PPM driver
 *
 * Revision 1.12  2000/03/25 05:50:43  reinelt
 *
 * memory leak in Raster_flush closed
 * driver family logic changed
 *
 * Revision 1.11  2000/03/24 11:36:56  reinelt
 *
 * new syntax for raster configuration
 * changed XRES and YRES to be configurable
 * PPM driver works nice
 *
 * Revision 1.10  2000/03/23 07:24:48  reinelt
 *
 * PPM driver up and running (but slow!)
 *
 * Revision 1.9  2000/03/22 15:36:21  reinelt
 *
 * added '-l' switch (list drivers)
 * generic pixmap driver added
 * X11 Framework done
 *
 * Revision 1.8  2000/03/22 07:33:50  reinelt
 *
 * FAQ added
 * new modules 'processor.c' contains all data processing
 *
 * Revision 1.7  2000/03/19 08:41:28  reinelt
 *
 * documentation available! README, README.MatrixOrbital, README.Drivers
 * added Skeleton.c as a starting point for new drivers
 *
 * Revision 1.6  2000/03/18 10:31:06  reinelt
 *
 * added sensor handling (for temperature etc.)
 * made data collecting happen only if data is used
 * (reading /proc/meminfo takes a lot of CPU!)
 * released lcd4linux-0.92
 *
 * Revision 1.5  2000/03/18 08:07:04  reinelt
 *
 * vertical bars implemented
 * bar compaction improved
 * memory information implemented
 *
 * Revision 1.4  2000/03/17 09:21:42  reinelt
 *
 * various memory statistics added
 *
 * Revision 1.3  2000/03/13 15:58:24  reinelt
 *
 * release 0.9
 * moved row parsing to parser.c
 * all basic work finished
 *
 * Revision 1.2  2000/03/10 17:36:02  reinelt
 *
 * first unstable but running release
 *
 */

#include "config.h"

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>

#include "cfg.h"
#include "debug.h"
#include "udelay.h"
#include "display.h"
#include "processor.h"

char *release="LCD4Linux " VERSION " (c) 2002 Michael Reinelt <reinelt@eunet.at>";
char **my_argv;
char *output=NULL;
int got_signal=0;
int debugging=0;
int foreground=0;
int tick, tack;

static void usage(void)
{
  printf ("%s\n", release);
  printf ("usage: lcd4linux [-h]\n");
  printf ("       lcd4linux [-l]\n");
#ifdef USE_OLD_UDELAY
  printf ("       lcd4linux [-d]\n");
#endif
  printf ("       lcd4linux [-c key=value] [-F] [-f config-file] [-o output-file] [-q] [-v]\n");
}

int hello (void)
{
  int i, x, y, flag;
  char *line1[] = { "* LCD4Linux V" VERSION " *",
		    "LCD4Linux " VERSION,
		    "LCD4Linux",
		    "L4Linux",
		    NULL };
  
  char *line2[] = { "(c) 2002 M.Reinelt",
		    "(c) M.Reinelt",
		    NULL };
  
  lcd_query (&y, &x, NULL, NULL, NULL, NULL);
  
  flag=0;
  for (i=0; line1[i]; i++) {
    if (strlen(line1[i])<=x) {
      lcd_put (1, (x-strlen(line1[i]))/2+1, line1[i]);
      flag=1;
      break;
    }
  }
  
  for (i=0; line2[i]; i++) {
    if (strlen(line2[i])<=x) {
      lcd_put (2, (x-strlen(line2[i]))/2+1, line2[i]);
      flag=1;
      break;
    }
  }
  
  if (flag) lcd_flush();
  return flag;
}

#ifdef USE_OLD_UDELAY
void calibrate (void)
{
  int i;
  unsigned long max=0;

  printf ("%s\n", release);
  printf ("calibrating delay loop:");
  fflush(stdout);
  for (i=0; i<10; i++) {
    udelay_calibrate();
    if (loops_per_usec>max)
      max=loops_per_usec;
  }
  printf (" Delay=%ld\n", max);
}
#endif

void handler (int signal)
{
  debug ("got signal %d", signal);
  got_signal=signal;
}

int main (int argc, char *argv[])
{
  char *cfg="/etc/lcd4linux.conf";
  char *driver;
  int c, smooth;
  int quiet=0;
  
  // save arguments for restart
  my_argv=malloc(sizeof(char*)*(argc+1));
  for (c=0; c<argc; c++) {
    my_argv[c]=strdup(argv[c]);
  }
  my_argv[c]=NULL;

#ifdef USE_OLD_UDELAY
  while ((c=getopt (argc, argv, "c:dFf:hlo:qv"))!=EOF) {
#else
  while ((c=getopt (argc, argv, "c:dFf:hlo:qv"))!=EOF) {
#endif
    switch (c) {
    case 'c':
      if (cfg_cmd (optarg)<0) {
	fprintf (stderr, "%s: illegal argument -c %s\n", argv[0], optarg);
	exit(2);
      }
      break;
    case 'd':
#ifdef USE_OLD_UDELAY
      calibrate();
      exit(0);
#else
      fprintf (stderr, "delay calibration no longer supported!\n");
      exit(1);
#endif
    case 'F':
      foreground++;
      break;
    case 'f':
      cfg=optarg;
      break;
    case 'h':
      usage();
      exit(0);
    case 'l':
      printf ("%s\n", release);
      lcd_list();
      exit(0);
    case 'o':
      output=optarg;
      break;
    case 'q':
      quiet++;
      break;
    case 'v':
      debugging++;
      break;
    default:
      exit(2);
    }
  }

  if (optind < argc) {
    fprintf (stderr, "%s: illegal option %s\n", argv[0], argv[optind]);
    exit(2);
  }

  if (!foreground) {
    pid_t i;
    int fd;
    debug ("going background...");
    i=fork();
    if (i<0) {
      error ("fork() failed: %s", strerror(errno));
      exit (1);
    }
    if (i!=0) exit (0);
    
    // ignore nasty signals
    signal(SIGINT,  SIG_IGN);
    signal(SIGQUIT, SIG_IGN);
    // detach stdin
    if (freopen("/dev/null", "r", stdin)==NULL) {
      error ("freopen (/dev/null) failed: %s", strerror(errno));
      exit (1);
    }
    // detach stdout and stderr
    fd=open("/dev/null", O_WRONLY, 0666);
    if (fd==-1) {
      error ("open (/dev/null) failed: %s", strerror(errno));
      exit (1);
    }
    fflush(stdout);
    fflush(stderr);
    dup2(fd, STDOUT_FILENO);
    dup2(fd, STDERR_FILENO);
    close(fd);
  }
  
  if (foreground) {
    info ("Version " VERSION " starting");
  } else {
    info ("Version " VERSION " starting");
    if (my_argv[0]==NULL || my_argv[0][0]!='/') {
      info ("invoked without full path; restart may not work!");
    }
  }
  
  // set default values
  cfg_set ("row1", "*** %o %v ***");
  cfg_set ("row2", "%p CPU  %r MB RAM");
  cfg_set ("row3", "Busy %cu%% $r10cu");
  cfg_set ("row4", "Load %l1%L$r10l1");

  if (cfg_read (cfg)==-1)
    exit (1);
  
  driver=cfg_get("display");
  if (driver==NULL || *driver=='\0') {
    error ("%s: missing 'display' entry!", cfg_file());
    exit (1);
  }
  
  debug ("initializing driver %s", driver);
  if (lcd_init(driver)==-1) {
    exit (1);
  }

  // now install our own signal handler
  signal(SIGHUP,  handler);
  signal(SIGINT,  handler);
  signal(SIGQUIT, handler);
  signal(SIGTERM, handler);
  
  tick=atoi(cfg_get("tick")?:"100");
  tack=atoi(cfg_get("tack")?:"500");

  process_init();
  lcd_clear();

  if (!quiet && hello()) {
    sleep (3);
    lcd_clear();
  }
  
  debug ("starting main loop");

  smooth=0;
  while (got_signal==0) {
    process (smooth);
    smooth+=tick;
    if (smooth>tack) smooth=0;
    usleep(tick*1000);
  }

  debug ("leaving main loop");
  
  lcd_clear();
  if (!quiet) hello();
  lcd_quit();
  
  if (got_signal==SIGHUP) {
    long fd;
    debug ("restarting...");
    // close all files on exec
    for (fd=sysconf(_SC_OPEN_MAX); fd>2; fd--) {
      int flag;
      if ((flag=fcntl(fd,F_GETFD,0))!=-1)
	fcntl(fd,F_SETFD,flag|FD_CLOEXEC);
    }
    execv (my_argv[0], my_argv);
    error ("execv() failed: %s", strerror(errno));
    exit(1);
  }
  exit (0);
}