Sevren
Posts: 2
Joined: Fri Jan 09, 2015 4:16 pm

RaspBMC on hdmi and terminal on Adafruit TFT

Fri Jan 09, 2015 4:30 pm

Hi all,

I have a Raspberry Pi model B+ running the latest RaspBMC. All is fine for the video output but I also have a 2.8 TFT from adafruit.

I want to be able to see a terminal screen on the TFT, the same one from the ssh window is this possible?

I know of some solutions that use something like FCBP to copy the HDMI output to the TFT screen, but I only want to have a terminal there so I can see the output of some custom python scripts which will run in the background of RaspBMC.

Sevren
Posts: 2
Joined: Fri Jan 09, 2015 4:16 pm

Re: RaspBMC on hdmi and terminal on Adafruit TFT

Sat Jan 10, 2015 1:36 pm

Solved with doing the following ( I had to change to Raspbian Wheezy, instead of RaspBMC image)
  • 1. Load Raspbian Wheezy on the SD card from the Downloads page (SD Card Formatter + Win32Disk imager)
    2. Connect Ethernet Cable & HDMI cable into PI and the TFT screen onto the GPIO pins.
You will see nothing on your TFT screen yet, other than a white backlight. Now we install the drivers and everything needed by the screen.

Note: Since I don't have a usb keyboard lying around I am relying on internet connectivity and SSH to setup the rest of this.

On your HDMI screen you should see your PI's IP address, If you do not see it on the screen you can find it by going to your routers setup page and checking the assigned LAN connections.

Preliminary Raspi-config setup

Code: Select all

sudo rapsi-config

Select option 1 to expand the sd card
Select option 7 to overclock and choose medium (this is for XBMC/Kodi)

Install the TFT screen drivers and kernel
Use the easy installer script from Adafruit 2.8 TFT detailed install guide I have the PID 1601 version.

Reference:
https://learn.adafruit.com/adafruit-pit ... sy-install

Code: Select all

wget http://adafru.it/pitftsh
mv pitftsh pitft.sh
chmod +x pitft.sh
sudo ./pitft.sh -t 28r -r 
sudo reboot
Now you should have everything installed for the TFT screen. Once it reboots you should get console output on the screen but it stops at the login section. Since I don't have a keyboard to plug in I have to setup auto login.

Auto Login Setup
Connect with SSH and login using the default pi/raspberry user & pass. This will invoke the login program with the user 'pi' and drop you into the home directory once the PI is booted up.

Code: Select all

sudo nano /etc/inittab
Find the following line:  1:2345:respawn:/sbin/getty --noclear 38400 tty1
Replace with:  1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1
XBMC/KODI Install

Install XBMC using this handy script found here (I will copy it here incase something happens to the site)

References:
http://tech.enekochan.com/en/2014/02/19 ... -raspbian/
http://michael.gorven.za.net/raspberrypi/xbmc

Code: Select all

# Install XBMC
sudo sh -c "echo 'deb http://archive.mene.za.net/raspbian wheezy contrib' > /etc/apt/sources.list.d/mene.list"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 5243CDED
sudo apt-get update
sudo apt-get install xbmc

# Add input group if it doesn't exist
egrep -i "^input" /etc/group
if [ $? -ne 0 ]; then
    sudo addgroup --system input
fi

# Make keyboard work
sudo sh -c "echo 'SUBSYSTEM=="input", GROUP="input", MODE="0660"' > /etc/udev/rules.d/99-input.rules"
sudo sh -c "echo 'KERNEL=="tty[0-9]*", GROUP="tty", MODE="0660"' >> /etc/udev/rules.d/99-input.rules"

sudo sh -c "echo '# input' > /etc/udev/rules.d/10-permissions.rules"
sudo sh -c "echo 'KERNEL=="mouse*|mice|event*",   MODE="0660", GROUP="input"' >> /etc/udev/rules.d/10-permissions.rules"
sudo sh -c "echo 'KERNEL=="ts[0-9]*|uinput",     MODE="0660", GROUP="input"' >> /etc/udev/rules.d/10-permissions.rules"
sudo sh -c "echo 'KERNEL=="js[0-9]*",             MODE="0660", GROUP="input"' >> /etc/udev/rules.d/10-permissions.rules"
sudo sh -c "echo '# tty' >> /etc/udev/rules.d/10-permissions.rules"
sudo sh -c "echo 'KERNEL=="tty[0-9]*",            MODE="0666"' >> /etc/udev/rules.d/10-permissions.rules"
sudo sh -c "echo '# vchiq' >> /etc/udev/rules.d/10-permissions.rules"
sudo sh -c "echo 'SUBSYSTEM=="vchiq",  GROUP="video", MODE="0660"' >> /etc/udev/rules.d/10-permissions.rules"

# Add current user to groups
$USER=`awk -F: "/:$(id -u):/{print $1}" /etc/passwd`
sudo usermod -a -G audio $USER
sudo usermod -a -G video $USER
sudo usermod -a -G input $USER
sudo usermod -a -G dialout $USER
sudo usermod -a -G plugdev $USER
sudo usermod -a -G tty $USER

# Enable autoboot and configure current user
sudo sed -i 's/ENABLED=0/ENABLED=1/g' /etc/default/xbmc
sudo sed -i 's/USER=xbmc/USER='"$USER"'/g' /etc/default/xbmc
*Thank you very much to Eneko Chan and especially Michael Gorven for the hard work!*

If your usb keyboard or mouse do not work in xbmc/kodi you can do the following

Edit /etc/udev/rules.d/10-permissions.rules with the following content:

Code: Select all

sudo nano /etc/udev/rules.d/10-permissions.rules

Code: Select all

# input
KERNEL=="mouse*|mice|event*",   MODE="0660", GROUP="input"
KERNEL=="ts[0-9]*|uinput",      MODE="0660", GROUP="input"
KERNEL=="js[0-9]*",             MODE="0660", GROUP="input"

# tty
KERNEL=="tty[0-9]*",            MODE="0666"

# vchiq
SUBSYSTEM=="vchiq",  GROUP="video", MODE="0660"
Make sure your user is in the group "input" check this by running

Code: Select all

id
Viewing output from the terminal on both TFT and SSH screens

If you want to screen share between the PI's terminal and your SSH session you can set it up via the following:
First it installs the program screen and then starts editing the file that allows you to run scripts and commands upon login.

Code: Select all

sudo apt-get install screen
sudo nano /etc/profile
At the end of the file put the following.

Code: Select all

if ! screen -list | grep -q "session_pi"; then
  screen -d -R session_pi
else
 screen -x session_pi
fi
This runs on startup a new screen session with the name of "session_pi". Now the next user that logs in with the same username "pi" will just join it. This lets me see the output of the console that is on the TFT screen on the SSH window in my laptop. I have some background programs running on the PI which only output to the terminal. This lets me view and debug that output on both my laptop ssh screen and the PI TFT screen itself.

If you want to fix the ssh screen so that it resizes to your window size type:

Code: Select all

CTRL+A and then SHIFT+F

Cenoura
Posts: 1
Joined: Wed Feb 25, 2015 3:37 pm

Re: RaspBMC on hdmi and terminal on Adafruit TFT

Wed Feb 25, 2015 10:12 pm

Hey,

My Pi TFT 2,8" Resistive doesn't work, I install that image https://learn.adafruit.com/adafruit-pit ... sy-install and i install xbmc like you post... But doesn't work. Please help me it's important.

Thanks :)

Return to “Beginners”