How to default display to TV attached to laptop
#1
Hi there,

I am running XBMCLive (Camelot) on a HP Laptop with a nvidia graphics card.

The laptop is connected to my TV via the HDMI port on the laptop.

My issue is that I would like the video output to default to display on the TV on startup of XBMC.

Currently display defaults to the laptop screen and after XBMC loads I must hit fn-f4 to switch to TV output. As the laptop is hidden in my entertainment cabinet, it is a pain to do this.

Is there any way to force XBMC to default to display on the TV rather than the built in laptop screen?

I note that windows would default to displaying on the TV when the laptop was connected to it via HDMI.

My system details are:

XBMC version: XBMC 9.11 R26018 [i.e. camelot]
Operating System: Linux 2.6.31-16-generic #53-Ubuntu SMP
GPU: GeForce 8400M GS/PCI/SSE2/3dNOW!
OpenGL version: 3.2.0 Nvidia 190.53
CPU: AMD Turio™ 64 X2 Mobile Technology TL-60
RAM:2gb
Architecture: i686
Debug log: http://pastebin.com/EgCGhMDN

I am reasonably new to linux, but am comfortable with the command line and manually editing settings. Please let me know if you need any more information.

Thanks very much.

Mark.
Reply
#2
You need the Xrandr command to do this. You should find out what resolution you want to run it on (and which ones your external screen supports) and set it accordingly.

For example, this is what xrandr reports on my laptop (which has a VGA out, not connected):
Code:
$ xrandr
Screen 0: minimum 320 x 200, current 1366 x 768, maximum 4096 x 4096
VGA1 disconnected (normal left inverted right x axis y axis)
LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1366x768       60.0*+
   1024x768       85.0     75.0     70.1     60.0  
   832x624        74.6  
   800x600        85.1     72.2     75.0     60.3     56.2  
   640x480        85.0     72.8     75.0     59.9  
   720x400        85.0  
   640x400        85.1  
   640x350        85.1

You'll need something like
Code:
xrandr --output VGA1 --auto
which you can put in rc.local.
* MikroTik RB5009UG+S+IN :: ZyXEL GS1900-8HP v1 :: EAP615-Wall v1 :: Netgear GS108T v3 running OpenWrt 23.05
* LibreELEC 11:  HTPC Gigabyte Brix GB-BXA8-5545 with CEC adapter, Sony XR-64A84K :: Desktop AMD Ryzen 7 5800X / Sapphire Nitro+ Radeon 6700XT  / 27" Dell U2717D QHD
* Debian Bookworm x86_64: Celeron G1610, NFS/MariaDB/ZFS server
* Blog
Reply
#3
Cheers .:B:., thanks for the reply and putting me onto xrandr.

However, I cannot seem to identify the outputs on my laptop. When I run xrandr I get:

Quote:xbmc@XBMCLive:~$ xrandr
Can't open display

I get the same response when I use any other commands too (e.g. -q, -v, etc etc)

If I use xrandr -d :0 -q, I get the following:

Quote:xbmc@XBMCLive:~$ xrandr -d :0 -q
Screen 0: minimum 320 x 175, current 1280 x 800, maximum 1280 x 800
default connected 1280x800+0+0 0mm x 0mm
1280x800 50.0*
1024x768 51.0 52.0
960x540 53.0
840x525 54.0
832x624 55.0
800x600 56.0 57.0 58.0 59.0 60.0
800x512 61.0
720x450 62.0
720x400 63.0
700x525 64.0
680x384 65.0 66.0
640x512 67.0 68.0
640x480 69.0 70.0 71.0 72.0 73.0
640x400 74.0
640x350 75.0
576x432 76.0 77.0 78.0 79.0 80.0 81.0
512x384 82.0 83.0 84.0 85.0 86.0
416x312 87.0
400x300 88.0 89.0 90.0 91.0 92.0
360x200 93.0
320x240 94.0 95.0 96.0 97.0
320x200 98.0
320x175 99.0

However, this doesn't appear to be showing the monitors attached to the laptop (only shows 'default') so I cannot find the right output to use the command you suggested.

Do you know what an HDMI output is usually called? I have tried TDMS-1, TDMS1, DVI-1, DVI1, TV-1, TV1 but have had no luck.

According to xrandr -d :0 -v my xrandr version is 1.3.

Cheers.
Reply
#4
You cannot run Xrandr like that in a tty (I assume you did something like ctrl+alt+f1, logged in, then ran xrandr).

You need to run it from within a terminal emulator in X. What you could do if you cannot run a regular desktop environment on the Xbmc live CD is get the regular Ubuntu live CD, boot that, open a terminal on the desktop and save the values you see there (you can also test the xrandr commands in the Ubuntu environment, they should be identical).
* MikroTik RB5009UG+S+IN :: ZyXEL GS1900-8HP v1 :: EAP615-Wall v1 :: Netgear GS108T v3 running OpenWrt 23.05
* LibreELEC 11:  HTPC Gigabyte Brix GB-BXA8-5545 with CEC adapter, Sony XR-64A84K :: Desktop AMD Ryzen 7 5800X / Sapphire Nitro+ Radeon 6700XT  / 27" Dell U2717D QHD
* Debian Bookworm x86_64: Celeron G1610, NFS/MariaDB/ZFS server
* Blog
Reply
#5
Thanks for all the help .:B:. I now have xbmc starting up and defaulting the display to the TV on the HDMI.

Yes, I was trying to run xrandr in a tty after ctrl+alt+f2 from XBMCLive.

I used a desktop terminal in Ubuntu to run xrandr and it worked perfectly. I identified the HDMI port as DVI-D-1.

I then added the following to rc.local to turn the laptop LCD off and switch to the TV over HDMI:

Quote:xrandr --output DVI-D-1 --auto
xrandr --output LVDS-1 --off

However, while the above worked in Ubuntu, the xrandr commands would not run from rc.local in XBMCLive. I know rc.local was running before I inserted these lines as I already used it to enable my wiiremote.

In the end I found a solution by editing my xorg.conf file. I added the line in bold below to the screen section:

Quote:Section "Screen"
Identifier "Screen0"
Device "Device1"
Monitor "Monitor0"
DefaultDepth 24
Option "ConnectedMonitor" "DFP-1"
Option "NoLogo" "True"
Option "HWCursor" "false"
SubSection "Display"
Depth 24
EndSubSection
EndSection

The 'ConnectedMonitor' option forces it to default to DFP-1 (my TV - I got the monitor reference from /var/log/xorg.0.log). It all seems to be working well so far, it has survived several reboots, with the TV switched both on or off.

Thanks very much for all your help.
Reply
#6
You're welcome, glad to see you got it sorted out Smile.
* MikroTik RB5009UG+S+IN :: ZyXEL GS1900-8HP v1 :: EAP615-Wall v1 :: Netgear GS108T v3 running OpenWrt 23.05
* LibreELEC 11:  HTPC Gigabyte Brix GB-BXA8-5545 with CEC adapter, Sony XR-64A84K :: Desktop AMD Ryzen 7 5800X / Sapphire Nitro+ Radeon 6700XT  / 27" Dell U2717D QHD
* Debian Bookworm x86_64: Celeron G1610, NFS/MariaDB/ZFS server
* Blog
Reply
#7
.:B:. Wrote:You cannot run Xrandr like that in a tty (I assume you did something like ctrl+alt+f1, logged in, then ran xrandr).

You can also export the display so you can use xrandr:

Code:
# xrandr
Can't open display

# export DISPLAY=:0
# xrandr
Screen 0: minimum 320 x 200, current 1280 x 768, maximum 8192 x 8192
VGA-0 connected 1024x768+0+0 (normal left inverted right x axis y axis) 304mm x 228mm
   1024x768       60.0*+   75.1     70.1
   800x600        72.2     75.0     60.3     56.2
   640x480        72.8     75.0     60.0
   720x400        70.1
HDMI-0 connected 1280x720+0+0 (normal left inverted right x axis y axis) 160mm x 90mm
   1280x720       60.0*+
   1920x1080      60.0 +
   720x480        59.9
   640x480        60.0

Just an FYI for anyone looking to do the same thing.
Reply
#8
Hi, all,

thank you very much for the info.
now I don't have to wait for my htpc to boot up looking to it's startup screen.

by the way, anybody knows if there's a way to save the screen calibration and resolution, so I don't have to adjust them every time I start my htpc?
Reply

Logout Mark Read Team Forum Stats Members Help
How to default display to TV attached to laptop0