LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   How to set capture card to channel 3 at start-up (https://www.linuxquestions.org/questions/linux-hardware-18/how-to-set-capture-card-to-channel-3-at-start-up-804792/)

Linux31 04-28-2010 12:06 PM

How to set capture card to channel 3 at start-up
 
I'm running VideoLan (VLC) under Ubuntu 9.1 (Karmic) (64-bit) with a Haupaugge-150 card. Right now when I want to get the TV feed in through the coax, I first have to run "ivtv-tune -c3" to set the channel for cable.

I've tried adding a line to the vlc.config but no joy. Googling found an answer for Fedora but it doesn't match the files I'm seeing in those directories for Ubuntu.

What I'd like would to have ivtv set the channel automatically at boot or start-up. Any suggestions?

Thanks for the help.

tredegar 04-29-2010 12:33 PM

You could just make a "wrapper" script, like this:

Code:

#!/bin/bash
ivtv-tune -c3
vlc whatever options you require

Call it watchtv
Make it executable:
Code:

chmod  +x  /path/to/watchtv
Put it somewhere on your $PATH ( /usr/local/bin perhaps ? )
Make a link-to-application to it from your desktop, or menu-system.

Alternatively, perhaps you could put ivtv-tune -c3 in rc.local on a line before the final exit 0 and the channel should be set before you have even logged in.

Linux31 04-30-2010 10:42 AM

Thanks for the suggestions.

I tried the rc.local one but still am not having any success. As far as I can tell, using the chmod command and checking the permissions, it should work. Also, the check box is checked about making the files executable when I right-click on the file.

Here's what I have.

#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
ivtv-tune -c3

exit 0

I've also tried it with and without a hash mark in front of "rc.local" but no go.

I'm sure it's not a setting in VLC because as soon as I type in "ivtv-tune -c3" in the terminal, the picture and audio immediately start. It's as if, for some reason, I still have not successfully made rc.local an executable.

Anything look off here?

Thanks again for the help.

tredegar 04-30-2010 11:12 AM

Your rc.local looks fine, except I think you need the /full/path/to/ivtv-tune
find out what this is with which ivtv-tune

You could also direct any errors from the command to a file
Code:

/full/path/to/ivtv-tune  -c3  &>  /home/linux31/ivtv-tune.log
If you are not sure rc.local is being run, add another line to it:
Code:

touch /home/linux31/rc.local.ran
Does the file /home/linux31/rc.local.ran get created ?

Do not remove the # on the # rc.local line !

Linux31 05-01-2010 09:42 AM

Thanks for the suggestions. I made the changes to rc.local you mentioned (see below) and they produced the .log and .ran files, however both were empty and the channel is still not being set. I used Ubuntu's file browser to verify that /usr/bin/ivtv-tune is the only copy of that file on the machine.

The funny thing is that if I type just "ivtv-tune -c3 in the terminal window, it works, but no matter how I type it in rc.local, it won't. Since the .log and .ran files are being created, I take that to mean that it's not a problem with rc.local, as such, but getting ivtv-tune to start from within it.

Since there is an "exit 0" at the end, should there be something at the beginning like "start 0"?

Does this suggest anything? Thanks again for the help.

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/usr/bin/ivtv-tune -c3
/usr/bin/ivtv-tune -c3 &> /home/me/ivtv-tune.log
touch /home/me/rc.local.ran
exit 0

tredegar 05-01-2010 10:09 AM

Not sure what is happening here, and I don't have a TV card.

The fact that the two files are being created means that rc.local is being run, and there were no errors from the ivtv-tune command. But it did not do what you wanted (Maybe the wrong channel is being set when you login, or start your TV viewing program, I don't know).

The final exit 0 means "Exit this script, with an error number of zero.
An "error number" of zero means "There was no error". Any other number should reflect some sort of error.

Maybe time to try something different...
Put rc.local back as it was.

Make a "wrapper script" as I said in post #2 ( perhaps you have to start vlc before you give the ivtv-tune command ?)

Linux31 05-02-2010 05:55 AM

Thanks for the suggestions. Channel 3 is correct so that's not it. I'm closer than I was before since I now know it's the rendering of the ivtv command. I'll keep working on it. Since I'm also trying to learn how to set up a cron job to schedule the card to record a program, it may be time to find a good book on Linux shell commands and syntax. Googling has been more miss than hit with some conflicting information.

But anyway, thanks again for your help. It's gotten me closer to a solution.


All times are GMT -5. The time now is 05:22 AM.