I'm using a somewhat old laptop as the brains of my MAME machine. It's plugged to a really old 15" CRT via VGA. I love this screen because old games run fine and it produces a lovely ghost trail on games with black background (galaga, asteroids, pong, etc). The machine is Running Linux Mint 17.1 with XFCE and nvidia legacy 304 drivers. I've set up a session that logs in automatically and launches Attract-mode (the frontend for emulators).
Laptop screen is off and it's only sending video to the VGA monitor (480x640 since it's vertical-oriented). What I would like to know is if it's possible to somehow create a script that I could "launch" from the front-end which would:
Switch to HDMI output @ 1920x1080x60 (disable VGA and laptop)
Launch kodi (formerly XBMC)
kill attract-mode (frontend)
Change audio device from line-out (headphone jack on laptop) to HDMI
keep working while kodi is on; on kodi exit:
switch back to VGA @ 480x640x59.94 (disable all other screens)
switch back to line-out speakers
launch attract-mode
and as a final nut in the bolt, I'd need this to be transparent, since the primary users of my arcade machine are my parents. (i.e. don't ask for sudo pass, script could have it in plain text since the machine is offline most of the time)
I found bits and pieces but I can't figure out how to integrate all stuff in one single script.
xrandr switch --> http://ubuntuforums.org/showthread.php?t=1243541&p=7813964#post7813964
audio switch (?) --> http://forums.linuxmint.com/viewtopic.php?f=198&t=149928
The idea behind this, having a HTPC AND an arcade machine. Since my arcade is basically a bartop on top of my AV rack, I have all connections available for both uses.
Any help or tips are greatly appreciated!
i think it's possible, just got done writing a bash script that sould work. i just have to test it.
1 Like
I also stumbled upon another possible solution. Screwing around with the nVidia control panel I found out I could have the TV as a separate XScreen. Although I tinkered around it for a while I didn't have time to test/learn/configure it to do something similar: Have the TV as screen 1 and start a separate session there with XBMC as session type.
I could manage to configure XBMC to use only HDMI and from there it's easy peacy: Even though I could not interact directly with it (kb/mouse) I could use remote apps like Yatse on my cell phone or tablet.
ok, i think i got the script figured out. the script is setup to turn off the laptop display, then set the display to vga and sound to analog-stereo then launch attract-mode. when you exit attract-mode it will turn off vga and set the display to hdmi, set sound to hdmi-stereo then launch xbmc/kodi. that is if there's a good way to exit attract-mode. then when xbmc/kodi exits it will repeat. when you want to exit everything you just have to echo 1 > /home/USER/willdrick_script.conf and exit out of whatever is running, which isn't the best but it works ok for now until i can think of something better. when the loop exits it zeros out the conf file, sets sound to analog-stereo, and turns off vga and hdmi display output an turns on the laptops. or whatever you decide to change it to. that is if the script works right.
i did some testing and it all seems to work good i just don't have an hdmi display. so i tested with a old vga monitor and a laptop. i could do more testing but i'm busy with work for the next few days, so i figured i would just post it now and if there are problems i'll look at it later.
script just make sure you don't copy the line numbers ---> http://paste.ubuntu.com/10693393/
there's some comments in the script telling you what you might have to change.
1 Like
dammit I can't like that post more than once so here:
+1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1
Your script's almost perfect and I couldn't have done it nearly as elegantly as you did. It could be easily fixed but I found out a nice byproduct; if I close Attract and then close kodi, attract starts again but in the HDMI screen, so I just added my horizontal screen romset as a separate collection!
Just in case somebody else needs this working at 100%, there's something off whith the xrandr modes. I've been reading about how to add them but have yet to find the way.
When I start the script on a terminal, I get an output "480x640 mode not found". So I tried using "640x480 -o left" but then I get something like " ]] not found". Since I'm nowhere near as skilled I am stumbling around your code (btw 1000 thanks for commenting it!) I might take some time to figure it out. Seems I need to add a new mode but I couldn't figure out the synthax for xrandr --addmode or --newmode yet.
You are effin genius, I can't thank you enough!
Now that software is a-ok I can start building the actual cabinet to put on top :D
1 Like
lol thank you
looked like an easy fix so i updated the script. the problem with attract was that the display or video out didn't support that resolution, i just grabed the numbers from your first post and used those. so i think the problem with xrandr not rotating the screen is because of the wrong resolution, as you said it errored out so it probably didn't read any other options. so we can just set it to --auto and let xrandr set the resolution for us. then the problem with attract ending up on the hdmi screen was a typo. the xrandr command was xrand --output "$VGA" --off --output "$VGA" then the wrong resolution. it should have been xrandr --output "$HDMI" --off --output "$VGA" then the wrong resolution lol.
having xrandr set the resolution for use will make it a lot easyer for others to use, and without throwing errors you sould be able to use -o left to rotate the screen, at least i think so. never used xrandr before this lol.
also added a command to the comments to help with finding out if you need to change /edp/ in the for the primary display, and i commented out the xrandr hdmi line for kodi that was working, and changed it to use --auto instead. if it stops working you can just uncomment the line, remove the leading # and erase the new line below it.
updated script ---> http://paste.ubuntu.com/10698944/