aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_switch.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_switch.c')
-rw-r--r--test/test_switch.c106
1 files changed, 53 insertions, 53 deletions
diff --git a/test/test_switch.c b/test/test_switch.c
index 7f80891..b2939ad 100644
--- a/test/test_switch.c
+++ b/test/test_switch.c
@@ -1,4 +1,4 @@
-/*
+/*
* test_switch.c - Test program for new API
*
* Copyright (C) 2001 Ralph Metzler <ralph@convergence.de>
@@ -42,97 +42,97 @@ int fd_demuxv;
int fd_demuxtt;
struct dmx_sct_filter_params sctFilterParams;
-
+
struct secCommand scmd;
struct secCmdSequence scmds;
-struct dmx_pes_filter_params pesFilterParams;
-struct dmx_pes_filter_params pesFilterParamsV;
-struct dmx_pes_filter_params pesFilterParamsA;
-struct dmx_pes_filter_params pesFilterParamsTT;
+struct dmx_pes_filter_params pesFilterParams;
+struct dmx_pes_filter_params pesFilterParamsV;
+struct dmx_pes_filter_params pesFilterParamsA;
+struct dmx_pes_filter_params pesFilterParamsTT;
FrontendParameters frp;
int front_type;
-set_front(void)
+set_front(void)
{
fe_status_t stat = 0;
int i, freq;
uint32_t soff;
-
+
scmds.miniCommand = SEC_MINI_NONE;
scmds.numCommands = 1;
scmds.commands = &scmd;
-
+
soff = frp.u.qpsk.SymbolRate/16000;
if (ioctl(fd_sec, SEC_SEND_SEQUENCE, &scmds) < 0)
perror("setfront sec");
usleep(100000);
-
+
freq = frp.Frequency;
-
+
while(tune_it(&frp));
-}
+}
-set_diseqc_nb(int nr)
+set_diseqc_nb(int nr)
{
scmd.type=0;
scmd.u.diseqc.addr = 0x10;
scmd.u.diseqc.cmd = 0x38;
scmd.u.diseqc.numParams = 1;
- scmd.u.diseqc.params[0] = 0xF0 | ((nr * 4) & 0x0F) |
+ scmd.u.diseqc.params[0] = 0xF0 | ((nr * 4) & 0x0F) |
(scmds.continuousTone == SEC_TONE_ON ? 1 : 0) |
(scmds.voltage==SEC_VOLTAGE_18 ? 2 : 0);
}
-set_ttpid(ushort ttpid)
-{
+set_ttpid(ushort ttpid)
+{
if (ttpid==0 || ttpid==0xffff || ttpid==0x1fff) {
ioctl(fd_demuxtt, DMX_STOP, 0);
return;
}
pesFilterParamsTT.pid = ttpid;
- pesFilterParamsTT.input = DMX_IN_FRONTEND;
- pesFilterParamsTT.output = DMX_OUT_DECODER;
- pesFilterParamsTT.pes_type = DMX_PES_TELETEXT;
+ pesFilterParamsTT.input = DMX_IN_FRONTEND;
+ pesFilterParamsTT.output = DMX_OUT_DECODER;
+ pesFilterParamsTT.pes_type = DMX_PES_TELETEXT;
pesFilterParamsTT.flags = DMX_IMMEDIATE_START;
- if (ioctl(fd_demuxtt, DMX_SET_PES_FILTER,
+ if (ioctl(fd_demuxtt, DMX_SET_PES_FILTER,
&pesFilterParamsTT) < 0) {
printf("PID=%04x\n", ttpid);
perror("set_ttpid");
}
}
-set_vpid(ushort vpid)
-{
+set_vpid(ushort vpid)
+{
if (vpid==0 || vpid==0xffff || vpid==0x1fff) {
ioctl(fd_demuxv, DMX_STOP, 0);
return;
}
pesFilterParamsV.pid = vpid;
- pesFilterParamsV.input = DMX_IN_FRONTEND;
- pesFilterParamsV.output = DMX_OUT_DECODER;
- pesFilterParamsV.pes_type = DMX_PES_VIDEO;
+ pesFilterParamsV.input = DMX_IN_FRONTEND;
+ pesFilterParamsV.output = DMX_OUT_DECODER;
+ pesFilterParamsV.pes_type = DMX_PES_VIDEO;
pesFilterParamsV.flags = DMX_IMMEDIATE_START;
- if (ioctl(fd_demuxv, DMX_SET_PES_FILTER,
+ if (ioctl(fd_demuxv, DMX_SET_PES_FILTER,
&pesFilterParamsV) < 0)
perror("set_vpid");
}
-set_apid(ushort apid)
-{
+set_apid(ushort apid)
+{
if (apid==0 || apid==0xffff || apid==0x1fff) {
ioctl(fd_demuxa, DMX_STOP, apid);
return;
}
pesFilterParamsA.pid = apid;
- pesFilterParamsA.input = DMX_IN_FRONTEND;
- pesFilterParamsA.output = DMX_OUT_DECODER;
- pesFilterParamsA.pes_type = DMX_PES_AUDIO;
+ pesFilterParamsA.input = DMX_IN_FRONTEND;
+ pesFilterParamsA.output = DMX_OUT_DECODER;
+ pesFilterParamsA.pes_type = DMX_PES_AUDIO;
pesFilterParamsA.flags = DMX_IMMEDIATE_START;
- if (ioctl(fd_demuxa, DMX_SET_PES_FILTER,
+ if (ioctl(fd_demuxa, DMX_SET_PES_FILTER,
&pesFilterParamsA) < 0)
perror("set_apid");
}
@@ -156,7 +156,7 @@ int tune_it(FrontendParameters *frp)
if (poll(pfd,1,3000)){
if (pfd[0].revents & POLLIN){
printf("Getting QPSK event\n");
- if ( ioctl(fd_frontend, FE_GET_EVENT, &event)
+ if ( ioctl(fd_frontend, FE_GET_EVENT, &event)
== -EOVERFLOW){
perror("qpsk get event");
@@ -170,7 +170,7 @@ int tune_it(FrontendParameters *frp)
case FE_FAILURE_EV:
printf("failure event\n");
return -1;
-
+
case FE_COMPLETION_EV:
printf("completion event\n");
}
@@ -179,7 +179,7 @@ int tune_it(FrontendParameters *frp)
return 0;
}
-set_tp(uint *freq, int ttk, int pol, uint srate, int dis)
+set_tp(uint *freq, int ttk, int pol, uint srate, int dis)
{
if (*freq < 11700000) {
frp.Frequency = (*freq - 9750000);
@@ -195,22 +195,22 @@ set_tp(uint *freq, int ttk, int pol, uint srate, int dis)
frp.u.qpsk.FEC_inner = 0;
}
-get_front(void)
+get_front(void)
{
set_vpid(0);
set_apid(0);
set_ttpid(0);
- scmds.voltage = SEC_VOLTAGE_18;
+ scmds.voltage = SEC_VOLTAGE_18;
scmds.miniCommand = SEC_MINI_NONE;
scmds.continuousTone = SEC_TONE_OFF;
scmds.numCommands=1;
scmds.commands=&scmd;
-
+
frp.Frequency=(12073000-10600000);
frp.u.qpsk.SymbolRate=25378000;
frp.u.qpsk.FEC_inner=(fe_code_rate_t)5;
-}
-
+}
+
void get_sect(int fd)
{
@@ -219,10 +219,10 @@ void get_sect(int fd)
uint16_t cpid = 0;
uint16_t length;
struct pollfd pfd;
-
+
pfd.fd = fd;
pfd.events = POLLIN;
-
+
while (1){
if (poll(&pfd, 1, 5000) != POLLIN) {
printf("not found\n");
@@ -232,7 +232,7 @@ void get_sect(int fd)
length = (sec[1]& 0x0F)<<8;
length |= (sec[2]& 0xFF);
-
+
for (i= 0; i < length+3; i++) {
printf("0x%02x ",sec[i]);
@@ -248,7 +248,7 @@ int FEReadStatus(int fd, fe_status_t *stat)
{
int ans;
- if ( (ans = ioctl(fd,FE_READ_STATUS,stat) < 0)){
+ if ((ans = ioctl(fd,FE_READ_STATUS,stat)) < 0) {
perror("FE READ STATUS: ");
return -1;
}
@@ -268,7 +268,7 @@ int FEReadStatus(int fd, fe_status_t *stat)
int has_signal()
{
fe_status_t stat;
-
+
FEReadStatus(fd_frontend, &stat);
if (stat & FE_HAS_SIGNAL)
return 1;
@@ -304,7 +304,7 @@ main()
scmds.commands=&scmd;
frp.Frequency = (12073000 - 10600000);
// frp.Frequency = (11975000 - 10600000);
- scmds.continuousTone = SEC_TONE_ON;
+ scmds.continuousTone = SEC_TONE_ON;
frp.u.qpsk.SymbolRate = 25378000;
// frp.u.qpsk.SymbolRate = 27500000;
// frp.u.qpsk.FEC_inner = FEC_AUTO;
@@ -313,7 +313,7 @@ main()
scmd.u.diseqc.addr = 0x10;
scmd.u.diseqc.cmd = 0x38;
scmd.u.diseqc.numParams = 1;
- scmd.u.diseqc.params[0] = 0xF0 | ((3 * 4) & 0x0F) |
+ scmd.u.diseqc.params[0] = 0xF0 | ((3 * 4) & 0x0F) |
(scmds.continuousTone == SEC_TONE_ON ? 1 : 0) |
(scmds.voltage==SEC_VOLTAGE_18 ? 2 : 0);
@@ -324,7 +324,7 @@ main()
/*
- if ((fd_demuxa=open("/dev/ost/demux", O_RDWR|O_NONBLOCK))
+ if ((fd_demuxa=open("/dev/ost/demux", O_RDWR|O_NONBLOCK))
< 0){
perror("DEMUX DEVICE: ");
return -1;
@@ -336,18 +336,18 @@ main()
sctFilterParams.timeout = 0;
sctFilterParams.flags = DMX_IMMEDIATE_START;
- if (ioctl(fd_demuxa, DMX_SET_FILTER, &sctFilterParams) < 0)
+ if (ioctl(fd_demuxa, DMX_SET_FILTER, &sctFilterParams) < 0)
perror("DMX SET FILTER:");
get_sect(fd_demuxa);
*/
pesFilterParamsA.pid = 0x1fff;
- pesFilterParamsA.input = DMX_IN_FRONTEND;
- pesFilterParamsA.output = DMX_OUT_TS_TAP;
- pesFilterParamsA.pes_type = DMX_PES_OTHER;
+ pesFilterParamsA.input = DMX_IN_FRONTEND;
+ pesFilterParamsA.output = DMX_OUT_TS_TAP;
+ pesFilterParamsA.pes_type = DMX_PES_OTHER;
pesFilterParamsA.flags = DMX_IMMEDIATE_START;
- if (ioctl(fd_demuxa, DMX_SET_PES_FILTER,
+ if (ioctl(fd_demuxa, DMX_SET_PES_FILTER,
&pesFilterParamsA) < 0)
perror("set_apid");