Project

General

Profile

DTV_CLEAR failed error on 64-bit systems

Added by virtual dj over 4 years ago

Hi to all, sorry for the long post but I've a lot of friends on the QNAP forum owning an x86_64 NAS that asked for my help about the TVHeadend version that I compile as QPKG. But I cannot help them because I don't know how to do that, so I'm asking here.

I've compiled 2 versions of TVHeadend, in this case the build 3.9.2293~g74c563f, one for ARM and another for x86 (32 bit); I use two Debian Squeeze VMs to build them with these parameters:

./configure --disable-avahi --enable-bundle --disable-libav --disable-dbus_1 --release

People running ARM do not have any issue; the same is for people running the Intel version on x86 NASes (32 bit). The QNAP kernel version is v3.4.6.
Unfortunately, people running the same binary on x86_64 are not able to tune any frequency and instead get this error continuosly:

2015-01-08 19:31:31.117 mpegts: 578MHz in Durris - tuning on DiBcom 7000PC : DVB-T #0
2015-01-08 19:31:31.117 linuxdvb: DiBcom 7000PC : DVB-T #0 - DTV_CLEAR failed [e=Inappropriate ioctl for device]

I said "the same binary" because actually the QNAPs with 64-bit do not have the whole libraries and cannot run the application if I compile TVHeadend in 64-bit mode (they get permission denied errors even though the permissions are correct).
So I actually load the 64-bit kernel modules and then run TVHeadend 32-bit.

Another thing to say is that this behaviour happens when using any tuner that loads the dvb-core.ko module I think, because it happens even with the HDHomerun which uses only dvb-core.ko, dvb_hdhomerun.ko, dvb_hdhomerun_core.ko and dvb_hdhomerun_fe.ko.
Those on 64-bit that have the Sundtek tuner (which doesn't use any kernel module) do not have this error and TVHeadend works perfectly.

This, at first, let me think it was a kernel module issue, but it shouldn't, because we've tried running some older TVHeadend versions (always 32-bit) that I compiled in the past with the same kernel modules loaded.

For example, the version 3.9.422~gc84bc2b still fails, but with a different error (a generic failed to start):

2015-01-12 19:27:41.000 [   INFO] mpegts: 538000 - starting for 'initscan' (weight 2)
2015-01-12 19:27:41.000 [   INFO] mpegts: 538000 - tuning on DiBcom 3000MC/P : DVB-T #0
2015-01-12 19:27:41.000 [  DEBUG] linuxdvb: DiBcom 3000MC/P : DVB-T #0 - starting 538000
2015-01-12 19:27:41.000 [WARNING] mpegts: 538000 - failed to start, try another

When trying the older version v3.5.126~g8c5f9af, again with the same modules, it works correctly:
Jan 12 18:51:16.688 [  DEBUG] dvb: /dev/dvb/adapter0 opened frontend /dev/dvb/adapter0/frontend0
Jan 12 18:51:16.688 [  DEBUG] dvb: "/dev/dvb/adapter0" tuning to "CESKE RADIOKOMUNIKACE: 626,000 kHz" (Initial autoscan)
Jan 12 18:51:17.051 [  DEBUG] dvb: /dev/dvb/adapter0 started dvr thread
Jan 12 18:51:17.053 [  DEBUG] viasat_baltic: install table handlers
Jan 12 18:51:17.053 [  DEBUG] uk_freesat: install table handlers
Jan 12 18:51:17.053 [  DEBUG] eit: install table handlers
Jan 12 18:51:17.070 [  DEBUG] eit: begin processing
Jan 12 18:51:17.568 [  DEBUG] PSI: Service "DiBcom 3000MC/P/CESKE RADIOKOMUNIKACE: 626,000 kHz/NOVA" PMT (version 12) updated
Jan 12 18:51:17.720 [  DEBUG] PSI: Service "DiBcom 3000MC/P/CESKE RADIOKOMUNIKACE: 626,000 kHz/Prima" PMT (version 19) updated
Jan 12 18:51:17.942 [  DEBUG] PSI: Service "DiBcom 3000MC/P/CESKE RADIOKOMUNIKACE: 626,000 kHz/BARRANDOV TV" PMT (version 5) updated
Jan 12 18:51:18.002 [  DEBUG] dvb: "CESKE RADIOKOMUNIKACE: 626,000 kHz" on adapter "DiBcom 3000MC/P", status changed to Bursty FEC
Jan 12 18:51:19.001 [  DEBUG] dvb: DiBcom 3000MC/P: FE_READ_UNCORRECTED_BLOCKS returns delta updates (delta=-82)
Jan 12 18:51:27.047 [  DEBUG] eit: processing complete
Jan 12 18:51:28.002 [  DEBUG] dvb: "CESKE RADIOKOMUNIKACE: 626,000 kHz" on adapter "DiBcom 3000MC/P", status changed to OK

My gcc version on the VM is 4.4.5 and, to make the binary run on the QNAP which has 4.2.1, I've copied the libc libraries and run TVHeadend with the ld-linux trick (for the v3.9.2293 version, while v3.9.422 and v3.5.126 where run directly as the gcc version was enough to compile them).

I've also tried to compare the two versions (non working v3.9.422 and working v3.5.125) using GitHub:

https://github.com/tvheadend/tvheadend/compare/8c5f9af...c84bc2b?diff=split&name=c84bc2b

... but there are a lot of differences and I'm not able to isolate the problem, probably becase I'm not very comfortable with C programming.

Finally, /usr/include/linux/dvb/version.h on the VM that I use for compiling is:

#ifndef _DVBVERSION_H_
#define _DVBVERSION_H_

#define DVB_API_VERSION 5
#define DVB_API_VERSION_MINOR 1

#endif /*_DVBVERSION_H_*/

Please, anyone, if you have some suggestions on what to try please post.
By the way, on my 32-bit NAS all is working correctly, so I'll need to submit the test to the QNAP forum community.


Replies (2)

RE: DTV_CLEAR failed error on 64-bit systems - Added by usuario 73862872 over 4 years ago

Thanks for posting here virtualdj, I'm "usuario" from qnap forum. As so many people are having this problem hopefully we'll find answers from someone in here.

RE: DTV_CLEAR failed error on 64-bit systems - Added by virtual dj over 4 years ago

A small update on this question. The problem seems located in this section:
https://github.com/tvheadend/tvheadend/blob/74c563f/src/input/mpegts/linuxdvb/linuxdvb_frontend.c#L1008-L1020

However, for both the working and non-working systems the DVB_API_VERSION >= 5 condition is true.
The offending line that fails is:

((ioctl(lfe->lfe_fe_fd, FE_SET_PROPERTY, &clear_cmdseq)) != 0)

I've tried also to add debugging info on dvb-core.ko and this is what dmesg says on a WORKING system:

dvb_frontend_open
dvb_frontend_start
dvb_frontend_thread
dvb_frontend_ioctl
DVB: initialising adapter 0 frontend 0 (DiBcom 7000PC)...
dvb_frontend_ioctl_properties
dvb_frontend_ioctl_properties() properties.num = 1
dvb_frontend_ioctl_properties() properties.props = bfd82033
dtv_property_dump: tvp.cmd = 0x0000002c undefined
dvb_frontend_ioctl
dvb_frontend_release
dvb_frontend_open
dvb_frontend_start

On the contrary, here's a NON WORKING one:
dvb_frontend_open
dvb_frontend_start
dvb_frontend_thread
DVB: initialising adapter 1 frontend 0 (DiBcom 7000PC)...
dvb_frontend_ioctl (61)
---
dvb_frontend_release
dvb_frontend_open
dvb_frontend_start
dvb_frontend_stop
---
dvb_frontend_thread
DVB: initialising adapter 1 frontend 0 (DiBcom 7000PC)...
dvb_frontend_open
dvb_frontend_start
dvb_frontend_thread
dvb_frontend_ioctl (61)
DVB: initialising adapter 0 frontend 0 (DiBcom 7000PC)...
---
dvb_frontend_release
dvb_frontend_open
dvb_frontend_start
dvb_frontend_stop

Is the dvb_frontend_ioctl (61) the symptom of the error?
I've checked again the sources and I do not see differences between the 32 bit and 64 bit kernel modules. But something has to be there if the latter fail.

    (1-2/2)