Michael Müllner wrote:
Hallo, is there any way to be able to use scan behind Diseqc
1.1(uncommitted switch) ?
Regards
Mike
_______________________________________________
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
Try something like this... (adds a -S argument that enables committed
diseqc switch commands)
diff -r 26a10f1546fc util/scan/diseqc.c
--- a/util/scan/diseqc.c Fri May 19 00:19:13 2006 +0100
+++ b/util/scan/diseqc.c Wed Jun 14 11:03:08 2006 -0400
@@ -6,7 +6,7 @@
#include "diseqc.h"
-struct diseqc_cmd switch_cmds[] = {
+struct diseqc_cmd committed_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 },
@@ -23,6 +23,25 @@ struct diseqc_cmd switch_cmds[] = {
{ { { 0xe0, 0x10, 0x38, 0xfe, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x38, 0xfd, 0x00, 0x00 }, 4 }, 0 },
{ { { 0xe0, 0x10, 0x38, 0xff, 0x00, 0x00 }, 4 }, 0 }
+};
+
+struct diseqc_cmd uncommitted_switch_cmds[] = {
+ { { { 0xe0, 0x10, 0x39, 0xf0, 0x00, 0x00 }, 4 }, 0 },
+ { { { 0xe0, 0x10, 0x39, 0xf1, 0x00, 0x00 }, 4 }, 0 },
+ { { { 0xe0, 0x10, 0x39, 0xf2, 0x00, 0x00 }, 4 }, 0 },
+ { { { 0xe0, 0x10, 0x39, 0xf3, 0x00, 0x00 }, 4 }, 0 },
+ { { { 0xe0, 0x10, 0x39, 0xf4, 0x00, 0x00 }, 4 }, 0 },
+ { { { 0xe0, 0x10, 0x39, 0xf5, 0x00, 0x00 }, 4 }, 0 },
+ { { { 0xe0, 0x10, 0x39, 0xf6, 0x00, 0x00 }, 4 }, 0 },
+ { { { 0xe0, 0x10, 0x39, 0xf7, 0x00, 0x00 }, 4 }, 0 },
+ { { { 0xe0, 0x10, 0x39, 0xf8, 0x00, 0x00 }, 4 }, 0 },
+ { { { 0xe0, 0x10, 0x39, 0xf9, 0x00, 0x00 }, 4 }, 0 },
+ { { { 0xe0, 0x10, 0x39, 0xfa, 0x00, 0x00 }, 4 }, 0 },
+ { { { 0xe0, 0x10, 0x39, 0xfb, 0x00, 0x00 }, 4 }, 0 },
+ { { { 0xe0, 0x10, 0x39, 0xfc, 0x00, 0x00 }, 4 }, 0 },
+ { { { 0xe0, 0x10, 0x39, 0xfd, 0x00, 0x00 }, 4 }, 0 },
+ { { { 0xe0, 0x10, 0x39, 0xfe, 0x00, 0x00 }, 4 }, 0 },
+ { { { 0xe0, 0x10, 0x39, 0xff, 0x00, 0x00 }, 4 }, 0 }
};
@@ -85,24 +104,37 @@ int diseqc_send_msg (int fd, fe_sec_volt
}
-int setup_switch (int frontend_fd, int switch_pos, int voltage_18, int hiband)
+int setup_switch (int frontend_fd, int switch_pos, int voltage_18, int hiband, int uncommitted)
{
struct diseqc_cmd *cmd[2] = { NULL, NULL };
- int i = 4 * switch_pos + 2 * hiband + (voltage_18 ? 1 : 0);
+ if(uncommitted)
+ {
+ int i = switch_pos;
- verbose("DiSEqC: switch pos %i, %sV, %sband (index %d)\n",
- switch_pos, voltage_18 ? "18" : "13", hiband ? "hi" : "lo", i);
+ verbose("DiSEqC: uncommitted switch pos %i\n", switch_pos);
+ if (i < 0 || i >= (int) (sizeof(uncommitted_switch_cmds)/sizeof(struct diseqc_cmd)))
+ return -EINVAL;
- if (i < 0 || i >= (int) (sizeof(switch_cmds)/sizeof(struct diseqc_cmd)))
- return -EINVAL;
+ cmd[0] = &uncommitted_switch_cmds[i];
+ }
+ else
+ {
+ int i = 4 * switch_pos + 2 * hiband + (voltage_18 ? 1 : 0);
- cmd[0] = &switch_cmds[i];
+ verbose("DiSEqC: switch pos %i, %sV, %sband (index %d)\n",
+ switch_pos, voltage_18 ? "18" : "13", hiband ? "hi" : "lo", i);
+
+ if (i < 0 || i >= (int) (sizeof(committed_switch_cmds)/sizeof(struct diseqc_cmd)))
+ return -EINVAL;
+
+ cmd[0] = &committed_switch_cmds[i];
+ }
return diseqc_send_msg (frontend_fd,
- i % 2 ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13,
+ voltage_18 ? 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);
+ hiband ? SEC_TONE_ON : SEC_TONE_OFF,
+ switch_pos % 2 ? SEC_MINI_B : SEC_MINI_A);
}
diff -r 26a10f1546fc util/scan/diseqc.h
--- a/util/scan/diseqc.h Fri May 19 00:19:13 2006 +0100
+++ b/util/scan/diseqc.h Wed Jun 14 11:03:08 2006 -0400
@@ -18,7 +18,7 @@ extern int diseqc_send_msg (int fd, fe_s
/**
* set up the switch to position/voltage/tone
*/
-extern int setup_switch (int frontend_fd, int switch_pos, int voltage_18, int freq);
+extern int setup_switch (int frontend_fd, int switch_pos, int voltage_18, int freq, int uncommitted);
#endif
diff -r 26a10f1546fc util/scan/scan.c
--- a/util/scan/scan.c Fri May 19 00:19:13 2006 +0100
+++ b/util/scan/scan.c Wed Jun 14 11:03:08 2006 -0400
@@ -1439,6 +1439,7 @@ static int mem_is_zero (const void *mem,
static int switch_pos = 0;
+static int uncommitted_switch = 0;
static int __tune_to_transponder (int frontend_fd, struct transponder *t)
{
@@ -1471,7 +1472,8 @@ static int __tune_to_transponder (int fr
setup_switch (frontend_fd,
switch_pos,
t->polarisation == POLARISATION_VERTICAL ? 0 : 1,
- hiband);
+ hiband,
+ uncommitted_switch);
usleep(50000);
if (hiband)
p.frequency = abs(p.frequency - lnb_type.high_val);
@@ -2061,6 +2063,7 @@ static const char *usage = "\n"
" -f N use DVB /dev/dvb/adapter?/frontendN\n"
" -d N use DVB /dev/dvb/adapter?/demuxN\n"
" -s N use DiSEqC switch position N (DVB-S only)\n"
+ " -S use DiSEqC uncommitted switch (DVB-S only)\n"
" -i N spectral inversion setting (0: off, 1: on, 2: auto [default])\n"
" -n evaluate NIT-other for full network scan (slow!)\n"
" -5 multiply all filter timeouts by factor 5\n"
@@ -2129,7 +2132,7 @@ int main (int argc, char **argv)
/* start with default lnb type */
lnb_type = *lnb_enum(0);
- while ((opt = getopt(argc, argv, "5cnpa:f:d:s:o:x:e:t:i:l:vquPA:U")) != -1) {
+ while ((opt = getopt(argc, argv, "5cnpa:f:d:Ss:o:x:e:t:i:l:vquPA:U")) != -1) {
switch (opt) {
case 'a':
adapter = strtoul(optarg, NULL, 0);
@@ -2153,6 +2156,9 @@ int main (int argc, char **argv)
break;
case 's':
switch_pos = strtoul(optarg, NULL, 0);
+ break;
+ case 'S':
+ uncommitted_switch = 1;
break;
case 'o':
if (strcmp(optarg, "zap") == 0) output_format = OUTPUT_ZAP;
_______________________________________________
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb