aboutsummaryrefslogtreecommitdiffstats
path: root/util/scan/dvb-t/de-Freiburg
blob: 5066a21d1be528ff94b800dcef1a17ec7a12d4f7 (plain)
1
2
3
4
5
# DVB-T Freiburg M/V
# T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
T 570000000 8MHz 2/3 NONE QAM16 8k 1/4 NONE
T 618000000 8MHz 2/3 NONE QAM16 8k 1/4 NONE
T 722000000 8MHz 2/3 NONE QAM16 8k 1/4 NONE
ace */ .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 */
/*
 * Test sending DiSEqC commands on a SAT frontend.
 *
 * usage: FRONTEND=/dev/dvb/adapterX/frontendX diseqc [test_seq_no]
 */

#include <pthread.h>
#include <time.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/dvb/frontend.h>


struct diseqc_cmd {
	struct dvb_diseqc_master_cmd cmd;
	uint32_t wait;
};


struct diseqc_cmd switch_cmds[] = {
	{ { { 0xe0, 0x10, 0x38, 0xf0, 0x00, 0x00 }, 4 }, 0 },
	{ { { 0xe0, 0x10, 0x38, 0xf2, 0x00, 0x00 }, 4 }, 0 },
	{ { { 0xe0, 0x10, 0x38, 0xf1, 0x00, 0x00 }, 4 }, 0 },
	{ { { 0xe0, 0x10, 0x38, 0xf3, 0x00, 0x00 }, 4 }, 0 },
	{ { { 0xe0, 0x10, 0x38, 0xf4, 0x00, 0x00 }, 4 }, 0 },
	{ { { 0xe0, 0x10, 0x38, 0xf6, 0x00, 0x00 }, 4 }, 0 },
	{ { { 0xe0, 0x10, 0x38, 0xf5, 0x00, 0x00 }, 4 }, 0 },
	{ { { 0xe0, 0x10, 0x38, 0xf7, 0x00, 0x00 }, 4 }, 0 },
	{ { { 0xe0, 0x10, 0x38, 0xf8, 0x00, 0x00 }, 4 }, 0 },
	{ { { 0xe0, 0x10, 0x38, 0xfa, 0x00, 0x00 }, 4 }, 0 },
	{ { { 0xe0, 0x10, 0x38, 0xf9, 0x00, 0x00 }, 4 }, 0 },
	{ { { 0xe0, 0x10, 0x38, 0xfb, 0x00, 0x00 }, 4 }, 0 },
	{ { { 0xe0, 0x10, 0x38, 0xfc, 0x00, 0x00 }, 4 }, 0 },
	{ { { 0xe0, 0x10, 0x38, 0xfe, 0x00, 0x00 }, 4 }, 0 },
	{ { { 0xe0, 0x10, 0x38, 0xfd, 0x00, 0x00 }, 4 }, 0 },
	{ { { 0xe0, 0x10, 0x38, 0xff, 0x00, 0x00 }, 4 }, 0 }
};


/*--------------------------------------------------------------------------*/

static inline
void msleep(uint32_t msec)
{
	struct timespec req = { msec / 1000, 1000000 * (msec % 1000) };

	while (nanosleep(&req, &req))
		;
}


static
void diseqc_send_msg(int fd, fe_sec_voltage_t v, struct diseqc_cmd **cmd,
		     fe_sec_tone_mode_t t, fe_sec_mini_cmd_t b)
{
	ioctl(fd, FE_SET_TONE, SEC_TONE_OFF);
	ioctl(fd, FE_SET_VOLTAGE, v);

	msleep(15);
	while (*cmd) {
		printf("msg: %02x %02x %02x %02x %02x %02x\n",
		       (*cmd)->cmd.msg[0], (*cmd)->cmd.msg[1],
		       (*cmd)->cmd.msg[2], (*cmd)->cmd.msg[3],
		       (*cmd)->cmd.msg[4], (*cmd)->cmd.msg[5]);

		ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &(*cmd)->cmd);
		msleep((*cmd)->wait);
		cmd++;
	}

	printf("%s: ", __FUNCTION__);

	printf(" %s ", v == SEC_VOLTAGE_13 ? "SEC_VOLTAGE_13" :
	       v == SEC_VOLTAGE_18 ? "SEC_VOLTAGE_18" : "???");

	printf(" %s ", b == SEC_MINI_A ? "SEC_MINI_A" :
	       b == SEC_MINI_B ? "SEC_MINI_B" : "???");

	printf(" %s\n", t == SEC_TONE_ON ? "SEC_TONE_ON" :
	       t == SEC_TONE_OFF ? "SEC_TONE_OFF" : "???");

	msleep(15);
	ioctl(fd, FE_DISEQC_SEND_BURST, b);

	msleep(15);
	ioctl(fd, FE_SET_TONE, t);
}


int main(int argc, char **argv)
{
	struct diseqc_cmd *cmd[2] = { NULL, NULL };
	char *fedev = "/dev/dvb/adapter0/frontend0";
	int fd;

	if (getenv("FRONTEND"))
		fedev = getenv("FRONTEND");

	printf("diseqc test: using '%s'\n", fedev);

	if ((fd = open(fedev, O_RDWR)) < 0) {
		perror("open");
		return -1;
	}

	if (argc > 1) {
		int i = atol(argv[1]);
		cmd[0] = &switch_cmds[i];
		diseqc_send_msg(fd,
				i % 2 ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13,
				cmd,
				(i/2) % 2 ? SEC_TONE_ON : SEC_TONE_OFF,
				(i/4) % 2 ? SEC_MINI_B : SEC_MINI_A);
	} else {
		unsigned int j;

		for (j=0; j<sizeof(switch_cmds)/sizeof(struct diseqc_cmd); j++)
		{
			cmd[0] = &switch_cmds[j];
			diseqc_send_msg(fd,
					j % 2 ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13,
					cmd,
					(j/2) % 2 ? SEC_TONE_ON : SEC_TONE_OFF,
					(j/4) % 2 ? SEC_MINI_B : SEC_MINI_A);
			msleep (1000);
		}
	}

	close(fd);

	return 0;
}