View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 42 posts ] 
Go to page Previous  1, 2, 3  Next

Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject:
PostPosted: Fri Sep 21, 2007 7:09 pm 
Offline
Joined: Wed Feb 01, 2006 12:49 pm
Posts: 42
Perhaps your frequency table is something other than "US-CABLE"? It should be the same as in your mythtv-setup screen for your capture card(ALT-S from the frontend).

You might try commenting out that line of the script- I do not know if it is totally necessary.

Make sure you check your /tmp/changer0.log to see if there are any errors....

-Loco


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 24, 2007 12:16 pm 
Offline
Joined: Sun Oct 16, 2005 9:24 pm
Posts: 61
The delayed_settings.sh script won't run properly with my channel_change.sh script. I've got a fresh install of R5F27 in which everything worked "out of the box" (first time ever) except for this tinny audio issue.

I assume it's something I've copied incorrectly and I've being trying various alterations to the scripts to get them to work. My channel changes to the correct station with "./channel_change.sh xxx" and I get major complaints from "./delayed_settings.sh", but at least the scripts are executable and run.

Here is my channel_change.sh script (which changes channels correctly):
Code:
#!/bin/bash

# Automatically Generated by /usr/local/bin/irblaster.sh

DEVICE="0"     # The PVR-150 card
exec >>/tmp/changer$DEVICE.log 2>&1

#FREQ_TBL="us-cable" # Possibly "us-cable", "us-cable-hrc", ...
BRIGHTNESS=127 # Picture brightness, actually the black level. [0 - 255]
HUE=0          # Hue or color balance. [-128 - 127]
SATURATION=63  # Picture color saturation or chroma gain. [0 - 127]
CONTRAST=63    # Picture contrast or luma gain. [0 - 127]
VOLUME=58880   # Overall audio volume. [0 - 65535]

export HOME=/home/mythtv
echo "Changing to $1"

REMOTE_NAME=DCT2524

for digit in $(echo $1 | sed -e 's/./& /g'); do
  /usr/bin/irsend --device=/dev/irblasterd SEND_ONCE $REMOTE_NAME $digit
  sleep 0.1
done

(nohup /usr/local/bin/delayed_settings.sh $DEVICE \
                                          $BRIGHTNESS \
                                          $HUE \
                                          $SATURATION \
                                          $CONTRAST \
                                          $VOLUME & exit) &
exit 0


Here is my delayed_settings.sh script (copied from the first post in this thread):
Code:
#!/bin/bash
# Uncomment this for debugging
# set -vx

DEVICE=$1
exec >>/tmp/changer$DEVICE.log 2>&1

# controls:
BRIGHTNESS=${2:-127} # Picture brightness, actually the black level. [0 - 255]
HUE=${3:-0}          # Hue or color balance. [-128 - 127]
SATURATION=${4:-63}  # Picture color saturation or chroma gain. [0 - 127]
CONTRAST=${5:-63}    # Picture contrast or luma gain. [0 - 127]
VOLUME=${6:-60000}   # Overall audio volume. [0 - 65535]

CTL_OPTS="-d /dev/video$DEVICE"
echo ; echo Settings before:
/usr/local/bin/v4l2-ctl -d /dev/video0 --get-ctrl=brightness,hue,saturation,contrast,volume
for i in 0 2 4 6 8 10 ; do
    /usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl brightness=$BRIGHTNESS >/dev/null
    /usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl hue=$HUE               >/dev/null
    /usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl saturation=$SATURATION >/dev/null
    /usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl contrast=$CONTRAST     >/dev/null
    /usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl volume=$VOLUME         >/dev/null

    # Add any extra ivtvctl commands here, before the sleep.
    /usr/local/bin/v4l2-ctl --set-audio-input 1 -d /dev/video$DEVICE            >/dev/null

    sleep 2
done
echo ; echo Settings after:
/usr/local/bin/v4l2-ctl -d /dev/video$DEVICE --get-ctrl=brightness,hue,saturation,contrast,volume


Here is the changer0.log output:
Code:
Changing to 167
nohup: cannot run command `/usr/local/bin/delayed_settings.sh': No such file or directory


If I alter the first line in the delayed_settings.sh script to #1/bin/bash I get the following output in changer0.log:
Code:
Changing to 167
/usr/local/bin/delayed_settings.sh: line 4:
: command not found
/usr/local/bin/delayed_settings.sh: line 6: 1
: ambiguous redirect


Any suggestions will be greatly appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 24, 2007 5:36 pm 
Offline
Joined: Wed Feb 01, 2006 12:49 pm
Posts: 42
There are some line breakages that should not be there in the initial post. I could not figure out how to change the size of text with the "code" command, so I posted the delayed_settings.sh with the "quote" command instead. Your script needs to look like:


Quote:
#!/bin/bash
# Uncomment this for debugging
#set -vx

DEVICE=$1
exec >>/tmp/changer$DEVICE.log 2>&1

# controls:
BRIGHTNESS=${2:-127} # Picture brightness, actually the black level. [0 - 255]
HUE=${3:-0} # Hue or color balance. [-128 - 127]
SATURATION=${4:-63} # Picture color saturation or chroma gain. [0 - 127]
CONTRAST=${5:-63} # Picture contrast or luma gain. [0 - 127]
VOLUME=${6:-60000} # Overall audio volume. [0 - 65535]

CTL_OPTS="-d /dev/video$DEVICE"
echo ; echo Settings before:
/usr/local/bin/v4l2-ctl -d /dev/video0 --get-ctrl=brightness,hue,saturation,contrast,volume
for i in 0 2 4 6 8 10 ; do
/usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl brightness=$BRIGHTNESS >/dev/null
/usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl hue=$HUE >/dev/null
/usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl saturation=$SATURATION >/dev/null
/usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl contrast=$CONTRAST >/dev/null
/usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl volume=$VOLUME >/dev/null

# Add any extra ivtvctl commands here, before the sleep.
/usr/local/bin/v4l2-ctl --set-audio-input 1 -d /dev/video$DEVICE >/dev/null

sleep 2
done
echo ; echo Settings after:
/usr/local/bin/v4l2-ctl -d /dev/video$DEVICE--get-ctrl=brightness,hue,saturation,contrast,volume



Sorry about that. I edited the initial post too. Also, make sure there are no extra spaces at the end the lines......

-Loco


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 25, 2007 11:03 am 
Offline
Joined: Sun Oct 16, 2005 9:24 pm
Posts: 61
Thanks for that, but there's been no change in results or the changer0.log file. I created your new delayed_settings.sh file in /usr/bin/local, did a chmod u+x as root on it, and I'm still where I was before.

What I can't understand is if I try to run delayed_settings.sh in /usr/local/bin by typing in ./delayed_settings.sh, I get the following error message back:
Code:
bash: ./delayed_settings.sh: /bin/bash^M: bad interpreter: No such file or directory


It seems there's something very basic I'm doing wrong here, but not knowing Linux too well, I can't figure what it is.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 25, 2007 6:54 pm 
Offline
Joined: Wed Feb 01, 2006 12:49 pm
Posts: 42
Maybe it is still an extra return/space issue. You can try to clean up the file with this command:

Code:
sed -si'.old' -e 's/[ \r]*$//'  delayed_settings.sh


Then see if your channel change script works after that.....

Also, the delayed_settings script REQUIRES variables ($DEVICE, etc), that is why the last line of the script has all of those weird slashes and returns. So I do not think just trying to run delayed_settings.sh from your command line will cut it.

Maybe it is working? Run your first channel change script to a random channel once. Then, type
Code:
/usr/local/bin/v4l2-ctl -d /dev/video0 --get-ctrl=brightness,hue,saturation,contrast,volume


Then, edit your first channel change script and change the "BRIGHTNESS" line value to 166 instead of 127.

Now, Run your first channel change script to a random channel again. Again, type
Code:
/usr/local/bin/v4l2-ctl -d /dev/video0 --get-ctrl=brightness,hue,saturation,contrast,volume


Did the brightness value change?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 26, 2007 7:32 am 
Offline
Joined: Sun Oct 16, 2005 9:24 pm
Posts: 61
It's now fixed. It was the extra space issue. Using the sed command did the trick.

P.S. - I knew that running delayed_settings.sh by itself would not work, but I expected it to do something other than give me a "bad command" error message if it was working properly. Now if I run delayed_settings.sh by itself, the script just waits for input, which would be the expected behavior.

Thanks for the help! :D


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 26, 2007 4:37 pm 
Offline
Joined: Mon Feb 20, 2006 8:32 am
Posts: 27
I have RF27 and there is no "delayed_settings.sh" in /usr/local/bin/

I did a find on the entire drive and couldn't find it.

Do I need to create this script? Will it run automatically?

_________________
-hunter


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 26, 2007 10:57 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
The delayed_setiings script is definitely an "after market add-on". ;-)

loco_hombre wrote:
Also, the delayed_settings script REQUIRES variables ($DEVICE, etc), that is why the last line of the script has all of those weird slashes and returns. So I do not think just trying to run delayed_settings.sh from your command line will cut it.


Weird slashes? That's called "backslash line continuation". ;-)

Also it doesn't require the variables, it requires the command arguments they expand to.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 28, 2007 7:39 pm 
Offline
Joined: Mon Feb 20, 2006 8:32 am
Posts: 27
When I run the delayed_settings.sh script, I get the following in the changer.log:

Settings before:
brightness: 128
hue: 0
saturation: 63
contrast: 63
volume: 58880
Failed to open /dev/video: No such file or directory
Failed to open /dev/video: No such file or directory
Failed to open /dev/video: No such file or directory
Failed to open /dev/video: No such file or directory
Failed to open /dev/video: No such file or directory
Failed to open /dev/video: No such file or directory
Failed to open /dev/video: No such file or directory
Failed to open /dev/video: No such file or directory
Failed to open /dev/video: No such file or directory
Failed to open /dev/video: No such file or directory
Failed to open /dev/video: No such file or directory
Failed to open /dev/video: No such file or directory

_________________
-hunter


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 29, 2007 6:53 am 
Offline
Joined: Wed Feb 01, 2006 12:49 pm
Posts: 42
EDIT: I removed this due to erroneous info!

-Loco


Last edited by loco_hombre on Sat Sep 29, 2007 11:58 am, edited 1 time in total.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 29, 2007 9:57 am 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
Uh, no that would be bad. $0 is the name of the command being run, $1 is the first command line argument. This has been like watching bright kids with no experience and limited understanding of what they're trying to accomplish play plumber with the contents of a fully stocked plumbers truck. Amusing up to a point, before it becomes alarming.

The device number is supposed to be passed to the delayed_settings.sh script as the first command line argument (this is so you can have multiple changers with card specific settings use one common backend script). Based on the error message _no_ command line arguments were being passed, like hunter44102 was running it manually rather than from a changer script with all the command line arguments. Let's get back to basics...

This is the (updated) changer script. It's intended to be used as your external channel changer script(*) specific to a given input connection! It does three important things:

1) It changes the channel.
2) It knows the override settings you want specifically for this input and launches the delayed setting script with them.
3) It exits immediately with a "success" return code (so that MythTV will go about it's business), leaving the delayed setting script waiting in the background to make corrections later.

BTW - This is NOT a perl script so calling it anything ".pl" is a misnomer. It's a shell script so you should use ".sh" if anything as the extension. For example "change_tuner0.sh"

Code:
#!/bin/bash
# Uncomment this for debugging
#set -vx

DEVICE="0"     # The PVR-250 card
exec >>/var/log/mythtv/changer$DEVICE.log 2>&1
echo "Called as: $0 $*"

FREQ_TBL="us-cable-irc" # Possibly "us-cable", "us-cable-hrc", ...
BRIGHTNESS=127 # Picture brightness, actually the black level. [0 - 255]
HUE=0          # Hue or color balance. [-128 - 127]
SATURATION=63  # Picture color saturation or chroma gain. [0 - 127]
CONTRAST=63    # Picture contrast or luma gain. [0 - 127]
VOLUME=64000   # Overall audio volume. [0 - 65535]
AUDIO_CHANNEL=stereo
AUDIO_INPUT=0

export HOME=/home/mythtv
echo "Setting channel to $1"
#env
/usr/local/bin/ivtv-tune -d /dev/video$DEVICE -t $FREQ_TBL -c $1
(nohup /usr/local/bin/delayed_settings.sh $DEVICE \
                                          $BRIGHTNESS \
                                          $HUE \
                                          $SATURATION \
                                          $CONTRAST \
                                          $VOLUME \
                                          $AUDIO_CHANNEL \
                                          $AUDIO_INPUT & exit) &
exit 0


This is the (updated) delayed settings script. It does two important things.

1) It sends the desired settings to the driver for the card in question.
2) It waits and does it again (and again, and ...) this is to make sure that it "gets the last word" with it's settings overriding any settings that MythTV makes after completing it's tuning.

Code:
#!/bin/bash
# Uncomment this for debugging
#set -vx

DEVICE=$1
exec >>/var/log/mythtv/changer$DEVICE.log 2>&1
echo "Called as: $0 $*"

                     # controls:
BRIGHTNESS=${2:-127} # Picture brightness, actually the black level. [0 - 255]
HUE=${3:-0}          # Hue or color balance. [-128 - 127]
SATURATION=${4:-63}  # Picture color saturation or chroma gain. [0 - 127]
CONTRAST=${5:-63}    # Picture contrast or luma gain. [0 - 127]
VOLUME=${6:-60000}   # Overall audio volume. [0 - 65535]
AUDIO_CHANNEL=${7:-stereo}   # One of "multi-standard" "stereo" "lang1" "lang2"
AUDIO_INPUT=${8:-0}  # One of the available audio inputs

CTL_OPTS="-d /dev/video$DEVICE"
echo ; echo Settings before:
/usr/local/bin/ivtvctl $CTL_OPTS -l
for i in 0 2 4 6 8 10 ; do
    /usr/local/bin/v4l2-ctl $CTL_OPTS -c brightness=$BRIGHTNESS >/dev/null
    /usr/local/bin/v4l2-ctl $CTL_OPTS -c hue=$HUE               >/dev/null
    /usr/local/bin/v4l2-ctl $CTL_OPTS -c saturation=$SATURATION >/dev/null
    /usr/local/bin/v4l2-ctl $CTL_OPTS -c contrast=$CONTRAST     >/dev/null
    /usr/local/bin/v4l2-ctl $CTL_OPTS -c volume=$VOLUME         >/dev/null

    /usr/local/bin/v4l2-ctl $CTL_OPTS -T $AUDIO_CHANNEL
    /usr/local/bin/v4l2-ctl $CTL_OPTS --set-audio-input $AUDIO_INPUT

    sleep 2
done
echo ; echo Settings after:
/usr/local/bin/v4l2-ctl $CTL_OPTS -l
echo


BTW - Running "v4l2-ctl --help | more" and playing with the options is very helpful for understanding what this script does and highly recommended... Using scripts like this without understanding what they're intended to do and at least an outline of how they work, is like "washing" your clothes in a food processor. The results are likely to be less than satisfactory.

(*) You set your external channel changer script in mythtv-setup under "Input Connections". External channel changers are an "escape" mechanism to tune devices like cable boxes which MythTV can't control directly. We're abusing that escape mechanism, using it for a device that MythTV could control directly, so that we can apply other settings along with each channel change.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 30, 2007 1:26 pm 
Offline
Joined: Sat Dec 24, 2005 11:33 am
Posts: 400
Location: Kitsap Peninsula, Wa., United States
TJC, thanks for your kind inputs in here. I believe it is with the attempts and support of everyone in the community The product only gets better.
I know you have certainly steered me down the right roads and helped me bunches.

So, my question, I have a PVR -150 My main tuner that exhibits the Tinny Audio problem occasionally. IT is the oldest of all my tuners as far as firmware, so there may be a correlation there.

I am trying to determine based on the posts here what is the correct files to put in. This is my MBE and only has one tuner /dev/video0 and I use the S-Video inputs on it.

I control Dish Network boxes and here is my change_channel.sh script.
Code:
#!/usr/bin/perl

# make sure to set this string to
# the corresponding remote in /etc/lircd.conf
$remote_name = "blaster";

# Let's assume you don't need to press enter after you punch in a
# channel number. Change this to 1 if your cable box expects you press
# enter after each command
$needs_enter = 0;

# Change this to point to your rc executable
$rc_command = "/usr/bin/irsend";

# This subroutine actually sends the signal to the cable box
sub change_SIGNAL {
    my($SIGNAL) = @_;
    system ("$rc_command SEND_ONCE $remote_name $SIGNAL");
}

$SIGNAL=$ARGV[0];
open F, ">> /var/log/channel.log";
print F "channel changing $SIGNAL\n";
close F;
print "channel changing $SIGNAL\n";

# Checks if $SIGNAL begins with a digit
# If it detects that the string is made up of digits, then it puts
# spaces between the digits.  Ex. 1234 becomes 1 2 3 4
if ( $SIGNAL =~ /^\d+$/ )
{
    my $length = length($SIGNAL);
    my $counter = 0;
    my $temp;

    while( $counter < $length )
    {
        $temp .= substr($SIGNAL,$counter,1) ." ";
        $counter++;
    }

    change_SIGNAL($temp);
}
else
{
    # argument we passed was not made up of digits, so it must be a
    # command that does something other than channel changing on the
    # cable box
    change_SIGNAL($SIGNAL);
}

# Do we need to send enter
if ( $needs_enter )
{
    system ("$rc_command SEND_ONCE $remote_name ENTER");
}


This script works flawlessly for changing my channels. As long as Blaster is working I have not had a misfire.

Can you please provide assistance as to how I can attempt to fix the Tinny Audio it sounds like this script fixes it, I jut am not sure how to apply it.

TIA.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 01, 2007 7:30 am 
Offline
Joined: Mon Feb 20, 2006 8:32 am
Posts: 27
TJC - Thanks.. My problem was that I was calling it from my .pl channel changing script. I will try to put it in "Input Connections" instead.

_________________
-hunter


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 01, 2007 6:48 pm 
Offline
Joined: Wed Jan 04, 2006 10:20 am
Posts: 387
Location: South New Jersey, USA
Maybe a stupid question but is there a reason that the v4l2-ctl command cound not just be put into a cron job to run every minute? I suppose you could wind up with up to a minute of tinny sound but it would straighten itself out after that.
Am I missing something?

_________________
LINHES 8.6.1 BE/FE - MSI K9N6SGM-V with AMD A64 X2 4600+, 4GB Ram. 1.5TB WD. HDHR Prime. Nvidia GT210. MCE remote.
FrontEnd - Dell Vostro 400 3.0GHz Core2Duo NVidia GeForce210. MCE Remote


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 01, 2007 7:34 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
It could glitch the recording. Not big deal for the first 20 seconds but every 60 seconds for the duration of the recording is a much bigger exposure.


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 42 posts ] 
Go to page Previous  1, 2, 3  Next



All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu