3

After installing the LCD display drivers, I cannot start GUI on external monitor connected via HDMI.

A solution to this problem will probably be a solution to a more general issue I have.

So, is this an expected behavior? I think the install script overrides some system files and next time when I boot my Raspberry PI 2, the monitor receives signal from rpi, but I only have TTY access, not being able to start the GUI (startx gives an error that it doesn't find the lcd module).

Here is what the driver install script does:

sudo cp -rf ./etc/modules-35  /etc/modules
sudo mkdir /etc/X11/xorg.conf.d
sudo cp -rf ./etc/X11/xorg.conf.d/99-calibration.conf-35  /etc/X11/xorg.conf.d/99-calibration.conf
sudo cp -rf ./usr/share/X11/xorg.conf.d/99-fbturbo.conf  /usr/share/X11/xorg.conf.d/
sudo cp ./kernel.img /boot/kernel.img
sudo cp ./kernel7.img /boot/
sudo cp ./cmdline.txt /boot/
sudo cp ./inittab /etc/
sudo cp ./boot/config-35.txt /boot/config.txt
sudo cp -rf ./modules /lib/
sudo reboot

I was struggling to create a script to rollback these changes (create backups in this install script, but still no success).

Ionică Bizău
  • 723
  • 3
  • 11
  • 32
  • Does that tarball include some xorg.conf stuff in addition to the drivers? This may explain why X won't use the HDMI display anymore with the LCD attached. If the driver is loaded, it will use the functioning LCD. If the LCD driver isn't loaded, it will still try to use only that and, since it can't, it will then fail. If the LCD isn't attached, it may still not work since the screen X is configured to use is not there. Have a look at /var/log/Xorg.0.log for details. – goldilocks Aug 14 '15 at 15:22
  • @goldilocks Yes, I added the original install script in the question. – Ionică Bizău Aug 14 '15 at 15:35
  • Try moving those conf files to another directory temporarily, rmmod the modules necessary for the LCD, then try startx from the HDMI again. If that doesn't work, try it with the stock Raspbian kernel instead (looks like you will have to get that from an image, since the install may have erased them -- not very nice!). – goldilocks Aug 14 '15 at 15:39
  • @goldilocks I moved /etc/X11/xorg.conf.d/* into my tmp folder. Still the display is working. – Ionică Bizău Aug 16 '15 at 07:05
  • @goldilocks Did the same with /usr/share/X11/xorg.conf.d/99-fbturbo.conf and my HDMI display works fine! :) Thanks a lot! Post an answer. You deserve the points. :) – Ionică Bizău Aug 16 '15 at 07:09
  • @goldilocks Without /etc/X11/xorg.conf.d/*, the touchscreen is not working. So, /usr/share/X11/... is for displaying and the other one for touchscreen. Interesting! :) – Ionică Bizău Aug 16 '15 at 07:14

2 Answers2

3

The GUI stack on GNU/Linux usually requires (at least) two drivers, one used by the kernel, and a userspace one for the X server. I think the latter one tends to be more generic, which is perhaps why there's no indication of one being installed; the kernel one handles the specifics so that a more generic, pre-installed driver can be used with X (in contrast, another question about a touchscreen here yesterday seemed to involve a generic and/or preinstalled kernel driver, but a custom X driver).

The X server does not require a configuration, in which case it probes the hardware and tries to makes an appropriate decision. However, if you do provide a configuration, it will stick to that. If that configuration is wrong, it will fail.

X logs various things at start up to /var/log/Xorg.0.log. It is tidy about this and rolls them over, so that log contains only information from the most recent start (hence you will also find a .1.log and so on, these are for previous initializations). It also indicates going through your configuration line by line.

If you shut down X and move those config files in /etc/X11/xorg.conf.d and /usr/share/X11/xorg.conf.d/, you should be able to start X on the HDMI display, presuming something funny wasn't done with the kernel. At the very least, you should get a more detailed description of the problem in the .log.

If that works, you just need a script (or two) that will symlink and unlink those configuration files depending on which display you want to use. Stupidly enough, xinit and startx don't seem to have options for using alternate .conf files. However, if it does work, you might be able to create a .conf that covers both displays, since X does not have a problem running multiple different monitors. You could then enable or disable them and change certain parameters from within the GUI using xrandr.

goldilocks
  • 58,859
  • 17
  • 112
  • 227
  • What happens if you connect both of the screens (spi and hdmi). only one of them works? or some stuff shows up on HDMI and other in touchscreen display?. I am looking to set up a project where I have an input gui in the touchscreen and output videos to the hdmi display. Pretty much a video selection using a small touch screen and the output showing on the big HDMI. Is this possible? – Mosfetdaha May 12 '16 at 23:59
2

Try this to switch back to HDMI Output: Run "sudo nano /etc/X11/xorg.conf.d/99-fbturbo.conf". Then go down to where it said "fb1 or fb0". So in your case since it's outputting to the screen, it most likely says fb1. Change it to fb0 for HDMI output, and fb1 for SPI(So your touch screen) output. Hope this helps!