Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linux-dvb] How to set up diseqc properly?
Hi!
I am trying to set up a diseqc switch with the function attached at the
end of this mail.
With this function, switching to position 0 (that is, commands f0..f3)
work as expected. But the other three positions show strange behavior:
- diseqc(1,x,y) switches to position 1, but with mini_b instead of the
command f4..f7 (as schown with a diseqc-tester). The debug output prints:
sat:1 pol:H 22kHz:on cmd:f4
So it looks like the command (f4) is completely ignored.
- diseqc(2,x,y) behaves exactly like diseqc(0,x,y). That is, it switches
to position 0 instead of position 2 although the debug output gives:
sat:1 pol:H 22kHz:on cmd:f8
Again, the command (f8) seems to be ignored.
- diseqc(3,x,y) behaves exactly like diseqc(1,x,y), switching to position 1
via mini_b
sat:1 pol:H 22kHz:on cmd:fc
Again, the command (fc) seems to be ignored.
Aby ideas what I am doing wrong here?
Here is the function:
static int diseqc (int sat, int pol, int hi_band)
{
struct timespec ts={0, 15000000};
struct dvb_diseqc_master_cmd cmd={{0xe0, 0x10, 0x38, 0xf0, 0x00, 0x00}, 4};
fe_sec_voltage_t p = pol=='H' ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13;
fe_sec_tone_mode_t t = hi_band ? SEC_TONE_ON : SEC_TONE_OFF;
fe_sec_mini_cmd_t b = sat & 1 ? SEC_MINI_B : SEC_MINI_A;
cmd.msg[3] = 0xf0 | (((sat*4) & 0x0f) | (hi_band ? 1 : 0) | (p ? 2 : 0));
printf ("sat:%d pol:%c 22kHz:%s cmd:%x\n",
sat, pol, hi_band?"on":"off", cmd.msg[3]);
if (ioctl(fefd, FE_SET_TONE, SEC_TONE_OFF) == -1) {
perror("FE_SET_TONE failed");
return 0;
}
nanosleep (&ts, NULL);
if (ioctl(fefd, FE_SET_VOLTAGE, p) == -1) {
perror("FE_SET_VOLTAGE failed");
return 0;
}
nanosleep (&ts, NULL);
if (ioctl(fefd, FE_DISEQC_SEND_MASTER_CMD, &cmd) == -1) {
perror("FE_DISEQC_SEND_MASTER_CMD failed");
return 0;
}
nanosleep (&ts, NULL);
if (ioctl(fefd, FE_DISEQC_SEND_BURST, b) == -1) {
perror("FE_DISEQC_SEND_BURST failed");
return 0;
}
nanosleep (&ts, NULL);
if (ioctl(fefd, FE_SET_TONE, t) == -1) {
perror("FE_SET_TONE failed");
return 0;
}
return 1;
}
--
-- Josef Wolf -- jw@raven.inka.de --
Home |
Main Index |
Thread Index