I have a touchscreen lcd display connected to Raspberry PI 2. Everything works fine: os is booting etc.
If I connect an external monitor via hdmi, I get some output on the monitor and some output logs on the display (probably the same), then the GUI is loaded on the display, not on the external monitor.
The last relevant log on monitor is:
led pin not set, exiting.
However, the display works.
How can I switch between displays? If possible, I'd like to choose between:
- having one active display output (choose between connected displays: hdmi or lcd)
- displaying same thing on both outputs
I'd prefer using command line to switch between these. Is it possible?
Relevant output:
$ xrandr | grep "^[[:alpha:]]"
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 480 x 320, current 480 x 320, maximum 480 x 320
default connected 480x320+0+0 0mm x 0mm
Almost found the solution
Since tvservice -s
shows us that my raspberry detects my HDMI monitor, I inspired from this post and did the following:
Edited the
/etc/modules
file and commented (#
) the lines regarding the LCD screen. In my case they were the last three lines:#flexfb width=320 height=480 regwidth=16 init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x00,0x00,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0x36,0x28,-1,0x11,-1,0x29,-3 #fbtft_device debug=3 rotate=90 name=flexfb speed=16000000 gpios=reset:25,dc:24 #ads7846_device model=7846 cs=1 gpio_pendown=17 keep_vref_on=1 swap_xy=1 pressure_max=255 x_plate_ohms=60 x_min=200 x_max=3900 y_min=200 y_max=3900
Added the following in
/etc/rc.local
, beforeexit 0
:################################################ # HDMI / LCD ################################################# echo "is it HDMI or DMT?" > /home/pi/tft.log /usr/bin/tvservice -s >> /home/pi/tft.log if (/usr/bin/tvservice -s | /bin/egrep 'HDMI|DVI') ; then echo "HDMI / DVI screen" >> /home/pi/tft.log else echo "switch on PiTFT" >> /home/pi/tft.log modprobe flexfb width=320 height=480 regwidth=16 init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x00,0x00,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0x36,0x28,-1,0x11,-1,0x29,-3 modprobe fbtft_device debug=3 rotate=90 name=flexfb speed=16000000 gpios=reset:25,dc:24 modprobe ads7846_device model=7846 cs=1 gpio_pendown=17 keep_vref_on=1 swap_xy=1 pressure_max=255 x_plate_ohms=60 x_min=200 x_max=3900 y_min=200 y_max=3900 startx fi
Reboot
Now when the HDMI monitor is:
connected, the LCD remains white and the monitor is used, but it cannot start the GUI. However, I can access the TTYs (by pressing CTRL + ALT + F1). If I write
startx
it shows meno screens found error
(maybe you have some suggestions here, I think that's why the GUI is not started)not connected, the LCD is used and GUI starts on it normally which is fine.
So, how can I make the GUI work on the HDMI monitor as well? Who says do not start GUI but allow TTYs?
xrandr | grep "^[[:alpha:]]"
with both screens attached; you'll have to run that from a GUI terminal, not the plain console.tvservice -s
my HDMI monitor is detected.startx
outputsfatal server error: no screen found
. I have terminal tty access on the hdmi monitor. Do you know how to activate the monitor (maybe usingmodprobe
?)?