Please accept the attached patch for utils/change-channel.sh
The following changes have been made:
- Fixed complaint from "find" concerning arg type stated before mindepth
and maxdepth args. Now rearranged into a more proper ordering of
maxdepth, mindepth, type effectively silencing the complaint.
- Added quotes around echo statements providing better syntax especially
when viewing the script within a text editor.
Additional notes:
1) How about using "locate" to find xawtv related files and using a
variable for preference of file name omitting ".list"?
ie.
FREQ="ntsc-cable"
or
FREQ="pal-bcast-cn"
2) Maybe a simple conversion of "/bin/sh" to "/bin/bash"?
3) Using $HOME variable for just using /root/.tv/freqs since it's
requiring root access. Even using sudo, the script is just going to
look in /root/.tv/ anyways? (This gets rid of the static anonymous user
at the top of the file and could also test & mkdir the config file.)
4) After all this, this omits users whom don't have xawtv installed as a
dependency. A solution is needed for those whom simply uncompress xawtv
to their home folder. (ie. copy over this preferred freq file to .tv)
Do I remember correctly & hear sysfs is going to be no longer used? If
so, ignore my ramblings and just take the patch. Also, see mplayer is
very close to being able to changing channels using it's -tv and -tvscan
options.
--
Roger
http://www.eskimo.com/~roger/index.html
Key fingerprint = 8977 A252 2623 F567 70CD 1261 640F C963 1005 1D61
Fri Nov 2 22:28:08 AKDT 2007
--- change-channel.sh.orig 2007-11-02 18:53:01.000000000 -0800
+++ change-channel.sh.roger 2007-11-02 19:01:47.000000000 -0800
@@ -52,20 +52,20 @@
#check first if we are root
if [ $UID != "0" ]
then
- echo You need to be root to change channels
+ echo "You need to be root to change channels"
exit
fi
#check parameters
if [ $# == "0" ]
then
- echo Usage is $0 \<channel id\>
- echo e.g. $0 S10
- echo Use $0 -list to get a list of available channels
+ echo "Usage is $0 \<channel id\>"
+ echo "e.g. $0 S10"
+ echo "Use $0 -list to get a list of available channels"
exit
else if [ $1 == "-list" ]
then
- echo Available channels are:
+ echo "Available channels are:"
grep "\[" $FREQUENCY_FILE|tr -d "[,]"
exit
fi
@@ -78,22 +78,21 @@
#that means the channel id was not found
if [ $freq == "000" ]
then
-echo Could not find channel with id $CHANNELID
+echo "Could not find channel with id $CHANNELID"
exit
else
-echo Found frequency $freq for channel $CHANNELID
+echo "Found frequency $freq for channel $CHANNELID"
fi
#Change the channel for all pvrusb2 cards to that of $freq
if [ -x /sys/class/pvrusb2/ ]
then
-ids=`find /sys/class/pvrusb2/ -type d -maxdepth 1 -mindepth 1`
+ids=`find /sys/class/pvrusb2/ -maxdepth 1 -mindepth 1 -type d`
for id in $ids
do
echo $freq > $id/ctl_frequency/cur_val
done
else
-echo PVR USB2 sysfs interface not found
+echo "PVR USB2 sysfs interface not found"
fi
-
_______________________________________________
pvrusb2 mailing list
[email protected]
http://www.isely.net/cgi-bin/mailman/listinfo/pvrusb2