Skip to contentSkip to conversation

PCTV 292e weirdness

DISCUSSION Russel Winder 5 participants 9 messages Feb 3, 2016 – Feb 14, 2016 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

I am fairly sure I didn't see this before, but then I am not sure I have a new kernel, libdvbv5 or dvbtools. Also people are bad witnesses. However, if I plug the device in I can either scan with it or tune it, but only once thereafter it goes into "won't do anything so there" mode. For example:

|> dvbv5-zap -c save_channels.conf "BBC NEWS" using demux '/dev/dvb/adapter0/demux0' reading channels from file 'save_channels.conf' service has pid type 05:  7270
tuning to 490000000 Hz
video pid 501
  dvb_set_pesfilter 501
audio pid 502
  dvb_set_pesfilter 502
       (0x00)
Lock   (0x1f) Signal= -51.00dBm C/N= 23.50dB 582 anglides:~/Repositories/Git/Git/Me-TV (git:master) |> dvbv5-zap -c save_channels.conf "BBC NEWS" using demux '/dev/dvb/adapter0/demux0' reading channels from file 'save_channels.conf' service has pid type 05:  7270
tuning to 490000000 Hz
video pid 501
  dvb_set_pesfilter 501
audio pid 502
  dvb_set_pesfilter 502
       (0x00) C/N= 23.50dB
       (0x00) Signal= -67.00dBm C/N= 23.50dB (0x00) Signal= -67.00dBm C/N= 23.50dB (0x00) Signal= -109.00dBm C/N= 23.50dB (0x00) Signal= -109.00dBm C/N= 23.50dB (0x00) Signal= -109.00dBm C/N= 23.50dB (0x00) Signal= -109.00dBm C/N= 23.50dB (0x00) Signal= -109.00dBm C/N= 23.50dB (0x00) Signal= -109.00dBm C/N= 23.50dB (0x00) Signal= -109.00dBm C/N= 23.50dB (0x00) Signal= -109.00dBm C/N= 23.50dB

If I use a PCTV 282e this does not happen. As far as I can tell there has been no change of firmware either, and yet…

Signature · 6 lines
Russel.
==============================================================================
Dr Russel Winder       Director
It'z Interactive Ltd   t: +44 20 7585 2200        voip: sip:[email protected]
41 Buckmaster Road     m: +44 7770 465 077        xmpp: [email protected]
London SW11 1EN, UK    w: www.itzinteractive.com  skype: russel_winder
#1 lore raw

Moikka!

Quoted 41 lines · Russel Winder

I am fairly sure I didn't see this before, but then I am not sure I have a new kernel, libdvbv5 or dvbtools. Also people are bad witnesses. However, if I plug the device in I can either scan with it or tune it, but only once thereafter it goes into "won't do anything so there" mode. For example:

|> dvbv5-zap -c save_channels.conf "BBC NEWS"
using demux '/dev/dvb/adapter0/demux0'
reading channels from file 'save_channels.conf'
service has pid type 05: 7270
tuning to 490000000 Hz
video pid 501
dvb_set_pesfilter 501
audio pid 502
dvb_set_pesfilter 502

        (0x00)

Lock (0x1f) Signal= -51.00dBm C/N= 23.50dB
582 anglides:~/Repositories/Git/Git/Me-TV (git:master) |> dvbv5-zap -c save_channels.conf "BBC NEWS" using demux '/dev/dvb/adapter0/demux0' reading channels from file 'save_channels.conf' service has pid type 05: 7270
tuning to 490000000 Hz
video pid 501
dvb_set_pesfilter 501
audio pid 502
dvb_set_pesfilter 502

        (0x00) C/N= 23.50dB
        (0x00) Signal= -67.00dBm C/N= 23.50dB
        (0x00) Signal= -67.00dBm C/N= 23.50dB
        (0x00) Signal= -109.00dBm C/N= 23.50dB
        (0x00) Signal= -109.00dBm C/N= 23.50dB
        (0x00) Signal= -109.00dBm C/N= 23.50dB
        (0x00) Signal= -109.00dBm C/N= 23.50dB
        (0x00) Signal= -109.00dBm C/N= 23.50dB
        (0x00) Signal= -109.00dBm C/N= 23.50dB
        (0x00) Signal= -109.00dBm C/N= 23.50dB
        (0x00) Signal= -109.00dBm C/N= 23.50dB
Quoted 2 lines

If I use a PCTV 282e this does not happen. As far as I can tell there has been no change of firmware either, and yet…

Are you using DVB-T, T2 or C? I quickly tested T and T2 with dvbv5-zap and it worked (kernel media 4.5.0-rc1+).

PCTV 282e seems to be dibcom based DVB-T only device, so you are using DVB-T?

regards
Antti

Signature · 1 line
http://palosaari.fi/
#2 lore raw

On Thu, 2016-02-04 at 18:14 +0200, Antti Palosaari wrote:
[…]

Quoted 4 lines

Are you using DVB-T, T2 or C? I quickly tested T and T2 with dvbv5- zap
and it worked (kernel media 4.5.0-rc1+).

Definitely T and T2. I had been assuming dvbv5-zap switched mode based on the entry in the virtual channel file. In this case "BBC NEWS" is in a T multiplex.

Quoted 3 lines

PCTV 282e seems to be dibcom based DVB-T only device, so you are using
DVB-T?

Yes, 282e is T only, ditto Terratec XXS. I haven't been able to get anything working with WinTVSoloHD or WinTVdualHD as yet.

Signature · 6 lines
Russel.
==============================================================================
Dr Russel Winder       Director
It'z Interactive Ltd   t: +44 20 7585 2200        voip: sip:[email protected]
41 Buckmaster Road     m: +44 7770 465 077        xmpp: [email protected]
London SW11 1EN, UK    w: www.itzinteractive.com  skype: russel_winder
#3 lore raw

(sent email again since I managed to reply only to Russel)

I have the same issue - haven't had time to look into it much.

the problem is that si2157 & si2168 doesn't resume properly from suspend.

I have attached 2 patches that disable suspend.

What i have found out:
I can resume the si2157 from suspend by replacing "goto warm" with "goto skip_fw_download" in si2157_init()

I can 'resume' the si2168 from suspend if I set "dev->fw_loaded = 0" in si2168_sleep()

Rune

Quoted 11 lines · Russel Winder

On Thu, 2016-02-04 at 18:14 +0200, Antti Palosaari wrote:
[…]

Quoted 4 lines

Are you using DVB-T, T2 or C? I quickly tested T and T2 with dvbv5- zap
and it worked (kernel media 4.5.0-rc1+).

Definitely T and T2. I had been assuming dvbv5-zap switched mode based on the entry in the virtual channel file. In this case "BBC NEWS" is in a T multiplex.

Quoted 7 lines
Quoted 3 lines

PCTV 282e seems to be dibcom based DVB-T only device, so you are using
DVB-T?

Yes, 282e is T only, ditto Terratec XXS. I haven't been able to get anything working with WinTVSoloHD or WinTVdualHD as yet.

media/tuners/si2157.c renamed from ../rtfm/linux/drivers/media/tuners/si2157.c +2 -0
@@ -235,6 +235,7 @@
 	/* stop statistics polling */
 	cancel_delayed_work_sync(&dev->stat_work);
 
+#if 0
 	/* standby */
 	memcpy(cmd.args, "\x16\x00", 2);
 	cmd.wlen = 2;
@@ -242,6 +243,7 @@
 	ret = si2157_cmd_execute(client, &cmd);
 	if (ret)
 		goto err;
+#endif
 
 	return 0;
 err:
media/dvb-frontends/si2168.c renamed from ../rtfm/linux/drivers/media/dvb-frontends/si2168.c +4 -2
@@ -413,6 +413,7 @@
 
 	if (dev->fw_loaded) {
 		/* resume */
+#if 0
 		memcpy(cmd.args, "\xc0\x06\x08\x0f\x00\x20\x21\x01", 8);
 		cmd.wlen = 8;
 		cmd.rlen = 1;
@@ -426,7 +427,7 @@
 		ret = si2168_cmd_execute(client, &cmd);
 		if (ret)
 			goto err;
-
+#endif
 		goto warm;
 	}
 
@@ -589,13 +590,14 @@
 
 	dev->active = false;
 
+#if 0
 	memcpy(cmd.args, "\x13", 1);
 	cmd.wlen = 1;
 	cmd.rlen = 0;
 	ret = si2168_cmd_execute(client, &cmd);
 	if (ret)
 		goto err;
-
+#endif
 	return 0;
 err:
 	dev_dbg(&client->dev, "failed=%d\n", ret);
#4 lore raw

This is probably the problems i have seen.
my usb based card also have a si2168.

since i don't have any good physical machine i used a vm (kvm) and attached the usb device there. this works best if the device is in cold state, if driver finds it in warm state things dont work very well.

but at the moment i also got another issue with the last round of updates to media_build.
a few weeks ago modueles was loading properly and earlier in the week when i tested the modules dont load at all and errors during loading. can test again and post output of dmesg
this is a new issue.

kernel modules from a few weeks ago loads but tuning only works once after module load. then there is no signal at all and it doesnt lock on to the signa.

Quoted 38 lines · Rune Petersen

(sent email again since I managed to reply only to Russel)

I have the same issue - haven't had time to look into it much.

the problem is that si2157 & si2168 doesn't resume properly from suspend.

I have attached 2 patches that disable suspend.

What i have found out:
I can resume the si2157 from suspend by replacing "goto warm" with "goto skip_fw_download" in si2157_init()

I can 'resume' the si2168 from suspend if I set "dev->fw_loaded = 0" in si2168_sleep()

Rune

Quoted 18 lines · Russel Winder

On Thu, 2016-02-04 at 18:14 +0200, Antti Palosaari wrote:
[…]

Quoted 4 lines

Are you using DVB-T, T2 or C? I quickly tested T and T2 with dvbv5- zap
and it worked (kernel media 4.5.0-rc1+).

Definitely T and T2. I had been assuming dvbv5-zap switched mode based on the entry in the virtual channel file. In this case "BBC NEWS" is in a T multiplex.

Quoted 3 lines

PCTV 282e seems to be dibcom based DVB-T only device, so you are using
DVB-T?

Yes, 282e is T only, ditto Terratec XXS. I haven't been able to get anything working with WinTVSoloHD or WinTVdualHD as yet.

#5 lore raw
In reply to Rune Petersen

Moikka!
Sounds like device is loosing warm up power during suspend. On USB there is two callbacks to resume - resume() and reset_resume(). reset_resume() is called when power is lost and on normal case where power has not lost resume() is called.

I am not sure what kind of info there is available on I2C power-management - but it is one thing to check if there is also that same info available.

On power lost chip is reset to default - all registers and firmware also is lost. You have to catch that somehow. If I2C power management cannot provide that info you could use knowledge registers are set to some default value and make decision based of that.

regards
Antti

Quoted 39 lines · Rune Petersen

(sent email again since I managed to reply only to Russel)

I have the same issue - haven't had time to look into it much.

the problem is that si2157 & si2168 doesn't resume properly from suspend.

I have attached 2 patches that disable suspend.

What i have found out:
I can resume the si2157 from suspend by replacing "goto warm" with "goto skip_fw_download" in si2157_init()

I can 'resume' the si2168 from suspend if I set "dev->fw_loaded = 0" in si2168_sleep()

Rune

Quoted 18 lines · Russel Winder

On Thu, 2016-02-04 at 18:14 +0200, Antti Palosaari wrote:
[…]

Quoted 4 lines

Are you using DVB-T, T2 or C? I quickly tested T and T2 with dvbv5- zap
and it worked (kernel media 4.5.0-rc1+).

Definitely T and T2. I had been assuming dvbv5-zap switched mode based on the entry in the virtual channel file. In this case "BBC NEWS" is in a T multiplex.

Quoted 3 lines

PCTV 282e seems to be dibcom based DVB-T only device, so you are using
DVB-T?

Yes, 282e is T only, ditto Terratec XXS. I haven't been able to get anything working with WinTVSoloHD or WinTVdualHD as yet.

Signature · 1 line
http://palosaari.fi/
#6 lore raw
In reply to Rune Petersen
Quoted 9 lines · Rune Petersen

(sent email again since I managed to reply only to Russel)

I have the same issue - haven't had time to look into it much.

the problem is that si2157 & si2168 doesn't resume properly from suspend.

I have attached 2 patches that disable suspend.

Quoted 8 lines

What i have found out:
I can resume the si2157 from suspend by replacing "goto warm" with "goto
skip_fw_download" in si2157_init()

I can 'resume' the si2168 from suspend if I set "dev->fw_loaded = 0" in
si2168_sleep()

Is there a "building and 'installing' drivers such as this from source" instruction sheet somewhere?

Is there a repository of the driver code and it's feature branches that I could clone to work from?

I am entirely happy to try experimenting as long as I do not have to start building custom kernels.

Signature · 5 lines
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:[email protected]
41 Buckmaster Road    m: +44 7770 465 077   xmpp: [email protected]
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
#7 lore raw
In reply to Russel Winder

From what I can see, this problem has gone away – hopefully permanently.

As far as I can tell the only change is that there has been a firmware file update at [email protected]:OpenELEC/dvb-firmware.git that reverts 4.0.19 to 4.0.11

Quoted 47 lines · Russel Winder

I am fairly sure I didn't see this before, but then I am not sure I have a new kernel, libdvbv5 or dvbtools. Also people are bad witnesses.
However, if I plug the device in I can either scan with it or tune it,
but only once thereafter it goes into "won't do anything so there" mode. For example:

Quoted 1 line
Quoted 1 line

dvbv5-zap -c save_channels.conf "BBC NEWS"

using demux '/dev/dvb/adapter0/demux0' reading channels from file 'save_channels.conf' service has pid type 05:  7270
tuning to 490000000 Hz
video pid 501
  dvb_set_pesfilter 501
audio pid 502
  dvb_set_pesfilter 502
       (0x00)
Lock   (0x1f) Signal= -51.00dBm C/N= 23.50dB 582 anglides:~/Repositories/Git/Git/Me-TV (git:master)

Quoted 1 line
Quoted 1 line

dvbv5-zap -c save_channels.conf "BBC NEWS"

using demux '/dev/dvb/adapter0/demux0'
reading channels from file 'save_channels.conf'
service has pid type 05:  7270
tuning to 490000000 Hz
video pid 501
  dvb_set_pesfilter 501
audio pid 502
  dvb_set_pesfilter 502
       (0x00) C/N= 23.50dB
       (0x00) Signal= -67.00dBm C/N= 23.50dB
       (0x00) Signal= -67.00dBm C/N= 23.50dB
       (0x00) Signal= -109.00dBm C/N= 23.50dB
       (0x00) Signal= -109.00dBm C/N= 23.50dB
       (0x00) Signal= -109.00dBm C/N= 23.50dB
       (0x00) Signal= -109.00dBm C/N= 23.50dB
       (0x00) Signal= -109.00dBm C/N= 23.50dB
       (0x00) Signal= -109.00dBm C/N= 23.50dB
       (0x00) Signal= -109.00dBm C/N= 23.50dB
       (0x00) Signal= -109.00dBm C/N= 23.50dB

If I use a PCTV 282e this does not happen. As far as I can tell there has been no change of firmware either, and yet…

Signature · 5 lines
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:[email protected]
41 Buckmaster Road    m: +44 7770 465 077   xmpp: [email protected]
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
#8 lore raw

I did some testing and I suspect changed firmware behavior after 4.0.11 so that it goes totally power off when put into sleep and on that case firmware update is also lost.

One solution is to use firmware version to make decision if it needs to be uploaded everytime after the sleep(). Even better solution is to detect somehow if firmware upload is need by run-time, but that chip seems not to answer almost any command when it is put into deep sleep.

I have following firmwares:
4.0.2 (default firmware burned to chip rom)
4.0.4
4.0.11
4.0.19
4.0.25

It could be interesting to get missing ones... I attached script I used to extract firmwares from binary.

Antti

Quoted 55 lines · Russel Winder

From what I can see, this problem has gone away – hopefully
permanently.

As far as I can tell the only change is that there has been a firmware file update at [email protected]:OpenELEC/dvb-firmware.git that reverts 4.0.19 to 4.0.11

Quoted 47 lines · Russel Winder

I am fairly sure I didn't see this before, but then I am not sure I have a new kernel, libdvbv5 or dvbtools. Also people are bad witnesses.
However, if I plug the device in I can either scan with it or tune it,
but only once thereafter it goes into "won't do anything so there" mode. For example:

Quoted 1 line
Quoted 1 line

dvbv5-zap -c save_channels.conf "BBC NEWS"

using demux '/dev/dvb/adapter0/demux0'
reading channels from file 'save_channels.conf'
service has pid type 05: 7270
tuning to 490000000 Hz
video pid 501
dvb_set_pesfilter 501
audio pid 502
dvb_set_pesfilter 502

        (0x00)

Lock (0x1f) Signal= -51.00dBm C/N= 23.50dB
582 anglides:~/Repositories/Git/Git/Me-TV (git:master)

Quoted 1 line
Quoted 1 line

dvbv5-zap -c save_channels.conf "BBC NEWS"

using demux '/dev/dvb/adapter0/demux0'
reading channels from file 'save_channels.conf'
service has pid type 05: 7270
tuning to 490000000 Hz
video pid 501
dvb_set_pesfilter 501
audio pid 502
dvb_set_pesfilter 502

        (0x00) C/N= 23.50dB
        (0x00) Signal= -67.00dBm C/N= 23.50dB
        (0x00) Signal= -67.00dBm C/N= 23.50dB
        (0x00) Signal= -109.00dBm C/N= 23.50dB
        (0x00) Signal= -109.00dBm C/N= 23.50dB
        (0x00) Signal= -109.00dBm C/N= 23.50dB
        (0x00) Signal= -109.00dBm C/N= 23.50dB
        (0x00) Signal= -109.00dBm C/N= 23.50dB
        (0x00) Signal= -109.00dBm C/N= 23.50dB
        (0x00) Signal= -109.00dBm C/N= 23.50dB
        (0x00) Signal= -109.00dBm C/N= 23.50dB

If I use a PCTV 282e this does not happen. As far as I can tell there has been no change of firmware either, and yet…

Signature · 1 line
http://palosaari.fi/

#!/usr/bin/env python
# Silicon Labs Si2168 firmware extractor.
# Copyright (C) 2015 Antti Palosaari <[email protected]> # Usage: si2168_extract_firmware.py binary_driver_name.sys

import sys
import struct
import md5

fread = file(sys.argv[1], 'rb')
binary = fread.read()
offset = 0

# Known firmware md5 and its version

fw_ver_tab = {
    'b2670d8ae5e3369fc71edbb98cdd8f6e' : '4.0.11',
    '8dfc2483d90282bbb05817fbbc282376' : '4.0.19',
    'c8e089c351e9834060e962356f8697b8' : '4.0.25',
}

while True:

    # Match 17-byte firmware header
    # 04 01 00 00 00 00 9a 41 05 1b af 33 02 1b 3e 7d 2a | A20 (not supported)
    # 08 05 00 xx xx xx xx xx xx 00 00 00 00 00 00 00 00 | B40
    offset = binary.find('\x08\x05\x00', offset)
    if offset == -1:
        print "Done"
        break

    if (binary[offset + 9:offset + 17] != '\x00\x00\x00\x00\x00\x00\x00\x00'):
        offset = offset + 1
        continue

    print "17-byte firmware found at 0x%x" % (offset)

    fw_filename = 'dvb-demod-si2168-b40-01.fw_' + str(offset)
    fw_write = open(fw_filename, 'wb')
    fw_md5 = md5.new()

    while True:
        fields = struct.unpack("B", binary[offset])
        fw_data_len = fields[0]
        # Firmware chunk first byte tells bytes to upload - 16 is max
        if fw_data_len > 16:
            print "Firmware upload len too large %d" % (fw_data_len)
            break

        # Check remaining (unused) bytes on firmware 17-byte chunk are all zero
        data_valid = True
        for x in range(offset + fw_data_len + 1, offset + 17):
            if (binary[x] != '\x00'):
                data_valid = False
                break

        if data_valid == False:
            break

        # Firmware chunk validated, write it to file
        fw_write.write(binary[offset + 0:offset + 17])
        fw_md5.update(binary[offset + 0:offset + 17])
        offset = offset + 17

    fw_write.close()

    if fw_md5.hexdigest() in fw_ver_tab:
        fw_ver = fw_ver_tab[fw_md5.hexdigest()]
    else:
        fw_ver = '<unknown>'

    print "Firmware md5 '%s'" % (fw_md5.hexdigest())
    print "Firmware version '%s'" % (fw_ver)
    print "Firmware stored to file '%s'" % (fw_filename)

    offset = offset + 1

fread.close()