View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 12 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject: Sync switch
PostPosted: Mon Feb 18, 2008 10:49 pm 
Offline
Joined: Wed May 31, 2006 8:19 pm
Posts: 19
Is there a way to setup a keyboard control to allow the "Sync to this display device" to be changed?

I have the VGA output connected to the TV and the DVI connected to a projector. We use the TV most of the time but when we use the projector, I see bad tearing. If I open NVIDIA-SETUP and change the "Sync to display device" to the projector the tearing is much better. Of course, I have to change it back to the TV when we are done with the the projector. The issue is that having to call up NVIDIA-SETUP each time I need to switch back and forth is not ideal.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 19, 2008 8:16 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
The menus are very hackable. Add an entry on the KnoppMyth one to run a toggle script. Create a toggle script that edits your /home/mythtv/.nvidia-settings-rc and then runs nvidia-settings --load-config-only to apply them.

The script would looks something like this (please note I'm only sketching here):

Code:
#!/bin/bash

settings="/home/mythtv/.nvidia-settings-rc"

if grep 'XVideoSyncToDisplay=0' "$settings" ; then
  sed -i~ -e '/XVideoSyncToDisplay/s/=0/=256/' "$settings"
elif grep 'XVideoSyncToDisplay=256' "$settings" ; then
  sed -i~ -e '/XVideoSyncToDisplay/s/=256/=0/' "$settings"
else
  echo "0/XVideoSyncToDisplay=256" >>"$settings"
fi

nvidia-settings --load-config-only

DO NOT USE THIS AS IS!!! Check what the values are when you toggle this from the nvidia-settings GUI and use those rather than 0 and 256. You may also not be on display 0 as shown here. Finally don't forget to put the script in the right place and give it the right ownership and permissions.

For the menu file /usr/share/mythtv/knoppmyth.xml see how the backup/restore scripts are run.(Whoops! The actual execeution has been moved into /usr/share/mythtv/mythbackup.xml) and copy that. Something like:

Code:
   <button>
     <type>VIDEOMODE</type>
     <text>Toggle Video Sync</text>
     <action>EXEC /usr/local/bin/toggleSync.sh</action>
   </button>


Oh and mjl would probably tell you not to edit /usr/share/mythtv/mythbackup.xml directly, but rather to make a private copy somewhere in /home/mythtv and edit that. (and he'd be right to, but I don't remember the where part off the top of my head).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 19, 2008 10:40 pm 
Offline
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location: Warwick, RI
Hi,

And we have never met but he knows me well already :)

I would copy the file into the /home/mythtv/.mythtv/ then when you do an edit it will be be preserved if you do a backup also. Also your original stays in it's pure form. A one time ctl + alt + bksp will activate its usage.

Be advised when playing in the menus, the entries that are not in your language could become trash if you mess with them! What is even worse is that.xml file will not function.
A sample: (using nano)
<text lang="FR">1. Général</text>
could end up looking like: (using less)
<text lang="FR">1. G<C3><A9>n<C3><A9>ral</text>
I don't know how to avoid the charactor change process except avoid using less when coping stuff.

Mike


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 20, 2008 12:15 am 
Offline
Joined: Wed May 31, 2006 8:19 pm
Posts: 19
tjc,

Thanks for the help. I think I have it now. I copied over:
Code:
/usr/share/mythtv/knoppmyth.xml

to:
Code:
/home/mythtv/.mythtv/


I made a new button "SYNC" in my copy of knoppmyth.xml. I created a new file "sync.xml" in /home/mythtv/.mythtv/ which looks like this:

Code:
<mythmenu name="KnoppMyth">

   <button>
     <type>SYNC</type>
     <text>TV</text>
     <action>EXEC /usr/bin/nvidia-settings -a XVideoSyncToDisplay=1</action>
     <action>MENU knoppmyth.xml</action>
   </button>

   <button>
     <type>SYNC</type>
     <text>Projector</text>
     <action>EXEC /usr/bin/nvidia-settings -a XVideoSyncToDisplay=65536</action>
     <action>MENU knoppmyth.xml</action>
   </button>
</mythmenu>



This seems to work. Only issue is that after I press TV or PROJECTOR in my new SYNC menu, it returns me to the KNOPPMYTH menu, which is what I wanted, but if I then press "ESC" it takes me back to my new SYNC menu instead of taking me to the MAIN menu as I would expect. Anyway to make it not do that?

This solution is even better than what I was originally thinking of; THANKS.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 20, 2008 7:06 am 
Offline
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location: Warwick, RI
Hi,

I think you should be able to remove <action>MENU knoppmyth.xml</action>

I put stuff in a script and then run the script.

plan-a.sh
#!/bin/sh
#script for plan A
/usr/bin/nvidia-settings -a XVideoSyncToDisplay=1&

plan-b.sh
#!/bin/sh
#script for plan B
/usr/bin/nvidia-settings -a XVideoSyncToDisplay=65536&

I would put them in /usr/bin make executable for mythtv
cp plan-*.sh /usr/bin/
chmod a+x /usr/bin/plan-*.sh

keep the original scripts in the home mythtv for backup
Mike


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 20, 2008 9:36 am 
Offline
Joined: Wed May 31, 2006 8:19 pm
Posts: 19
mjl wrote:
Hi,

I think you should be able to remove <action>MENU knoppmyth.xml</action>



Mike,

Yes, that is what I had first, but it gave no "feedback" to the user that anything had happened, so I added the menu line. I think some kind of feedback is helpful to the WAF. I'll do more studying, but I wonder if I could do a radio button instead?

As for the script. I will give that a try. It was just too easy this way since I only needed to execute one command :D


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 20, 2008 7:16 pm 
Offline
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location: Warwick, RI
Hi,

I can understand the feedback thing, sort of like that feature myself :) Push a button & I would like to know that the computer understood what is being asked of it. I don't care when it does something so much as it knows I want it done.

You could do similar to as I do, "borrow" some Cecil's code to do a task. :idea:
He has a script called ver.sh which does the version osd trick. Now if you tweak it a little...

osd-msg.sh
Code:
#!/bin/sh
#osd-msg.sh
fontsize="34"
fontcolor="yellow"
export DISPLAY=:0
export FONT="-adobe-helvetica-bold-*-*-*-$fontsize-*-*-*-*-*-*-*"
#top middle bottom
cat /tmp/tts | osd_cat --delay=4 --font=$FONT --shadow=3  --color=$fontcolor --pos=bottom --align=centre &


Basiclly, you stuff your message into /tmp/tts and the call the script.
Modifying the "plan-a.sh" would leave something like..
plan-a.sh
Code:
#!/bin/sh
#script for plan A
/usr/bin/nvidia-settings -a XVideoSyncToDisplay=1&
echo "Settings for plan A executed" > /tmp/tts
sh /usr/bin/osd-msg.sh


Now when the menu choice is selected for plan-a, it should do the switch task and then pop up a 4 second message telling you what it did.

Since it is a variable that is feeding the osd-msg.sh you can re-use it for most any message you might wish to show. The choice of /tmp/tts is I also use festival and it is just a key to remind me.

Again, I put a copy of my executable scripts into /usr/bin and do chmod 755 /usr/bin/<to the script>

Best wishes :)
Mike

Fixed typo in script


Top
 Profile  
 
 Post subject: Working
PostPosted: Fri Feb 22, 2008 12:18 pm 
Offline
Joined: Wed May 31, 2006 8:19 pm
Posts: 19
To close this, I want to thank Mike and tjc for helping. I now have a solution that works, and has a higher WAF than my original question. Here is what I did.

I created several scripts (Yes, I put them all in /usr/bin)

osd-msg.sh to display messages:
Code:
#!/bin/sh
#osd-msg.sh
fontsize="34"
fontcolor="yellow"
export DISPLAY=:0
export FONT="-adobe-helvetica-bold-*-*-*-$fontsize-*-*-*-*-*-*-*"
#top middle bottom
cat /tmp/tts | osd_cat --delay=2 --font=$FONT --shadow=3  --color=$fontcolor --pos=top --align=centre &

id-sync.sh, which displays what the present sync is set to (note, this machine is called FamilyRoom):
Code:
#!/bin/sh
#Display which device is setting the sync
if nvidia-settings -q XVideoSyncToDisplay | grep "FamilyRoom:0.0): 1" ; then
  echo "Presently sync is set to TV" > /tmp/tts
elif nvidia-settings -q XVideoSyncToDisplay | grep "FamilyRoom:0.0): 65536" ; then
  echo "Presently sync is set to Projector" > /tmp/tts
fi
sh /usr/bin/osd-msg.sh

crt-sync.sh, which sets the sync to TV:
Code:
#!/bin/sh
#script to set sync to TV
/usr/bin/nvidia-settings -a XVideoSyncToDisplay=1&
echo "Syncing to TV" > /tmp/tts
sh /usr/bin/osd-msg.sh

dfp-sync.sh, which sets the sync to the projector:
Code:
#!/bin/sh
#script to switch sync to projector
/usr/bin/nvidia-settings -a XVideoSyncToDisplay=65536&
echo "Syncing to Projector" > /tmp/tts
sh /usr/bin/osd-msg.sh

I modified knoppmyth.xml to display the present sync setting and call the new menu to allow me to set which device to sync to (this is in /home/mythtv/.mythtv):
Code:
<mythmenu name="KnoppMyth">

   <button>
     <type>SYNC</type>
     <text>Sync to TV or Projector</text>
     <action>EXEC /usr/bin/id-sync.sh</action>
     <action>MENU sync.xml</action>
   </button>

   <button>
     <type>BACKUP</type>
 .......

and created a new menu (sync.xml), also in /home/mythtv/.mythtv:
Code:
<mythmenu name="KnoppMyth">

   <button>
     <type>SYNC</type>
     <text>TV</text>
     <action>EXEC /usr/bin/crt-sync.sh</action>
   </button>

   <button>
     <type>SYNC</type>
     <text>Projector</text>
     <action>EXEC /usr/bin/dfp-sync.sh</action>
   </button>
</mythmenu>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 22, 2008 12:44 pm 
Offline
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location: Warwick, RI
Hi,

Give you a piece of thread and you run with it :)

For future reference, "export DISPLAY=:0" allows you to execute the osd script from a term window which is handy while "researching"

Enjoy!
Mike


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 22, 2008 6:50 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
Yeah, I'd say that's worthy of my seldom awarded "clue snatcher of the day" honors, for outstanding achievements in grabbing a clue and running with it. :-D

You did good!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 24, 2008 11:30 am 
Offline
Joined: Wed May 31, 2006 8:19 pm
Posts: 19
tjc wrote:
Yeah, I'd say that's worthy of my seldom awarded "clue snatcher of the day" honors, for outstanding achievements in grabbing a clue and running with it. :-D

You did good!


Thanks for the kind words. This solution works good, but the "cat's meow" would be if I could put in in the menu that pops up while watching recordings. What I find is that I forget to set it to the right device until I start to watch something and then notice the tearing. At that point, I must exit the show, and find my way back to the Knoppmyth menu and select the device I want. Sure would be nice if I could just call up the menu while watching the show and select the device from there.

So looking for a clue :?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 24, 2008 11:43 am 
Offline
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location: Warwick, RI
Hi,

Suppose you _could_ use a "spare" remote button.... However, the sync change may not kick in while the card is active. You _could_ make a submenu under watch tv so you would have the chance to toggle the sync prior to selecting tv, or select watch recordings, or the other tv tools.

Yes, that means you have to press ok twice to "watch tv" :) Exhausting just to think of having to push one button twice...

Mike


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 3 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:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu