kitchen-pi Code
Brought to you by:
psfales
Setting up a new kitchen computer:
SYSTEM
- create files in /boot
touch ssh
add wpa_supplicant.conf
- Force 1080p in config.txt
sudo sed -i -e 's/#hdmi_force_hotplug=1/hdmi_force_hotplug=1/' /boot/config.txt
sudo sed -i -e 's/#hdmi_group=1/hdmi_group=1/' /boot/config.txt
sudo sed -i -e 's/#hdmi_mode=1/hdmi_mode=16/' /boot/config.txt
- In /etc/rc.local add "touch forcefsck"
sudo sed -i -e 's/^exit 0/touch forcefsck\n\n&/' /etc/rc.local
- Set password for pi, root
sudo passwd pi
sudo passwd root
- Enable root login in /etc/ssh/sshd_config
Change "PermitRootLogin" to "yes"
sudo sed -i -e 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
sudo service ssh restart
- Use raspi-config to
set hostname
set desktop autologin
set locale = en_US.UTF-8
set timezone
enable vnc
- Connect with VNC view that supports Encryption (e.g. android or
Download/VNC-Viewer-5.3.2-Linux-x86) and change
Authentication to "VNC password" and Encryption to "Prefer off".
- Update
apt-get -y update
apt-get -y purge libreoffice wolfram-engine sonic-pi scratch scratch2
apt-get -y install subversion puppet cups firefox-esr
apt-get -y install libx11-dev libxtst-dev libxss-dev
apt-get -y install cmake libudev-dev libxtst-dev
apt-get -y install synaptic cec-client
apt-get -y autoremove
apt-get -y upgrade
svn checkout --username=psfales svn+ssh://psfales@svn.code.sf.net/p/kitchen-pi/code/ \
kitchen-pi-code
PRINTER
- Make sure paraller printer is available on /dev/usb/lp0
- Install CUPS
apt-get -y install cups lprng
- OLD Enable CUPS
Based on
http://www.howtogeek.com/169679/how-to-add-a-printer-to-your-raspberry-pi-or-other-linux-computer/
- Allow lpadmin
usermod -a -G lpadmin pi
- In /etc/cups/cupsd.conf, Replace "Listen localhost:631" with "Port 631"
sed -i -e 's/Listen localhost:631/Port 631/' /etc/cups/cupsd.conf
- In Location /, /admin, /admin/conf, add "Allow @local"
sed -i -e 's/<\/Location>/ Allow @local\n&/' /etc/cups/cupsd.conf
- Supposedly these last two steps allow access to port 631 from
outside, but I haven't been able to make that work
yet. The only way I've been able to do it is to launch
the browser from the desktop and use http://127.0.0.1:631/
- Restart cups
/etc/init.d/cups restart
- Use http://piXX:631 to add a printer named "Kitchen list printer"
(psfp4.psf uses the mDNS name to find it)
Administration->Add Printer
+ Connection parallel:/dev/usb/lp0
+ "Share this printer" checked
+ Driver - Generic-Text only
+ Printer name "lp"
OR
edit /etc/printcap and change /dev/lp0 to /dev/usb/lp0
- Edit /usr/lib/cups/filter/textonly (see local copy) to remove
duplicate linefeeds
OR
- NEW Use lprng and
echo "lpd_listen_port = 515" >> /etc/lprng/lpd.conf
sed -i -e 's/^REJECT NOT SERVER/##&' /etc/lprng/lpd.perms
SCANNER
- Make sure scanner is available at /dev/ttyUSB0, mode 666
In /etc/rc.local/add, link to scanner
sed -i -e 's/^exit 0/if [ -e \/dev\/ttyUSB0 ]\nthen\n ln -s \/dev\/ttyUSB0 \/dev\/scanner\n chmod 666 \/dev\/ttyUSB0\nfi\n\n&/' /etc/rc.local
- Start baract as psfales. In /etc/rc.local, add
sed -i -e "s/^exit 0/rm -f \/var\/spool\/lock\/LCK..scanner \/home\/pi\/.x_idle_monitor.pid\nsu -l -c \'nohup .\/baract \&\' pi\n\n&/" /etc/rc.local
- Build and install baract
su - pi
cp /root/kitchen*/baract.c .
make baract
- Add /home/pi/.baractrc
cp /root/kitchen*/baractrc .baractrc
- Lock permissions
sudo mkdir /var/spool/lock
sudo chmod 777 /var/spool/lock
- In firefox about:config change
browser.link.open_newwindow from 3 (open new tab in current window
to 1 (open in current window)
DESKTOP
- Use raspi-config to configure for desktop autologin
- Install /usr/local/bin/checkdaemon
cp kitchen-pi-code/checkdaemon /usr/local/bin
- Create /mnt/loop/var/spool/cron/crontabs/pi (I think this
needs to be all one long line - did n ot work when split up
like this)
echo '* * * * * /usr/local/bin/checkdaemon -p /home/pi/.x_idle_monitor.pid -l /home/pi/.x_idle_monitor.log /usr/local/bin/idle_chromecast -b -t 60 -d ":0"' >> /var/spool/cron/crontabs/pi
- Install /mnt/loop/etc/xdg/lxsession/LXDE-pi/autostart
OR better
cp autostart /home/pi/.config/lxsession/LXDE-pi/autostart
- Add Chromecast.desktop to Desktop/
cp Chromecast.desktop /home/pi/Desktop/
cp chromecast.png /home/pi
SCREENSAVER
- build and install idle_chromecast in /usr/local/bin
cc idle_chromecast.c -o idle_chromecast -lXss -lX11
cp idle_chromecast /usr/local/bin
- put input-pc.sh and input-chromecast.sh in /usr/local/bin
cp input-pc.sh input-chromecast.sh /usr/local/bin
- Install libs for building libcec (on latest Raspbian, can just
- OLD Install libs for building libcec
apt-get -y install cmake libudev-dev
- OLD build cec-client or copy from old build (svn) and install
in /usr/local/bin
Build instructions at
https://github.com/Pulse-Eight/libcec/issues/77
(First build "platform" then after "make install" build
libcec)
# git clone git://github.com/Pulse-Eight/platform.git
cd platform/
mkdir build
cd build/
cmake ..
make
sudo make install
cd ../../
#git clone git://github.com/Pulse-Eight/libcec.git
cd libcec/
mkdir build
cd build/
cmake ..
make
sudo make install
- NEW
apt install cec-client
- Build xte, install in /usr/local/bin
# This is apparently needed in jessie, but not stretch:
# apt-get -y install liblockdev1
apt-get -y install libxtst-dev
tar xvf xautomation*gz
cd xautomation-1.03
LDFLAGS=-lX11 ./configure
make
make install
- Install bvi and use it to change "CECTester" to "RasPi " in
/usr/bin/cec-client