Kuv muaj qhov xav tau los tso saib lub dashboard nrog kev saib xyuas ntawm ntau lub vijtsam hauv chaw ua haujlwm. Muaj ob peb lub qub Raspberry Pi Model B + thiab hypervisor nrog yuav luag tsis txwv cov peev txheej.
Pom tau tias Raspberry Pi Model B + tsis muaj qhov txaus ntshai los ua kom lub browser tsis tu ncua thiab ua haujlwm ntau ntawm cov duab hauv nws, vim tias nws tshwm sim tias nplooj ntawv yog ib nrab buggy thiab feem ntau tsoo.
Muaj kev daws teeb meem yooj yim thiab muaj kuab heev, uas kuv xav qhia rau koj.
Raws li koj paub, tag nrho cov Raspberries muaj ib tug ncaj haib video processor, uas yog zoo rau hardware video decoding. Yog li lub tswv yim tau los mus tso lub browser nrog lub dashboard nyob rau lwm qhov, thiab hloov cov kwj npaj txhij nrog ib daim duab rendered rau lub raspberry.
Ntxiv rau, qhov no yuav tsum muaj kev tswj kom yooj yim, txij li qhov no txhua qhov kev teeb tsa yuav ua tiav ntawm ib lub tshuab virtual, uas yooj yim dua los hloov kho thiab thaub qab.
Tsis tau hais sai dua li ua tiav.
Server part
Peb siv npaj
Peb xa ib lub tshuab virtual tshiab thiab ua ntej ntawm tag nrho nruab rau nws
apt-get update
apt-get install -y xserver-xorg nodm fluxbox
sed -i 's/^NODM_USER=.*/NODM_USER=ubuntu/' /etc/default/nodm
Peb kuj yuav siv lub config rau Xorg, ua siab zoo
cat > /etc/X11/xorg.conf <<EOT
Section "Device"
Identifier "device"
Driver "vesa"
EndSection
Section "Screen"
Identifier "screen"
Device "device"
Monitor "monitor"
DefaultDepth 16
SubSection "Display"
Modes "1920x1080" "1280x1024" "1024x768" "800x600"
EndSubSection
EndSection
Section "Monitor"
Identifier "monitor"
HorizSync 20.0 - 50.0
VertRefresh 40.0 - 80.0
Option "DPMS"
EndSection
Section "ServerLayout"
Identifier "layout"
Screen "screen"
EndSection
EOT
systemctl restart nodm
Tam sim no peb yuav nruab Firefox, peb yuav khiav nws ua ib qho kev pabcuam, yog li rau ib yam peb yuav sau ib chav tsev rau nws:
apt-get install -y firefox xdotool
cat > /etc/systemd/system/firefox.service <<EOT
[Unit]
Description=Firefox
After=network.target
[Service]
Restart=always
User=ubuntu
Environment="DISPLAY=:0"
Environment="XAUTHORITY=/home/ubuntu/.Xauthority"
ExecStart=/usr/bin/firefox -url 'http://example.org/mydashboard'
ExecStartPost=/usr/bin/xdotool search --sync --onlyvisible --class "Firefox" windowactivate key F11
[Install]
WantedBy=graphical.target
EOT
systemctl enable firefox
systemctl start firefox
Peb xav tau Xdotool thiaj li khiav firefox tam sim ntawd hauv puv npo hom.
Siv cov parameter -url
koj tuaj yeem qhia txhua nplooj ntawv kom nws qhib tau thaum browser pib.
Nyob rau theem no, peb lub kiosk tau npaj txhij, tab sis tam sim no peb yuav tsum tau xa tawm cov duab hauv lub network mus rau lwm cov saib thiab cov khoom siv. Ua li no, peb yuav siv qhov muaj peev xwm
Rau qhov no peb xav tau ob yam:
apt-get install -y make gcc ffmpeg
cd /tmp/
wget https://github.com/ccrisan/streameye/archive/master.tar.gz
tar xvf master.tar.gz
cd streameye-master/
make
make install
cat > /etc/systemd/system/streameye.service <<EOT
[Unit]
Description=streamEye
After=network.target
[Service]
Restart=always
User=ubuntu
Environment="DISPLAY=:0"
Environment="XAUTHORITY=/home/ubuntu/.Xauthority"
ExecStart=/bin/sh -c 'ffmpeg -f x11grab -s 1920x1080 -i :0 -r 1 -f mjpeg -q:v 5 - 2>/dev/null | streameye'
[Install]
WantedBy=graphical.target
EOT
systemctl enable streameye
systemctl start streameye
Txij li thaum peb daim duab tsis tas yuav hloov kho sai, kuv tau teev tus nqi refresh: 1 thav duab ib ob (parameter -r 1
) thiab compression zoo: 5 (parameter -q:v 5
)
Tam sim no cia sim mus rau
Cov neeg siv khoom sab
Nws tseem yooj yim dua ntawm no, raws li kuv tau hais, peb yuav siv Raspberry Pi Model B +.
Ua ntej tshaj, cia peb nruab nws
Peb tseem yuav tau faib ntau lub cim xeeb rau peb cov video nti, rau qhov no peb yuav hloov kho /boot/config.txt
gpu_mem=128
Cia peb khau raj peb qhov system tshiab thiab tsis txhob hnov ββββqab pib lub pacman keyring, nruab
pacman -Sy omxplayer
Remarkably, OMXPlayer tuaj yeem ua haujlwm yam tsis muaj x, yog li txhua yam peb xav tau yog sau cov ntaub ntawv rau nws thiab khiav:
cat > /etc/systemd/system/omxplayer.service <<EOT
[Unit]
Description=OMXPlayer
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
Restart=always
ExecStart=/usr/bin/omxplayer -r --live -b http://your-vm:8080/ --aspect-mode full
[Install]
WantedBy=multi-user.target
EOT
systemctl enable omxplayer
systemctl start omxplayer
Raws li ib tug parameter -b http://your-vm:8080/
peb dhau qhov url los ntawm peb lub server.
Ntawd yog tag nrho, ib daim duab los ntawm peb cov neeg rau zaub mov yuav tsum tshwm sim tam sim ntawm qhov screen txuas. Yog tias muaj teeb meem, cov kwj yuav rov pib dua thiab cov neeg siv yuav rov txuas rau nws.
Raws li ib qho ntxiv, koj tuaj yeem nruab cov duab uas tau tshwm sim los ua ib qho screensaver ntawm txhua lub khoos phis tawj hauv chaw ua haujlwm. Rau qhov no koj yuav xav tau
mode: one
selected: 0
programs:
"Monitoring Screen" mpv --really-quiet --no-audio --fs
--loop=inf --no-stop-screensaver
--wid=$XSCREENSAVER_WINDOW
http://your-vm:8080/ n
maze -root n
electricsheep --root 1 n
Tam sim no koj cov npoj yaig yuav zoo siab heev π
Tau qhov twg los: www.hab.com