aboutsummaryrefslogtreecommitdiffstats
path: root/isdb-t/br-ms-Anastacio
blob: 73bdee16d846c5eee05d281c85902c2011e021c9 (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
# Channel table for Anastácio - MS - Brazil
# Source: http://www.portalbsd.com.br/terrestres_channels.php?channels=2567

# Physical channel 30
[TV Morena]
	DELIVERY_SYSTEM = ISDBT
	BANDWIDTH_HZ = 6000000
	FREQUENCY = 569142857
	INVERSION = AUTO
	GUARD_INTERVAL = AUTO
	TRANSMISSION_MODE = AUTO
	INVERSION = AUTO
	GUARD_INTERVAL = AUTO
	TRANSMISSION_MODE = AUTO
	ISDBT_LAYER_ENABLED = 7
	ISDBT_SOUND_BROADCASTING = 0
	ISDBT_SB_SUBCHANNEL_ID = 0
	ISDBT_SB_SEGMENT_IDX = 0
	ISDBT_SB_SEGMENT_COUNT = 0
	ISDBT_LAYERA_FEC = AUTO
	ISDBT_LAYERA_MODULATION = QAM/AUTO
	ISDBT_LAYERA_SEGMENT_COUNT = 0
	ISDBT_LAYERA_TIME_INTERLEAVING = 0
	ISDBT_LAYERB_FEC = AUTO
	ISDBT_LAYERB_MODULATION = QAM/AUTO
	ISDBT_LAYERB_SEGMENT_COUNT = 0
	ISDBT_LAYERB_TIME_INTERLEAVING = 0
	ISDBT_LAYERC_FEC = AUTO
	ISDBT_LAYERC_MODULATION = QAM/AUTO
	ISDBT_LAYERC_SEGMENT_COUNT = 0
	ISDBT_LAYERC_TIME_INTERLEAVING = 0
.c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#include <asm/types.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
#include <string.h>

#include "input_keynames.h"


static
void print_error (const char *action, const char *file)
__attribute__ ((noreturn));


static
void print_error (const char *action, const char *file)
{
	static const char msg [] = "\nERROR: could not ";

	write (0, msg, strlen(msg));
	write (0, action, strlen(action));
	write (0, " '", 2);
	write (0, file, strlen(file));
	write (0, "'\n\n", 3);
	exit (-1);
}


static
int parse_keyname (char *pos, char **nend, int limit)
{
	int cmp, index;
	int l = 1;
	int r = sizeof (key_name) / sizeof (key_name[0]);

	if (limit < 5)
		return -1;

	while ((*pos == ' ' || *pos == '\t') && limit > 0) {
		(*nend)++;
		pos++;
		limit--;
	}

	if (pos [0] != 'K' || pos[1] != 'E' || pos[2] != 'Y' || pos[3] != '_')
		return -2;

	(*nend) += 4;
	pos += 4;
	limit -= 4;

	while (r >= l) {
		int len0, len1 = 0;

		index = (l + r) / 2;
		
		len0 = strlen(key_name[index-1].name);

		while (len1 < limit && isgraph(pos[len1]))
			len1++;

		cmp = strncmp (key_name[index-1].name, pos,
			       strlen(key_name[index-1].name));
	
		if (len0 < len1 && cmp == 0)
			cmp = -1;

		if (cmp == 0) {
			*nend = pos + strlen (key_name[index-1].name);

			if (**nend != '\n' &&
			    **nend != '\t' &&
			    **nend != ' ' &&
			    *nend != pos)
				return -3;

			return key_name[index-1].key;
		}

		if (cmp < 0)
			l = index + 1;
		else
			r = index - 1;

		if (r < l) {
			static const char msg [] = "\nunknown key '";
			write (0, msg, strlen(msg));
			write (0, pos-4, len1 + 4);
			write (0, "'\n", 2);
		}
	};

	return -4;
}



const char usage [] = "\n\tusage: av7110_loadkeys [-i|--invert] [-a|--address <num>] keymap_filename.(rc5|rcmm)\n\n";


struct ir_setup {
	__u32 ir_config;
	__u16 keytab [256];
} __attribute__ ((packed));


int main (int argc, char **argv)
{
	static struct ir_setup setup;
	int i, fd;
	size_t len;
	char *buf, *pos, *fname = NULL;

	for (i=1; i<argc; i++) {
		if (!strcmp("-i", argv[i]) || !strcmp("--invert", argv[i]))
			setup.ir_config |= 0x8000;
		else if (!strcmp("-a", argv[i]) || !strcmp("--address", argv[i])) {
			if (++i < argc) {
				setup.ir_config |= (atoi(argv[i]) & 0xff) << 16;
				setup.ir_config |= 0x4000;
			}
		} else
			fname = argv[i];
	}

	if (!fname) {
		write (0, usage, strlen(usage));
		exit (-1);
	}

	if (strncmp(".rcmm", fname + strlen(fname) - 5, 5) == 0)
		setup.ir_config |= 0x0001;
	else if (strncmp(".rc5", fname + strlen(fname) - 4, 4) != 0) {
		const char msg [] = "\nERROR: "
			"input filename must have suffix .rc5 or .rcmm\n";
		write (0, msg, strlen(msg));
		exit (-1);
	}

	if ((fd = open (fname, O_RDONLY)) < 0)
		print_error ("open", fname);

	len = lseek (fd, 0, SEEK_END);

	if (!(pos = buf = mmap (NULL, len, PROT_READ, MAP_PRIVATE, fd, 0)))
		print_error ("mmap", fname);

	while (pos < buf + len) {
		int key, keycode;
		
		while (!isxdigit(*pos) && pos < buf + len)
			pos++;

		if (pos == buf + len)
			break;
		
		key = strtol (pos, &pos, 0);
		keycode = parse_keyname (pos, &pos, buf + len - pos);

		if (key < 0 || key > 0xff) {
			const char msg [] = 
				"\nERROR: key must be in range 0 ... 0xff!\n\n";

			write (0, msg, strlen(msg));
			exit (-1);
		}

		if (keycode < 0)
			print_error ("parse", fname);

		setup.keytab[key] = keycode;
	}
	
	munmap (buf, len);
	close (fd);

	write (1, &setup, 4 + 256 * sizeof(__u16));

	return 0;
}