[pvrusb2] documentation ctl_signal_present

marcel marcel at karsch.nl
Tue Mar 20 14:01:36 CDT 2007


Hi Mike,

Thank you for this great driver! I was especially impressed by the
sysfs interface, beautiful, simple and very unix.

I just finished ripping old video-8 tapes for my father via
composite-in. To automatically detect end or empty tape I was suprised
to find that ctl_signal_present not only works with the television input
but also with the composite input. Probably by checking syncing signals.
So I suggest a document change in doc/controls.txt:

ctl_signal_present - This is a read only boolean value, reports true
    when there is a valid signal present for the television input *or
composite input*.  If
    any other input is selected this will always be true.

Just a few gotchas. This only works with your version 20070207 or
20070127, not the kernel version 2.6.19/20. In your version this ctl is
presented as an integer, 0=false, 65535=true; the kernel version(s)
reports a boolean, true,false.

regards,
Michiel

The following is a quick and dirty script for ripping composite video:

#setting settings
cd /sys/class/pvrusb2/sn-*
#echo s-video >> ctl_input/cur_val
echo composite >> ctl_input/cur_val
#echo 9200000 >> ctl_video_bitrate/cur_val
echo 8000000 >> ctl_video_bitrate/cur_val
echo 8000000 >> ctl_video_bitrate_peak/cur_val
#echo 5000000 >> ctl_video_bitrate/cur_val
#echo 5000000 >> ctl_video_bitrate_peak/cur_val

#echo 62000 >> ctl_volume/cur_val
echo 60000 >> ctl_volume/cur_val
echo 192 kbps >> ctl_audio_bitrate/cur_val
echo Mono >> ctl_audio_mode/cur_val
echo Mono >> ctl_mpeg_audio_mode/cur_val
#echo 44.1 kHz >> ctl_srate/cur_val
echo 48 kHz >> ctl_srate/cur_val
echo 576 >> ctl_resolution_ver/cur_val
echo 4x3 >> ctl_video_aspect/cur_val

#start ripping
#!/bin/bash

check_signal ()
{

    R=$(cat /sys/class/pvrusb2/sn-7771159/ctl_signal_present/cur_val)

    if [ "$R" -eq 0 ]
    then
        echo "no signal" $R
        return 0
    else
#        echo "signal" $R
        return 1
    fi

}

check_still_no_signal ()
{

LIMIT=15

for ((a=1; a <= LIMIT ; a++))  # Double parentheses, and "LIMIT" with no
"$".
do
    sleep 1
    check_signal
    if [ $? -ne 0 ]
    then
        return 1
    fi

done                           # A construct borrowed from 'ksh93'.

return 0

}

# start encoder
mencoder -demuxer 2  -of mpeg -mpegopts format=dvd -oac copy -ovc copy
-o dvd.mpg /dev/video &
CATPID=$!

# kill encoder
#sleep 3785
#kill $CATPID


# wait no video signal
while true
do

    #ff wachte
    sleep 5

    check_still_no_signal
    if [ $? -eq 0 ]
    then

        echo "still no signal: end"
        break

    #else echo "signal detected"  $R

    fi


done

kill $CATPID




More information about the pvrusb2 mailing list