剛完成了第一個Raspberry Pi的工作,是一個Kiosk,用Python編寫。有些設定大家可能都需要。
我的Raspberry Pi是運行RASPBIAN Debian Wheezy
自動登入
當啟動Raspbian後,如果你需要自動登入 username: pi, password: raspberry.
sudo nano /etc/inittab 搜尋:1:2345:respawn:/sbin/getty --noclear 38400 tty1 改為:
1:2345:respawn:/bin/login -f pi tty1 dev/tty1 2>&1
我的專案需要連接鍵盤,避免用戶亂按某些鍵盤,需要
禁止Ctrl+Alt+Del按鍵
搜尋: ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now 可以加#轉為註釋來暫停以上一行:#ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
用戶也可能用Alt+F1...Alt+F6切換不同consoles,要暫停這功能,只可以使用目前一個console:
暫停multiple virtual consoles
將以下數行加#轉為註釋: #2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6
儲存然後回到console輸入: sudo nano /etc/default/console-setup 搜尋 1-6 並改為 1-1:ACTIVE_CONSOLES="/dev/tty[1-1]"
自動執行Python程式碼
sudo nano /etc/profile 在最後一行加:sudo python /home/pi/yourcode.py
完成以上設定後重啟:
sudo reboot |