linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PCTV 292e weirdness
@ 2016-02-03 18:17 Russel Winder
  2016-02-04 16:14 ` Antti Palosaari
  2016-02-13 11:04 ` Russel Winder
  0 siblings, 2 replies; 9+ messages in thread
From: Russel Winder @ 2016-02-03 18:17 UTC (permalink / raw)
  To: DVB_Linux_Media

[-- Attachment #1: Type: text/plain, Size: 2052 bytes --]

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…


-- 
Russel.
==============================================================================
Dr Russel Winder       Director
It'z Interactive Ltd   t: +44 20 7585 2200        voip: sip:russel.winder@ekiga.net
41 Buckmaster Road     m: +44 7770 465 077        xmpp: russel@winder.org.uk
London SW11 1EN, UK    w: www.itzinteractive.com  skype: russel_winder


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PCTV 292e weirdness
  2016-02-03 18:17 PCTV 292e weirdness Russel Winder
@ 2016-02-04 16:14 ` Antti Palosaari
  2016-02-04 19:06   ` Russel Winder
  2016-02-13 11:04 ` Russel Winder
  1 sibling, 1 reply; 9+ messages in thread
From: Antti Palosaari @ 2016-02-04 16:14 UTC (permalink / raw)
  To: Russel Winder, DVB_Linux_Media

Moikka!

On 02/03/2016 08:17 PM, Russel Winder wrote:
> 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…

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

-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PCTV 292e weirdness
  2016-02-04 16:14 ` Antti Palosaari
@ 2016-02-04 19:06   ` Russel Winder
  2016-02-05  9:40     ` Rune Petersen
  0 siblings, 1 reply; 9+ messages in thread
From: Russel Winder @ 2016-02-04 19:06 UTC (permalink / raw)
  To: Antti Palosaari, DVB_Linux_Media

[-- Attachment #1: Type: text/plain, Size: 943 bytes --]

On Thu, 2016-02-04 at 18:14 +0200, Antti Palosaari wrote:
[…]
> 
> 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.

> 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.

-- 
Russel.
==============================================================================
Dr Russel Winder       Director
It'z Interactive Ltd   t: +44 20 7585 2200        voip: sip:russel.winder@ekiga.net
41 Buckmaster Road     m: +44 7770 465 077        xmpp: russel@winder.org.uk
London SW11 1EN, UK    w: www.itzinteractive.com  skype: russel_winder


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PCTV 292e weirdness
  2016-02-04 19:06   ` Russel Winder
@ 2016-02-05  9:40     ` Rune Petersen
  2016-02-05 19:07       ` Torbjorn Jansson
                         ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Rune Petersen @ 2016-02-05  9:40 UTC (permalink / raw)
  To: Russel Winder, Antti Palosaari, DVB_Linux_Media

[-- Attachment #1: Type: text/plain, Size: 1100 bytes --]

(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


On 04/02/16 20:06, Russel Winder wrote:
> On Thu, 2016-02-04 at 18:14 +0200, Antti Palosaari wrote:
> […]
>>
>> 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.
>
>> 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.
>


[-- Attachment #2: wip_si2157_disable_suspend.patch --]
[-- Type: text/x-diff, Size: 444 bytes --]

--- ../../rtfm/linux/drivers/media/tuners/si2157.c	2016-01-06 23:41:43.099644892 +0100
+++ drivers/media/tuners/si2157.c	2016-01-13 00:20:56.764225124 +0100
@@ -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:

[-- Attachment #3: wip_si2168_disable_suspend.patch --]
[-- Type: text/x-diff, Size: 711 bytes --]

--- ../../rtfm/linux/drivers/media/dvb-frontends/si2168.c	2016-01-06 23:41:42.523644600 +0100
+++ drivers/media/dvb-frontends/si2168.c	2016-01-12 23:59:39.655098797 +0100
@@ -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);

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PCTV 292e weirdness
  2016-02-05  9:40     ` Rune Petersen
@ 2016-02-05 19:07       ` Torbjorn Jansson
  2016-02-07 21:26       ` Antti Palosaari
  2016-02-08  8:46       ` Russel Winder
  2 siblings, 0 replies; 9+ messages in thread
From: Torbjorn Jansson @ 2016-02-05 19:07 UTC (permalink / raw)
  To: Rune Petersen, Russel Winder, Antti Palosaari, DVB_Linux_Media

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.

On 2016-02-05 10:40, Rune Petersen wrote:
> (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
>
>
> On 04/02/16 20:06, Russel Winder wrote:
>> On Thu, 2016-02-04 at 18:14 +0200, Antti Palosaari wrote:
>> […]
>>>
>>> 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.
>>
>>> 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.
>>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PCTV 292e weirdness
  2016-02-05  9:40     ` Rune Petersen
  2016-02-05 19:07       ` Torbjorn Jansson
@ 2016-02-07 21:26       ` Antti Palosaari
  2016-02-08  8:46       ` Russel Winder
  2 siblings, 0 replies; 9+ messages in thread
From: Antti Palosaari @ 2016-02-07 21:26 UTC (permalink / raw)
  To: Rune Petersen, Russel Winder, DVB_Linux_Media

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


On 02/05/2016 11:40 AM, Rune Petersen wrote:
> (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
>
>
> On 04/02/16 20:06, Russel Winder wrote:
>> On Thu, 2016-02-04 at 18:14 +0200, Antti Palosaari wrote:
>> […]
>>>
>>> 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.
>>
>>> 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.
>>
>

-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PCTV 292e weirdness
  2016-02-05  9:40     ` Rune Petersen
  2016-02-05 19:07       ` Torbjorn Jansson
  2016-02-07 21:26       ` Antti Palosaari
@ 2016-02-08  8:46       ` Russel Winder
  2 siblings, 0 replies; 9+ messages in thread
From: Russel Winder @ 2016-02-08  8:46 UTC (permalink / raw)
  To: Rune Petersen, Antti Palosaari, DVB_Linux_Media

[-- Attachment #1: Type: text/plain, Size: 1208 bytes --]

On Fri, 2016-02-05 at 10:40 +0100, Rune Petersen wrote:
> (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()

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.


-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PCTV 292e weirdness
  2016-02-03 18:17 PCTV 292e weirdness Russel Winder
  2016-02-04 16:14 ` Antti Palosaari
@ 2016-02-13 11:04 ` Russel Winder
  2016-02-14 17:10   ` Antti Palosaari
  1 sibling, 1 reply; 9+ messages in thread
From: Russel Winder @ 2016-02-13 11:04 UTC (permalink / raw)
  To: DVB_Linux_Media

[-- Attachment #1: Type: text/plain, Size: 2397 bytes --]

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 git@github.com:OpenELEC/dvb-firmware.git that reverts
4.0.19 to 4.0.11

On Wed, 2016-02-03 at 18:17 +0000, Russel Winder wrote:
> 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…
> 
> 
-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PCTV 292e weirdness
  2016-02-13 11:04 ` Russel Winder
@ 2016-02-14 17:10   ` Antti Palosaari
  0 siblings, 0 replies; 9+ messages in thread
From: Antti Palosaari @ 2016-02-14 17:10 UTC (permalink / raw)
  To: Russel Winder, DVB_Linux_Media

[-- Attachment #1: Type: text/plain, Size: 2748 bytes --]

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

On 02/13/2016 01:04 PM, Russel Winder wrote:
>  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 git@github.com:OpenELEC/dvb-firmware.git that reverts
> 4.0.19 to 4.0.11
>
> On Wed, 2016-02-03 at 18:17 +0000, Russel Winder wrote:
>> 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…
>>
>>

-- 
http://palosaari.fi/

[-- Attachment #2: si2168_extract_firmware.py --]
[-- Type: text/x-python, Size: 2230 bytes --]

#!/usr/bin/env python
# Silicon Labs Si2168 firmware extractor.
# Copyright (C) 2015 Antti Palosaari <crope@iki.fi>
# 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()


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-02-14 17:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-03 18:17 PCTV 292e weirdness Russel Winder
2016-02-04 16:14 ` Antti Palosaari
2016-02-04 19:06   ` Russel Winder
2016-02-05  9:40     ` Rune Petersen
2016-02-05 19:07       ` Torbjorn Jansson
2016-02-07 21:26       ` Antti Palosaari
2016-02-08  8:46       ` Russel Winder
2016-02-13 11:04 ` Russel Winder
2016-02-14 17:10   ` Antti Palosaari

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).