Bug - Terrestrial USB tuner identified as non-terrestrial
-
- Uber Wizard
- Posts: 6490
- Joined: Thu Mar 05, 2009 22:54
- Location: Perth
Re: Bug - Terrestrial USB tuner identified as non-terrestrial
Thanks Paul.
I don't think it's 'major', as it's not occurring on every UI start. If it was, I imagine it'd be easier to track down.
AFAIK, the only reliable way to ensure one doesn't lose out in 'tuner lotto' is to put the T2/T3 to standby instead of allowing it to go to shutdown, and to monitor the tuner mode upon UI restart or attended system reboot.
I'm trialling a UI restart mechanism in "enigma2_pre_start.sh" that fires when it detects the non-terrestrial mode selection. I had it detecting correctly, but the restart didn't correctly fire (I had an init 3 by itself). I then tried a '4; sleep; 3' sequence, which appeared to work and then didn't when I was forcing it (but perhaps I ran into that 5-min restart wait). I then decided that I'll try a restart by driving OWIF from the command line. That restart seems to work, and now I've just got to wait for it to happen in real life
If anybody wants to try this pre-start script for themselves, I'll be happy to show what I'm using and describe the details. The more testers the better
I don't think it's 'major', as it's not occurring on every UI start. If it was, I imagine it'd be easier to track down.
AFAIK, the only reliable way to ensure one doesn't lose out in 'tuner lotto' is to put the T2/T3 to standby instead of allowing it to go to shutdown, and to monitor the tuner mode upon UI restart or attended system reboot.
I'm trialling a UI restart mechanism in "enigma2_pre_start.sh" that fires when it detects the non-terrestrial mode selection. I had it detecting correctly, but the restart didn't correctly fire (I had an init 3 by itself). I then tried a '4; sleep; 3' sequence, which appeared to work and then didn't when I was forcing it (but perhaps I ran into that 5-min restart wait). I then decided that I'll try a restart by driving OWIF from the command line. That restart seems to work, and now I've just got to wait for it to happen in real life
If anybody wants to try this pre-start script for themselves, I'll be happy to show what I'm using and describe the details. The more testers the better
-
- Uber Wizard
- Posts: 6490
- Joined: Thu Mar 05, 2009 22:54
- Location: Perth
Re: Bug - Terrestrial USB tuner identified as non-terrestrial
IanSav wrote: ↑Thu Apr 26, 2018 23:04Hi,
Before people start becoming litigious perhaps my suggestion to look at the code contribution to OpenViX, https://github.com/OpenViX/enigma2/pull/254, may address this issue for the Beyonwiz as well.
Regards,
Ian.
I've no idea, but from my brief look at that it is selecting from a dual tuner, not from a single tuner that may sometimes present multi-modes depending on celestial mechanics.
Also it has a comment re. selecting DVB-S2 which won't help us.
Re: Bug - Terrestrial USB tuner identified as non-terrestrial
Hi Grumpy_Geoff,
I believe the code is attempting to select the correct operating mode from a device that supports multiple modes. (What those modes actually are do not matter.)
Regards,
Ian.
I believe the code is attempting to select the correct operating mode from a device that supports multiple modes. (What those modes actually are do not matter.)
Regards,
Ian.
Re: Bug - Terrestrial USB tuner identified as non-terrestrial
This is probably why I don't see it - I only ever use standby with the T3. This was because on shutdowns the T3 was losing the HDD. Apparently a bug in the front panel firmware.AFAIK, the only reliable way to ensure one doesn't lose out in 'tuner lotto' is to put the T2/T3 to standby instead of allowing it to go to shutdown, and to monitor the tuner mode upon UI restart or attended system reboot.
__________________________________
Paul
Beyonwiz T4, 2 x U4: FW - 19.3 20211010
Samsung QA85Q80BAWXXY 4K TV
Samsung QA65Q80TAWXXY 4K TV
Samsung HW Q800BXY soundbar
OverlayHD 1.70, IceTV, Foxtel IQ4
2 x Win7 PCs, 2 x Win10 PCs
Denon AVR -X2400H
Paul
Beyonwiz T4, 2 x U4: FW - 19.3 20211010
Samsung QA85Q80BAWXXY 4K TV
Samsung QA65Q80TAWXXY 4K TV
Samsung HW Q800BXY soundbar
OverlayHD 1.70, IceTV, Foxtel IQ4
2 x Win7 PCs, 2 x Win10 PCs
Denon AVR -X2400H
Re: Bug - Terrestrial USB tuner identified as non-terrestrial
Paul_oz53 wrote: ↑Fri Apr 27, 2018 01:30This is probably why I don't see it - I only ever use standby with the T3. This was because on shutdowns the T3 was losing the HDD. Apparently a bug in the front panel firmware.AFAIK, the only reliable way to ensure one doesn't lose out in 'tuner lotto' is to put the T2/T3 to standby instead of allowing it to go to shutdown, and to monitor the tuner mode upon UI restart or attended system reboot.
Always use Standby for our T2s. Shutdown/Reboot when there's a FW update, new/updated patches, or a lockup. All fairly rare on my wife's T2, which is why I don't get "the stupid box won't record all my programs" called out from the other room.
dRdoS7
-
- Wizard God
- Posts: 32712
- Joined: Tue Sep 04, 2007 13:49
- Location: Canberra; Black Mountain Tower transmitters
Re: Bug - Terrestrial USB tuner identified as non-terrestrial
Grumpy_Geoff wrote: ↑Thu Apr 26, 2018 23:18IanSav wrote: ↑Thu Apr 26, 2018 23:04Hi,
Before people start becoming litigious perhaps my suggestion to look at the code contribution to OpenViX, https://github.com/OpenViX/enigma2/pull/254, may address this issue for the Beyonwiz as well.
Regards,
Ian.
I've no idea, but from my brief look at that it is selecting from a dual tuner, not from a single tuner that may sometimes present multi-modes depending on celestial mechanics.
Also it has a comment re. selecting DVB-S2 which won't help us.
And not only that, but the kernel is presenting a list of capabilities where none are actual capabilities of the tuner. E.g. from Grumpy_Geoff's earlier post:
Code: Select all
NIM Socket 2:
Type: DVB-T
Name: RTL2838UHIDIR
Mode 6: DVB-T2
Mode 2: DVB-C
Frontend_Device: 2
I2C_Device: 843863122
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
-
- Uber Wizard
- Posts: 6490
- Joined: Thu Mar 05, 2009 22:54
- Location: Perth
Re: Bug - Terrestrial USB tuner identified as non-terrestrial
I have the below snippet as part of my enigma2_pre_start.sh script to detect if the USB tuner is in the wrong mode -
When I execute that wget command from the command line it executes and restarts the UI okay as intended (I get a "wget: error getting response" and I'm guessing that's because the UI is restarting and the web server is no longer active).
Yesterday the T2 started with the USB tuner in satelite mode -
When that wget command was executed from within my enigma2_pre_start.sh script the log contained -
That xml response string is exactly the same if I enter the query without the action (or whatever you call it) on the command line -
So it appears to me that ?newstate=3 wasn't passed to wget. Do I need to escape the "?" in that wget call in the script?
Is there some other way I should be specifying this?
Cheers,
Geoff
Code: Select all
## restart UI if non-Terrestrial
awk '/NIM Socket 2:/ {USBtuner = 1}; \
USBtuner && /Mode [0-9]: DVB-/ { if($0 !~ /DVB-T/) {print "*** non-Terrestrial USB tuner type, restarting UI"; exit 99}; exit}' /proc/bus/nim_sockets; \
RC=$?; echo -e "awk RC: $RC"; \
if [ $RC -eq 99 -a -f /home/root/Allow_UI_Restart ] ; then echo "*** about to restart"; wget -q -O - http://192.168.1.63/web/powerstate?newstate=3; fi; \
When I execute that wget command from the command line it executes and restarts the UI okay as intended (I get a "wget: error getting response" and I'm guessing that's because the UI is restarting and the web server is no longer active).
Yesterday the T2 started with the USB tuner in satelite mode -
Code: Select all
NIM Socket 2:
Type: DVB-T
Name: RTL2832U
Mode 4: DVB-S2
Frontend_Device: 2
I2C_Device: 843863122
Code: Select all
*** non-Terrestrial USB tuner type, restarting UI
awk RC: 99
*** about to restart
<?xml version="1.0" encoding="UTF-8"?>
<e2powerstate>
<e2instandby>
false </e2instandby>
</e2powerstate>
Code: Select all
root@beyonwizt2:~# wget -q -O - http://192.168.1.63/web/powerstate
<?xml version="1.0" encoding="UTF-8"?>
<e2powerstate>
<e2instandby>
false </e2instandby>
</e2powerstate>
root@beyonwizt2:~#
Is there some other way I should be specifying this?
Cheers,
Geoff
-
- Wizard God
- Posts: 32712
- Joined: Tue Sep 04, 2007 13:49
- Location: Canberra; Black Mountain Tower transmitters
Re: Bug - Terrestrial USB tuner identified as non-terrestrial
Since the "?" character is a filename expansion metacharacter (match any single character), it would probably be a good idea to escape it. If there's no filename expansion match, the unaltered string is passed to the program by the shell, so it is likely to work, even if not as safe as it could be.
Also, why not use the generic IP address that means "the computer I'm running on": 127.0.0.1 or localhost? So something like this safer and more generic:
wget -q -O - 'http://localhost/web/powerstate?newstate=3'
My main problem with it is that I can't see how it could ever work at UI startup, because the OpenWebif server only runs when enigma2 is running, and at the time that, as its name suggests, enigma2_pre_start.sh runs, enigma2 isn't yet running.
E.g:
Also, stylistically, and for readability, you might want something like:
Both in the shell script and in the awk script,
in most cases will do the same thing as:
De gustibus non est disputandum, of course
Also, why not use the generic IP address that means "the computer I'm running on": 127.0.0.1 or localhost? So something like this safer and more generic:
wget -q -O - 'http://localhost/web/powerstate?newstate=3'
My main problem with it is that I can't see how it could ever work at UI startup, because the OpenWebif server only runs when enigma2 is running, and at the time that, as its name suggests, enigma2_pre_start.sh runs, enigma2 isn't yet running.
E.g:
Code: Select all
root@beyonwizu4:/media/hdd/logs# init 4 # shut down enigma2
root@beyonwizu4:/media/hdd/logs# wget -q -O - 'http://localhost/web/powerstate?newstate=3'
wget: can't connect to remote host (127.0.0.1): Connection refused
root@beyonwizu4:/media/hdd/logs#
Code: Select all
#!/bin/sh
exec >> /tmp/pre_start.txt 2>&1
## restart UI if non-Terrestrial
awk '/NIM Socket 2:/ {USBtuner = 1}
USBtuner && /Mode [0-9]: DVB-/ {
if($0 !~ /DVB-T/) {
print "*** non-Terrestrial USB tuner type, restarting UI"
exit 99
}
}' /proc/bus/nim_sockets
RC=$?
echo -e "awk RC: $RC"
if [ $RC -eq 99 -a -f /home/root/Allow_UI_Restart ] ; then
echo "*** about to restart"
wget -q -O - 'http://localhost/web/powerstate?newstate=3'
fi
Code: Select all
something; \
otherthing
Code: Select all
something
otherthing
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
-
- Uber Wizard
- Posts: 6490
- Joined: Thu Mar 05, 2009 22:54
- Location: Perth
Re: Bug - Terrestrial USB tuner identified as non-terrestrial
Thanks Peter.
I'll try with quoting the URL restart parameter to wget - I think that's the missing link
The pre-start script gets called, and my stuff is then executed in a sub-shell in the background so as to not hold up the UI starting up. I got that bit from you, as I did some awk that I still have in the script
By the time the wget commands get to run, enigma2 has started, and the webserver has also started. The full script as currently executing is shown below. As you can see, it's been cobbled together over time!
Apart from quoting the (wget) UI restart, and changing the IP address to localhost, what other changes would you suggest? Your comments are most welcome.
Cheers
Geoff
I'll try with quoting the URL restart parameter to wget - I think that's the missing link
The pre-start script gets called, and my stuff is then executed in a sub-shell in the background so as to not hold up the UI starting up. I got that bit from you, as I did some awk that I still have in the script
By the time the wget commands get to run, enigma2 has started, and the webserver has also started. The full script as currently executing is shown below. As you can see, it's been cobbled together over time!
Code: Select all
root@beyonwizt2:~# cat /usr/bin/enigma2_pre_start.sh
#!/bin/sh
( (echo -e "\n\n=> $(date -Iseconds)"; cat /proc/bus/nim_sockets) >> /media/hdd/logs/nim_sockets_bootup_0secs.txt; \
(sleep 5; echo -e "\n\n=> $(date -Iseconds)"; cat /proc/bus/nim_sockets) >> /media/hdd/logs/nim_sockets_bootup_5secs.txt; \
sleep 95; \
echo -e "\n==> $(date -Iseconds)"; \
##grep -i vtuner /var/log/messages; \
(echo -e "\n==> $(date -Iseconds)"; cat /proc/bus/nim_sockets) >> /media/hdd/logs/nim_sockets.txt; \
awk '/NIM Socket 2:/ {printIt=1}; printIt' /proc/bus/nim_sockets; \
wget -q -O - http://192.168.1.63/web/deviceinfo | \
awk '{ \
if(printNext) { print $0; printNext = 0 } \
} \
/<e2name>Tuner C<\/e2name>/ { print $0; printNext = 1 }'; \
DbgPath=$(grep debug_path /etc/enigma2/settings); \
if [ -n "$DbgPath" ] ; then DbgPath=$(echo $DbgPath | sed -e 's/config.crash.debug_path=//'); else DbgPath=/home/root/logs/; fi; \
latestFile=$(ls -t ${DbgPath}Enigma2-201* | head -n 1); \
echo "==> $latestFile"; \
grep '\[NimManager\]' $latestFile;
## restart UI if non-Terrestrial
awk '/NIM Socket 2:/ {USBtuner = 1}; \
USBtuner && /Mode [0-9]: DVB-/ { if($0 !~ /DVB-T/) {print "*** non-Terrestrial USB tuner type, restarting UI"; exit 99}; exit}' /proc/bus/nim_sockets; \
RC=$?; echo -e "awk RC: $RC"; \
if [ $RC -eq 99 -a -f /home/root/Allow_UI_Restart ] ; then echo "*** about to restart"; wget -q -O - http://192.168.1.63/web/powerstate?newstate=3; fi; \
) >> /media/hdd/logs/vtuner6.log 2>> /media/hdd/logs/vtuner_errs.log &
Cheers
Geoff
-
- Wizard God
- Posts: 32712
- Joined: Tue Sep 04, 2007 13:49
- Location: Canberra; Black Mountain Tower transmitters
Re: Bug - Terrestrial USB tuner identified as non-terrestrial
Grumpy_Geoff wrote: ↑Tue May 08, 2018 17:17... I'll try with quoting the URL restart parameter to wget - I think that's the missing link
That seems unlikely to me. You could check by putting an echo http://localhost/web/powerstate?newstate=3 in the script to see whether there's any funny filename expansion going on.
Grumpy_Geoff wrote: ↑Tue May 08, 2018 17:17...
Apart from quoting the (wget) UI restart, and changing the IP address to localhost, what other changes would you suggest? Your comments are most welcome.
Use more newlines. You don't actually need most of those " ; \<newline>" items. Just use a newline.
You don't need line continuation on most compound commands, provided it's clear that the command hasn't ended.
For example, all these things allow you to break up compound commands and make them more readable (the indenting isn't required, it's just for readability):
Code: Select all
(
echo this
echo that
)
echo this |
cat
echo this &&
echo that # and the same for ||
Code: Select all
if <pipeline>
then
echo this
else
echo that
fi
Code: Select all
if <pipeline>; then
echo this
else
echo that
fi
Code: Select all
#!/bin/sh
exec >> /media/hdd/logs/vtuner6.log 2>> /media/hdd/logs/vtuner_errs.log
# Or exec >> /media/hdd/logs/vtuner6.log 2>&1 to put it in a single file
(
(echo -e "\n\n=> $(date -Iseconds)"; cat /proc/bus/nim_sockets) >> /media/hdd/logs/nim_sockets_bootup_0secs.txt
(sleep 5; echo -e "\n\n=> $(date -Iseconds)"; cat /proc/bus/nim_sockets) >> /media/hdd/logs/nim_sockets_bootup_5secs.txt
sleep 95
echo -e "\n==> $(date -Iseconds)"
##grep -i vtuner /var/log/messages
(echo -e "\n==> $(date -Iseconds)"; cat /proc/bus/nim_sockets) >> /media/hdd/logs/nim_sockets.txt
awk '/NIM Socket 2:/ {printIt=1}; printIt' /proc/bus/nim_sockets
wget -q -O - http://192.168.1.63/web/deviceinfo |
awk '{
if(printNext) { print $0; printNext = 0 }
}
/<e2name>Tuner C<\/e2name>/ {
print $0
printNext = 1
}'
DbgPath=$(grep debug_path /etc/enigma2/settings)
if [ -n "$DbgPath" ] ; then
DbgPath=$(echo $DbgPath | sed -e 's/config.crash.debug_path=//')
else
DbgPath=/home/root/logs/
fi
latestFile=$(ls -t ${DbgPath}Enigma2-201* | head -n 1)
echo "==> $latestFile"
grep '\[NimManager\]' $latestFile;
## restart UI if non-Terrestrial
awk '/NIM Socket 2:/ {USBtuner = 1}
USBtuner && /Mode [0-9]: DVB-/ {
if($0 !~ /DVB-T/) {
print "*** non-Terrestrial USB tuner type, restarting UI"; exit 99
}
exit
}' /proc/bus/nim_sockets
RC=$?; echo -e "awk RC: $RC"
if [ $RC -eq 99 -a -f /home/root/Allow_UI_Restart ]; then
echo "*** about to restart"
wget -q -O - 'http://localhost/web/powerstate?newstate=3'
fi
) &
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
-
- Uber Wizard
- Posts: 6490
- Joined: Thu Mar 05, 2009 22:54
- Location: Perth
Re: Bug - Terrestrial USB tuner identified as non-terrestrial
Thanks. I'm running with your ideas and formatting.
The tuner has come up as non-terrestrial four times in the last four weeks - so on that (bad) average, we'll only need to wait about a week to see if the quoting to the wget UI restart works.
Cheers,
Geoff
The tuner has come up as non-terrestrial four times in the last four weeks - so on that (bad) average, we'll only need to wait about a week to see if the quoting to the wget UI restart works.
Cheers,
Geoff
-
- Wizard God
- Posts: 32712
- Joined: Tue Sep 04, 2007 13:49
- Location: Canberra; Black Mountain Tower transmitters
Re: Bug - Terrestrial USB tuner identified as non-terrestrial
Glad to have been able to help, at least with readability. I'm still doubtful that the problem is in not quoting the wget URL.
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
-
- Uber Wizard
- Posts: 6490
- Joined: Thu Mar 05, 2009 22:54
- Location: Perth
Re: Bug - Terrestrial USB tuner identified as non-terrestrial
She works!
I added this bit to the end of the script to force/test a UI restart -
The message appeared on the screen, and the UI restarted. The output contained -
I let it restart twice before renaming the 'allow' file.
I added this bit to the end of the script to force/test a UI restart -
Code: Select all
if [ $RC -eq 0 -a -f /home/root/Allow_UI_Restart ]; then
echo "*** forcing a restart"
wget -q -O - 'http://localhost/web/message?text=Pretending%20a%20bad%20USB%20tuner%20mode.%20%20Restarting%20GUI&type=3'
echo "issuing command:"
echo wget -q -O - http://localhost/web/powerstate?newstate=3
wget -q -O - 'http://localhost/web/powerstate?newstate=3'
echo "*** command issued"
fi
Code: Select all
*** forcing a restart
<?xml version="1.0" encoding="UTF-8"?>
<e2simplexmlresult>
<e2state>True</e2state>
<e2statetext>Message sent successfully!</e2statetext>
</e2simplexmlresult>
issuing command:
wget -q -O - http://localhost/web/powerstate?newstate=3
*** command issued
-
- Wizard God
- Posts: 32712
- Joined: Tue Sep 04, 2007 13:49
- Location: Canberra; Black Mountain Tower transmitters
Re: Bug - Terrestrial USB tuner identified as non-terrestrial
I can't see why, but as long as it works ...
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV