How to switch from HDMI to composite on XBMC exit - Printable Version +- Forum (http://forum.xbian.org) +-- Forum: Software (/forum-6.html) +--- Forum: Others (/forum-24.html) +--- Thread: How to switch from HDMI to composite on XBMC exit (/thread-338.html) |
How to switch from HDMI to composite on XBMC exit - udrnovsek - 25th Jan, 2013 10:27 AM Hello! I pretty newbi on linux, xbian and XBMC. But i'm learning . My situation: i have raspi connected to composite monitor and HDMI projector. Unfortunatly this video outputs cannot be active both at same time. Because it's not practical to switch on a projector just for select another music or radio station ob Raspi i use composite monitor for music manipulation and when i want watch video i turn on projector and switch video output on Raspi to HDMI. I can switch between both with following scripts executing them from ssh session from remote computer... HDMIon.sh Terminal echo "Stop XBMC..." sudo service xbmc stop echo "Set resolution for composite output..." sudo fbset -xres 1920 -yres 1080 -vxres 1920 -vyres 1080 echo "Turn on composite output..." tvservice --explicit="CEA 16" sudo service xbmc start echo "XBMC started on HDMI output" ...and back to composite output... COMPOSITEon Terminal echo "Stop XBMC..." sudo service xbmc stop echo "Set resolution for composite output..." sudo fbset -xres 480 -yres 400 -vxres 480 -vyres 400 echo "Turn on composite output..." tvservice --sdtv="PAL 16:9" sleep 3s sudo service xbmc start echo "XBMC started on composite output" I have an idea to simplify this switching this way: when i exit from XBMC, i can test the state of HDMI by execute following command... xbian@malinca:~# tvservice -s state: HPD low|HDMI off|PAL mode|composite CP off (0x180001), 720x576 @ 50Hz, interlaced ...with bach script i can test the output of the command and depending on state of HDMI i would start appropriate script to restart XBMC on hdmi or composite output. This way i could switch from one output to other and viceversa with a selecting XBMC exit (or reboot, or whatever in exit menu) without need for other computer and ssh session. So please help me with suggestions and your knowledge. How start a script on exit or reboot XBMC or even better how to customize XBMC PowerOff menu to add in list new item like 'Switch VIDEO OUTPUT' (or change the action of existing item) and on selection exit from XBMC, chage video output of Raspi and then automaticaly again start XBMC. Thanks! RE: How to switch from HDMI to composite on XBMC exit - CurlyMo - 25th Jan, 2013 10:39 AM Everything you need is in the following file: Code: /etc/init.d/xbmc However, we update that file without prior notice in subsequent updates. RE: How to switch from HDMI to composite on XBMC exit - rikardo1979 - 25th Jan, 2013 06:15 PM I do not have an answer for your question but I have another two options for you Both involved extra devices Option 1 You would need the HDMI Switcher/Converter With this you can out the HDMI signal into this device from where you switch between passing HDMI to your projector or RCA into your TV. There may be a device what do both simultaneously Option 2 You would need an Android or iOS device If you have any of those you can use remote application such as Yatse, Official XBMC Remote/iOS , Official XBMC Remote/Android, XBMC Constellation, etc With this applications no screen is needed if you want to play just a music. Not sure that this would be any help for you but the options are here RE: How to switch from HDMI to composite on XBMC exit - udrnovsek - 29th Jan, 2013 07:47 AM Thank you both for your answers. I will try without additional devices. Otherwise the Option1 is probably feasible. About Option 2 / my family companions said "its alredy too much devices in use" we are confused! Less is more they say . I will report if i'll be able to set the 'soft' switch. RE: How to switch from HDMI to composite on XBMC exit - udrnovsek - 29th Jan, 2013 12:28 PM This is the solution for me (at least first acceptable version) Code: # Test first run RE: How to switch from HDMI to composite on XBMC exit - CurlyMo - 29th Jan, 2013 07:48 PM A few improvements: Code: if [ $(($(tvservice -s | grep -c "HDMI off"))) -eq 1 ]; Code: if [ $(tvservice -s | grep -c "HDMI off") -eq 1 ]; That while loop is totally unnecessary. Just run your script on start and stop. And especially, without a sleep it draws a lot of system resources. Also notice that we don't add fbset to sudoers anymore in future versions. So, readd it after the next update to Alpha 5. The same counts for the XBMC init script. That has changed quite a bit, so make sure to make a backup. RE: How to switch from HDMI to composite on XBMC exit - udrnovsek - 29th Jan, 2013 09:25 PM Thanks for your hints. I tried some options without loop but at last this one i posted worked for me. I'm not familiar with bash scripting (yet). The loop is there cause i don't want to exit into system console. I just want that XBMC is restarted again every time i select EXIT from the xbmc menu. After exit XBMC it restarts and appears on composite output and after next exit restarts automatically and appear on hdmi output. I use only mouse (no keyboard) on the Raspi (in my ht room) so i cannot type into console 'xbmc start' or 'xbmc stop'. It would helped me much (and others) if i could find in documentation some description about how the startup process of the xbian/xbmc goes (what scripts are invoked in what sequence) and the of course the stop sequence. Anyway guys, you are doing a great job. Hat off. RE: How to switch from HDMI to composite on XBMC exit - CurlyMo - 29th Jan, 2013 09:42 PM XBMC is invoked as last. As least include a sleep instead a full blown loop. |