﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	mlocked
13386	No Signal/Noise and Signal Strength with MyGica T230 DVB tuner	Klaas de Waal	Klaas de Waal	"A channelscan with mythtv-setup of the DVB-T signal with a new Geniatech/Mygica T230 tuner does work, but the ""Scanning"" screen only shows the ""Scan Progress""; the ""Signal/Noise"" and the ""Signal Strength"" are zero.\\

The mythtv-setup log shows that also the bit error rate and the uncorrected block count are missing:

{{{
2019-01-22 16:19:21.192483 W  DVBSigMon[15](/dev/dvb/adapter2/frontend0): Cannot measure Signal Strength
                        eno: Unknown error 524 (524)
2019-01-22 16:19:21.192514 E  DVBChan[15](/dev/dvb/adapter2/frontend0): Getting Frontend signal/noise ratio failed.
                        eno: Unknown error 524 (524)
2019-01-22 16:19:21.192530 W  DVBSigMon[15](/dev/dvb/adapter2/frontend0): Cannot measure S/N
                        eno: Unknown error 524 (524)
2019-01-22 16:19:21.192550 E  DVBChan[15](/dev/dvb/adapter2/frontend0): Getting Frontend signal error rate failed.
                        eno: Unknown error 524 (524)
2019-01-22 16:19:21.192564 W  DVBSigMon[15](/dev/dvb/adapter2/frontend0): Cannot measure Bit Error Rate
                        eno: Unknown error 524 (524)
2019-01-22 16:19:21.192584 E  DVBChan[15](/dev/dvb/adapter2/frontend0): Getting Frontend uncorrected block count failed.
                        eno: Unknown error 524 (524)
2019-01-22 16:19:21.192599 W  DVBSigMon[15](/dev/dvb/adapter2/frontend0): Cannot count Uncorrected Blocks
                        eno: Unknown error 524 (524)

}}}

The code in dvbchannel.cpp tries to retrieve the values for signal strength etc. first with a DVBv3 ioctl call (DVBv3) and if that fails with the EOPNOTSUPP error code then a DVBv5 call is used.\\

This is implemented in MythTV by mspieth on October 7, 2017 as part of ticket #12638:
https://github.com/MythTV/mythtv/commit/55e1cac4bd249ec2e9463684a50121661af60417#diff-0f5669f105cc36674c93770abb47cac4\\

However, on December 12, 2017 the EOPNOTSUPP error code is changed into ENOTSUPP as found in the Linux kernel:\\
https://github.com/torvalds/linux/commit/330dada5957e3ca0c8811b14c45e3ac42c694651#diff-a1c3a3d76c7728571c3d629e052b8f1e
\\

The solution is to add a test on the ENOTSUPP error code; the test on EOPNOTSUPP must stay there for users who run older Linux kernels.\\
N.B. A complication is that the ENOTSUPP error code is not defined in any include file in ""userland"". 
Therefore, the attached patch locally defines ENOTSUPP to 524.
\\

An alternative fix could be to remove the test on ioctl error code completely and always try the DVBv5 call if the DVBv3 call fails, not only if the specific error code is given.
\\

The patch contains two additional minor fixes:
- initialization of ""fe_status_t status"" variable in function wait_for_backend; this is already done like this in function HasLock.
- millisecond to seconds+microseconds conversion in function wait_for_backend around line 1500. The original code is correct for time values up to 999 milliseconds but not for larger values.
\\

Test configuration:
- Linux Fedora 29, kernel 4.20.3-200.fc29.x86_64
- Tuner MyGica DVB-T2 HDTV USB Stick T230
- MythTV master.
- Scan of DVB-T signal Digitenne in Europe/The Netherlands
"	Patch - Bug Fix	closed	minor	30.1	MythTV - DVB	Master Head	medium	Fixed	DVBv5 channelscan	Stuart Auchterlonie mspieth	0
