Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linux-dvb] How to determine the frequency of a channel
- To: DVB-ML <linux-dvb@linuxtv.org>
- Subject: [linux-dvb] How to determine the frequency of a channel
- From: Martin Neuditschko <yosuke.tomoe@gmx.net>
- Date: Sun, 28 Jul 2002 14:21:48 +0200
- Content-disposition: inline
- Content-type: text/plain; charset=us-ascii
- Mail-followup-to: DVB-ML <linux-dvb@linuxtv.org>
- Sender: linux-dvb-bounce@linuxtv.org
- User-agent: Mutt/1.4i
Hi!
I tried to determine the best frequency for a channel.
So I am using Newstruct drivers (02.07.02) and changed czap.c so that
the frequency from the channels file +/-250000 Hz is used (in 100 Hz steps)
and that each of this frequencies is tried to be set for 20 times (see
check_frontend):
-----------------------------------------
|static
|int check_frontend (void)
|{
| int fd, i=0;
| FrontendStatus status;
| uint16_t snr, signal;
| uint32_t ber, uncorrected_blocks;
|
| if ((fd = open (FRONTEND_DEV, O_RDWR)) < 0) {
| fprintf (stderr, "failed opening '%s' !!!\n", FRONTEND_DEV);
| return -1;
| }
|
| do {
| ioctl (fd, FE_READ_STATUS, &status);
| ioctl (fd, FE_READ_SIGNAL_STRENGTH, &signal);
| ioctl (fd, FE_READ_SNR, &snr);
| ioctl (fd, FE_READ_BER, &ber);
| ioctl (fd, FE_READ_UNCORRECTED_BLOCKS, &uncorrected_blocks);
|
| printf ("status %02x | signal %04x | snr %04x | ber %08x | unc %08x | ",
| status, signal, snr, ber, uncorrected_blocks);
| if (status & FE_HAS_LOCK)
| printf ("FE_HAS_LOCK");
| printf ("\n");
| usleep (1000000);
| /* } while (1 || !(status & FE_HAS_LOCK)); */
| i++;
| } while (i<20);
|
| close (fd);
| return 0;
|}
|
|int main (int argc, char **argv)
|{
| struct dvb_frontend_parameters frontend;
| int vpid, apid;
| unsigned int freq, f;
|
| if (argc != 2) {
| printf ("\n\tusage: %s <channel name>\n\n", argv[0]);
| exit (-1);
| }
|
| memset (&frontend, 0, sizeof(struct dvb_frontend_parameters));
|
| if (parse (CHANNEL_FILE, argv[1], &frontend, &vpid, &apid))
| return -1;
|
| freq = frontend.frequency;
| for (f = freq - 250000; f <= freq + 250000; f += 100)
| {
| frontend.frequency = f;
| printf( "Frequency: %u\n", frontend.frequency );
| setup_frontend (&frontend);
| setup_demux (vpid, apid);
|
| check_frontend ();
| }
| return 1;
|}
-----------------------------------------
But the result is not which I wanted because the "FE_HAS_LOCK"
appears very often but there is no audio or video.
Here a small example:
Frequency: 377758000
status 00 | signal 9090 | snr d6d6 | ber 00012eec | unc 0000007f |
status 1f | signal ffff | snr eded | ber 00012eec | unc 0000007f | FE_HAS_LOCK
status 1f | signal ffff | snr ecec | ber 0002c3d8 | unc 00000000 | FE_HAS_LOCK
status 1f | signal ffff | snr eded | ber 0002c3d8 | unc 00000003 | FE_HAS_LOCK
status 1f | signal ffff | snr ebeb | ber 00013335 | unc 00000000 | FE_HAS_LOCK
status 1f | signal ffff | snr ecec | ber 00013451 | unc 00000002 | FE_HAS_LOCK
status 1f | signal ffff | snr eded | ber 00013451 | unc 00000000 | FE_HAS_LOCK
status 1f | signal ffff | snr ecec | ber 00013057 | unc 00000000 | FE_HAS_LOCK
status 1f | signal ffff | snr ecec | ber 00013057 | unc 00000004 | FE_HAS_LOCK
status 1f | signal ffff | snr eeee | ber 00012f50 | unc 00000002 | FE_HAS_LOCK
status 1f | signal ffff | snr ebeb | ber 0001316d | unc 00000001 | FE_HAS_LOCK
status 1f | signal ffff | snr ecec | ber 0001316d | unc 00000001 | FE_HAS_LOCK
status 1f | signal ffff | snr ecec | ber 0001345f | unc 00000000 | FE_HAS_LOCK
status 1f | signal ffff | snr ecec | ber 0001345f | unc 00000001 | FE_HAS_LOCK
status 1f | signal ffff | snr ecec | ber 0001318e | unc 00000000 | FE_HAS_LOCK
status 1f | signal ffff | snr ebeb | ber 0001332a | unc 00000000 | FE_HAS_LOCK
How else could I try to determine the best frequency?
Has someone an idea?
best regards
Martin Neuditschko
--
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.
Home |
Main Index |
Thread Index