aboutsummaryrefslogtreecommitdiffstats
path: root/dvb-s/ST1_C-80.0E
blob: d60a39eacabf9f791fc73f6d0fab8cb683601838 (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
# ST1 @ 88.0E C-BAND
# Generated by Pietro Casoar
# 1st March 2009

# MPEG-2 & MPEG-4 QPSK (DVBS/S2)
# freq pol sr fec

# GTV Multiplex
[CHANNEL]
	DELIVERY_SYSTEM = DVBS
	FREQUENCY = 3469000
	POLARIZATION = VERTICAL
	SYMBOL_RATE = 30000000
	INNER_FEC = 3/4
	INVERSION = AUTO


# ABTV Multiplex
[CHANNEL]
	DELIVERY_SYSTEM = DVBS
	FREQUENCY = 3521000
	POLARIZATION = HORIZONTAL
	SYMBOL_RATE = 8332000
	INNER_FEC = 5/6
	INVERSION = AUTO


# Videoland Multiplex
[CHANNEL]
	DELIVERY_SYSTEM = DVBS
	FREQUENCY = 3550000
	POLARIZATION = VERTICAL
	SYMBOL_RATE = 30000000
	INNER_FEC = 3/4
	INVERSION = AUTO


# GTV Multiplex
[CHANNEL]
	DELIVERY_SYSTEM = DVBS
	FREQUENCY = 3595000
	POLARIZATION = HORIZONTAL
	SYMBOL_RATE = 30000000
	INNER_FEC = 3/4
	INVERSION = AUTO


# Videoland multiplex
[CHANNEL]
	DELIVERY_SYSTEM = DVBS
	FREQUENCY = 3632000
	POLARIZATION = VERTICAL
	SYMBOL_RATE = 30000000
	INNER_FEC = 3/4
	INVERSION = AUTO


# Chungwa Telecom
[CHANNEL]
	DELIVERY_SYSTEM = DVBS
	FREQUENCY = 3671000
	POLARIZATION = HORIZONTAL
	SYMBOL_RATE = 9256000
	INNER_FEC = 3/4
	INVERSION = AUTO


# NTD TV Asia-Pacific
[CHANNEL]
	DELIVERY_SYSTEM = DVBS
	FREQUENCY = 3689000
	POLARIZATION = HORIZONTAL
	SYMBOL_RATE = 3000000
	INNER_FEC = 3/4
	INVERSION = AUTO
d2 } /* 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 */
/*
	DST-TEST utility
	an implementation for the High Level Common Interface

	Copyright (C) 2004, 2005 Manu Abraham <abraham.manu@gmail.com>

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU Lesser General Public License as
	published by the Free Software Foundation; either version 2.1 of
	the License, 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 Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <stdint.h>

#include <linux/dvb/dmx.h>
#include <linux/dvb/ca.h>
#include <libdvben50221/en50221_app_tags.h>

#define CA_NODE "/dev/dvb/adapter0/ca0"

static int dst_comms(int cafd, uint32_t tag, uint32_t function, struct ca_msg *msg)
{
	if (tag) {
		msg->msg[2] = tag & 0xff;
		msg->msg[1] = (tag & 0xff00) >> 8;
		msg->msg[0] = (tag & 0xff0000) >> 16;

		printf("%s: Msg=[%02x %02x %02x ]\n",__FUNCTION__, msg->msg[0], msg->msg[1], msg->msg[2]);
	}

	if ((ioctl(cafd, function, msg)) < 0) {
		printf("%s: ioctl failed ..\n", __FUNCTION__);
		return -1;
	}

	return 0;
}


static int dst_get_caps(int cafd, struct ca_caps *caps)
{
	if ((ioctl(cafd, CA_GET_CAP, caps)) < 0) {
		printf("%s: ioctl failed ..\n", __FUNCTION__);
		return -1;
	}

	if (caps->slot_num < 1) {
		printf ("No CI Slots found\n");
		return -1;
	}

	printf("APP: Slots=[%d]\n", caps->slot_num);
	printf("APP: Type=[%d]\n", caps->slot_type);
	printf("APP: Descrambler keys=[%d]\n", caps->descr_num);
	printf("APP: Type=[%d]\n", caps->descr_type);

	return 0;
}

static int dst_get_info(int cafd, struct ca_slot_info *info)
{
	if ((ioctl(cafd, CA_GET_SLOT_INFO, info)) < 0) {
		printf("%s: ioctl failed ..\n", __FUNCTION__);
		return -1;
	}
	if (info->num < 1) {
		printf("No CI Slots found\n");
		return -1;
	}
	printf("APP: Number=[%d]\n", info->num);
	printf("APP: Type=[%d]\n", info->type);
	printf("APP: flags=[%d]\n", info->flags);

	if (info->flags == 1)
		printf("APP: CI High level interface\n");
	if (info->flags == 1)
		printf("APP: CA/CI Module Present\n");
	else if (info->flags == 2)
		printf("APP: CA/CI Module Ready\n");
	else if (info->flags == 0)
		printf("APP: No CA/CI Module\n");

	return 0;
}

static int dst_reset(int cafd)
{
	if ((ioctl(cafd, CA_RESET)) < 0) {
		printf("%s: ioctl failed ..\n", __FUNCTION__);
		return -1;
	}

	return 0;
}

static int dst_set_pid(int cafd)
{
	if ((ioctl(cafd, CA_SET_PID)) < 0) {
		printf("%s: ioctl failed ..\n", __FUNCTION__);
		return -1;
	}

	return 0;
}

static int dst_get_descr(int cafd)
{
	if ((ioctl(cafd, CA_GET_DESCR_INFO)) < 0) {
		printf("%s: ioctl failed ..\n", __FUNCTION__);
		return -1;
	}

	return 0;
}

static int dst_set_descr(int cafd)
{
	if ((ioctl(cafd, CA_SET_DESCR)) < 0) {
		printf("%s: ioctl failed ..\n", __FUNCTION__);
		return -1;
	}
	return 0;
}

static int dst_get_app_info(int cafd, struct ca_msg *msg)
{
	uint32_t tag = 0;

	/*	Enquire		*/
	tag = TAG_CA_INFO_ENQUIRY;
	if ((dst_comms(cafd, tag, CA_SEND_MSG, msg)) < 0) {
		printf("%s: Dst communication failed\n", __FUNCTION__);
		return -1;
	}

	/*	Receive		*/
	tag = TAG_CA_INFO;
	if ((dst_comms(cafd, tag, CA_GET_MSG, msg)) < 0) {
		printf("%s: Dst communication failed\n", __FUNCTION__);
		return -1;
	}

	/*	Process		*/
	printf("%s: ================================ CI Module Application Info ======================================\n", __FUNCTION__);
	printf("%s: Application Type=[%d], Application Vendor=[%d], Vendor Code=[%d]\n%s: Application info=[%s]\n",
			__FUNCTION__, msg->msg[7], (msg->msg[8] << 8) | msg->msg[9], (msg->msg[10] << 8) | msg->msg[11], __FUNCTION__,
			((char *) (&msg->msg[12])));
	printf("%s: ==================================================================================================\n", __FUNCTION__);

	return 0;
}

static int dst_session_test(int cafd, struct ca_msg *msg)
{
	msg->msg[0] = 0x91;
	printf("Debugging open session request\n");
	if ((ioctl(cafd, CA_SEND_MSG, msg)) < 0) {
		printf("%s: ioctl failed ..\n", __FUNCTION__);
		return -1;
	}

	return 0;
}


int main(int argc, char *argv[])
{
	int cafd;
	const char *usage = " DST-TEST: Twinhan DST and clones test utility\n"
				" an implementation for the High Level Common Interface\n"
				" Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)\n\n"
				"\t dst_test options:\n"
				"\t -c capabilities\n"
				"\t -i info\n"
				"\t -r reset\n"
				"\t -p pid\n"
				"\t -g get descr\n"
				"\t -s set_descr\n"
				"\t -a app_info\n"
				"\t -t session test\n";


	struct ca_caps *caps;
	caps = (struct ca_caps *) malloc(sizeof (struct ca_caps));

	struct ca_slot_info *info;
	info = (struct ca_slot_info *)malloc (sizeof (struct ca_slot_info));

	struct ca_msg *msg;
	msg = (struct ca_msg *) malloc(sizeof (struct ca_msg));

	if (argc < 2)
		printf("%s\n", usage);

	if (argc > 1) {
		if ((cafd = open(CA_NODE, O_RDONLY)) < 0) {
			printf("%s: Error opening %s\n", __FUNCTION__, CA_NODE);
			return -1;
		}

		switch (getopt(argc, argv, "cirpgsat")) {
			case 'c':
				printf("%s: Capabilities\n", __FUNCTION__);
				dst_get_caps(cafd, caps);
				break;
			case 'i':
				printf("%s: Info\n", __FUNCTION__);
				dst_get_info(cafd, info);
				break;
			case 'r':
				printf("%s: Reset\n", __FUNCTION__);
				dst_reset(cafd);
				break;
			case 'p':
				printf("%s: PID\n", __FUNCTION__);
				dst_set_pid(cafd);
				break;
			case 'g':
				printf("%s: Get Desc\n", __FUNCTION__);
				dst_get_descr(cafd);
				break;
			case 's':
				printf("%s: Set Desc\n", __FUNCTION__);
				dst_set_descr(cafd);
				break;
			case 'a':
				printf("%s: App Info\n", __FUNCTION__);
				dst_get_app_info(cafd, msg);
				break;
			case 't':
				printf("%s: Session test\n", __FUNCTION__);
				dst_session_test(cafd, msg);
				break;

			break;
		}
		close(cafd);
	}
	return 0;
}