標籤:group 觸摸 技術 實驗 ges ash 實現 entry tle
樹莓派單獨使用時,往往需要觸控螢幕和軟鍵盤用以方便操作,微雪LCD顯示器就能較好的實現這個功能,
正好實驗室又買入了一個3B的板子和一個5inch的顯示器,便對著官方的安裝手冊,親自安裝了一次。
一:材料準備
- 樹莓派官方鏡像,本人使用的是2016-05-27-raspbian-jessie鏡像
- Win32DiskImager.exe 用來燒錄鏡像。
- USB讀卡機
- matchbox-keyboard.zip 微雪LCD盤軟鍵盤
- 樹莓派LCD驅動 160813
二:鏡像燒入
- 將鏡像檔案下載到電腦(PC),並解壓得到.img檔案.
- 將TF卡通過USB讀卡機插入電腦,開啟Win32DiskImager.exe,選擇1中的鏡像img檔案,選中樹莓派TF卡磁碟,點擊write燒錄鏡像。
- 燒錄完成後,將樹莓派LCD驅動複製到boot目錄下,編輯boot下的config.txt檔案,在檔案末尾加入以下代碼,並儲存。
1 max_usb_current=1
2 hdmi_group=23 hdmi_mode=874 hdmi_cvt 800 480 60 6 0 0
- 遠端連線樹莓派,本人使用的是一個網線直連樹莓派,具體參照http://www.whatled.com/post-1526.html
- 前面已經把樹莓派LCD驅動複製到/boot下,執行以下操作(需要外接USB鍵盤)
1 tar xzvf /boot/LCD-show-YYMMDD.tar.gz 2 cd LCD-show/3 ./LCD5-show
- 重啟後安裝LCD顯示器到樹莓派即可。但是還沒有實現軟鍵盤功能。
三:軟鍵盤(虛擬鍵盤)的安裝
- 執行下列命令安裝相應軟體
1 sudo apt-get update2 sudo apt-get install libfakekey-dev libpng-dev libxft-dev autoconf libtool -y
- 下載matchbox-keyboard.zip,解壓並複製到raspberry的系統,執行下列命令
1 cd matchbox-keyboard2 chmod +x autogen.sh3 sudo ./autogen.sh4 sudo make5 sudo make install6 sudo apt-get install libmatchbox1 -y7 sudo nano /usr/bin/toggle-matchbox-keyboard.sh
- 複製以下內容到toggle-matchbox-keyboard.sh中,並儲存
1 #!/bin/bash2 #This script toggle the virtual keyboard3 PID=`pidof matchbox-keyboard`4 if [ ! -e $PID ]; then5 killall matchbox-keyboard6 else7 matchbox-keyboard -s 50 extended&8 fi
- 執行下列命令
1 sudo chmod +x /usr/bin/toggle-matchbox-keyboard.sh2 sudo nano /usr/local/share/applications/toggle-matchbox-keyboard.desktop
- 複製以下內容到toggle-matchbox-keyboard.desktop,儲存退出
1 [Desktop Entry]2 Name=Toggle Matchbox Keyboard3 Comment=Toggle Matchbox Keyboard`4 Exec=toggle-matchbox-keyboard.sh5 Type=Application6 Icon=matchbox-keyboard.png7 Categories=Panel;Utility;MB8 X-MB-INPUT-MECHANSIM=True
- 執行以下命令,注意該步驟必須使用"pi"使用者權限,如果使用管理員權限,將找不到該檔案
1 nano ~/.config/lxpanel/LXDE-pi/panels/panel
- 找到類似以下命令(不同版本的表徵圖可能有一定差異)
1 Plugin { 2 type = launchbar 3 Config { 4 Button { 5 id=lxde-screenlock.desktop 6 } 7 Button { 8 id=lxde-logout.desktop 9 }10 }
- 加入以下代碼以新增一個Button項,如
1 Button {2 id=/usr/local/share/applications/toggle-matchbox- keyboard.desktop3 }
9.執行以下命令重啟系統,正常可以看到左上方多了一個虛擬鍵盤的表徵圖
1 sudo reboot
四:總結
- 整體安裝過程中,前期樹莓派與電腦的互聯以及樹莓派網路的串連需要注意,本人使用的是網線直連。
- 在安裝LCD驅動的時候,如果出現錯誤,嘗試以管理員身份運氣,若還是出錯,則直接安裝LCD顯示屏開機嘗試是否能正常顯示畫面。
- 安裝時間整體下來也就一個小時左右,總體下來還算輕鬆,微雪的不同尺寸的LCD顯示屏安裝軟鍵盤方式好像不太一樣。這個具體沒有考證。
五:安裝所需工具和鏡像。
http://pan.baidu.com/s/1dE2Mj4H 密碼 8tqq
樹莓派3B 安裝微雪LCD5inch顯示器(包含軟鍵盤)