HDMI LCD 드라이버 설정 방법입니다. (800×480)

아래는 LCD 판매자가 제공하는 매뉴얼대로 설정하는 방법입니다.

================================================

/boot/config.txt 파일을 찾아서 수정

  • sudo nano /boot/config.txt

아래 내용을 찾아 내용을 똑같이 맞춰줌

# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (here we are forcing 800x480!)
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0

오디오가 HDMI 포트로 송출되지 않도록 수정해 줘야 합니다.

  • sudo raspi-config
    • Advanced options > Audo
    • 3.5mm jack only 로 선택

===================================================

LCD 화면 표시는 대부분 문제 없이 잘 됩니다. 하지만 USB로 연결되는 터치 인식을 위해 드라이버를 설치하면 문제가 좀 생깁니다. 일단 아래 소개하는 방법은 LCD 판매자가 제공하는 매뉴얼대로 하는 방법입니다.

터치를 인식하기 위해서는 LCD와 라즈베리 파이를 USB로 연결해줍니다. 이후 아래 과정대로 터치 드라이버를 설치합니다.

드라이버 파일은 아래에서 다운로드

다운로드 받은 파일을 라즈베리 파이에 넣고 kernel.img, kernel7.img 두 개의 파일을 /boot 경로에 복사해 줘야 함. 미리 기존 파일을 백업해두고 시도하시길. (일단 이 방법은 쓰지 마시고 아래를 읽으세요.)

============================================================

위 방법을 사용하면 커널 이미지가 바뀌기 때문에 wifi, GPIO 컨트롤 등등 예상치 못한 기능상의 에러가 발생할 수 있습니다. 그래서 추천하지 않는 방법이기도 합니다. 터치 드라이버 소스를 판매자가 제공해 주지 않아서 딱히 손쓸 방법이 없었는데, 일군의 능력자들이 직접 터치 드라이버를 만들어서 배포하고 있습니다.

아래 링크에 해당 프로젝트가 있습니다.

아래처럼 소스 다운로드 받아서 설치하면 됩니다.

git clone https://github.com/derekhe/waveshare-7inch-touchscreen-driver
cd wavesahre-7inch-touchscreen-driver
chmod +x install.sh
sudo apt-get update
sudo ./install.sh
sudo restart

============================================================

버추얼 키보드 설치

mbk-default
matchbox-keyboard 설치

  • sudo apt-get install libfakekey-dev libpng-dev libxft-dev autoconf libtool -y
  • git clone https://github.com/mwilliams03/matchbox-keyboard.git
  • cd matchbox-keyboard
  • ./autogen.sh
  • make
  • sudo make install

matchbox 라이브러리 설치

  • sudo apt-get install libmatchbox1 -y

스크립트 파일 생성

  • sudo nano /usr/bin/toggle-matchbox-keyboard.sh

아래 내용을 입력

#!/bin/bash
#This script toggle the virtual keyboard

PID=`pidof matchbox-keyboard`
if [ ! -e $PID ]; then
  killall matchbox-keyboard
else
 matchbox-keyboard&
fi

실행 권한 부여

  • sudo chmod +x /usr/bin/toggle-matchbox-keyboard.sh

start menu에 아이템 생성

  • sudo nano /usr/local/share/applications/toggle-matchbox-keyboard.desktop

아래 내용을 입력

[Desktop Entry]
Name=Toggle Matchbox Keyboard
Comment=Toggle Matchbox Keyboard
Exec=toggle-matchbox-keyboard.sh
Type=Application
Icon=matchbox-keyboard.png
Categories=Panel;Utility;MB
X-MB-INPUT-MECHANSIM=True

X윈도 설정 파일 수정

  • nano ~/.config/lxpanel/LXDE/panels/panel
  • nano ~/.config/lxpanel-pi/LXDE/panels/panel
  • (버전에 따라 경로가 조금씩 틀림. 직접 디렉토리 안의 파일들을 찾아보는 것이 좋음

아래 내용을 찾음

Plugin {
    type = launchbar
    Config {
        Button {
            id=lxde-screenlock.desktop
        }
        Button {
            id=lxde-logout.desktop
        }
    }

아래처럼 바꿔줌

Plugin {
    type = launchbar
    Config {
        Button {
            id=toggle-matchbox-keyboard.desktop
        }
        Button {
            id=lxde-screenlock.desktop
        }
        Button {
            id=lxde-logout.desktop
        }
    }

커맨드 라인에서 키보드 실행 명령어

  • matchbox-keyboard

SSH로 연결되어 있을 때 키보드 실행 명령어

  • DISPLAY=:0.0 matchbox-keyboard

작은 키보드로 실행

  • matchbox-keyboard -s 50

확장 키보드로 실행

  • matchbox-keyboard -s 50 extended

===================================================

참고자료 : Adafruit, User manual