2

I am trying to detect if a PiTFT screen is connected.

Is there some kind of GPIO pin I can probe and detect it to some extent?

  • 1
    Other than printing message and asking the operator to press a button if he could read it ;) But I'd assume that the controller attached to the Pi by a serial interface has to report in somehow. After all there is a touchpanel and those values have to be sent to the Pi? The documentation at the given link is however quite scarce. – Ghanima Sep 14 '14 at 15:32
  • 1
    @Ghanima You can't just print a message, because setup requires in some cases to re-flash the firmware of the pi. I am building a distro and I want it to support multiple screens – GuySoft Sep 16 '14 at 11:04
  • Sure, the first part of that comment was a little less serios. My question being that a display-touchpanel combination got to have a bi-directional interface. Thus the Pi should be able to send something and get some response... or at least that was what I hoped. – Ghanima Sep 16 '14 at 19:49
0

Old question, answering for someone else who might need it... Full disclaimer - this is what I collected in the last couple of days researching a different topic - there are might be better ways. That said, it seems there are at least a few possibilities for detecting a TFT screen. For one, you can query the device tree as described here:

$ cat /proc/device-tree/hat/product
PiTFT 2.2inch without Touchscreen (ILI9340)

You can also see if the backlight device is registered (found here):

$ sudo find /sys/ -type f -iname '*brightness*' | grep 'led'
/sys/devices/platform/soc/soc:leds/leds/led0/brightness
/sys/devices/platform/soc/soc:leds/leds/led0/max_brightness

Or read the status of the backlight led directly (will be 0 if off):

 $ gpio  read 18
1

You can also check if there is more than one framebuffer (TFT runs on fb1 unless you have more than one monitor):

$ ls /sys/class/graphics/
fb0  fb1  fbcon

You can probably also talk directly to the TFT controller, but the options above seem simpler.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.