Difference between revisions of "Installing Video/Audio device"
Line 129: | Line 129: | ||
* * * * * root /root/mountstorage.sh | * * * * * root /root/mountstorage.sh | ||
+ | |||
+ | Then go to /home/pi/Desktop and execute | ||
+ | |||
+ | ln -s /mnt share | ||
=== Start at boot === | === Start at boot === |
Revision as of 15:03, 7 September 2019
Contents
Installing Video/Audio device
The chosen device is a Nanopi M4 from FriendlyElec.
Estimated hardware costs:
Per device: $ 80.97, including:
- Board;
- Power adapter and cable;
- Heat sink;
- EMMC module (16GB);
- American/European adapter.
Plus, shipping costs ($ 11.00).
In the case of fast and secure shipping with DHL (recommended), an average of $ 5.00, plus the VAT on the entire costs will be added.
Total cost: € 85 (plus VAT) per piece.
Installation
Download the 'Official-ROMs-eMMC-20190718.7z' file from the FriendlyArm Google repository (about 16GB).
Then, extract the 'rk3399-eflasher-friendlydesktop-bionic-4.4-arm64-20190718.img' file and flash it through balenaEtcher to a (minimum 16GB) SD card.
Insert both the eMMC module and the SD card on the NanoPI M4 device, and power on it. Connect a monitor and a keyboard/mouse to the device, and flash the eMMC module. Then remove the SD card and restart it.
Software
Connect via SSH, and install the required modules.
apt-get update apt-get install x11vnc apt-get install vlc apt-get install clementine apt-get install shotwell apt-get install libreoffice apt-get install smbclient apt-get install dos2unix
Maybe vlc should be started with the command:
vlc --vout x11
Configuration
Then configure the board:
npi-config
Set:
- timezone;
- language;
- name of the device;
- audio device.
From the GUI, configure the audio via the left-top corner icon. Both the devices listed should be set to 'analog audio' and set to active.
Transfer your background (1920x1080) and, with right-click on the desktop, select desktop preferences and set the background image.
Icons:
- From a terminal, go to '/home/pi/desktop' and move the unneeded files;
- from the left-top menu, select the needed icons and right-click, then select 'add to desktop'.
VNC
Command to run x11vnc:
x11vnc -auth /var/run/lightdm/root/:0 -loop
Remote and local storage
Create a local link to the desktop for the (optional) local storage:
ln -s /local /home/pi/Desktop/localstorage
/xxxx is the path of the local storage, maybe this should be mounted with the usual command
mkdir /local mount /dev/xyz /local
Create a remote link to the desktop for the remote storage:
mkdir /remote mount -t cifs //<IP>/<DIR> /remote -o username=<X>,password=<Y>,vers=2.0 ln -s /remote /home/pi/Desktop/remotestorage
Use this script
#!/bin/sh POINT=`cat /root/eywa/storage.cfg | grep POINT | sed -e s/POINT=//` MOUNT=`cat /root/eywa/storage.cfg | grep MOUNT | sed -e s/MOUNT=//` USER=`cat /root/eywa/storage.cfg | grep USER | sed -e s/USER=//` PASSWORD=`cat /root/eywa/storage.cfg | grep PASSWORD | sed -e s/PASSWORD=//` MOUNTED=`df ${POINT} --output=target | tail -1` if [ "x${MOUNT}x" != "xx" -a "x${MOUNTED}x" != "x${POINT}x" ] then echo "Not mounted, mounting..." if [ "x${USER}x" = "xx" ] then mount -t cifs ${MOUNT} ${POINT} else mount -t cifs ${MOUNT} -o username=${USER},password=${PASSWORD} ${POINT} fi sleep 1 NEWMOUNTED=`df | grep ${POINT} | wc -l` echo "Newmounted = ${NEWMOUNTED}" if [ ${NEWMOUNTED} = 1 ] then echo "Killing processes for logging" killall node killall CaptureImage1 fi fi
and this configuration file
POINT=/mnt MOUNT=//10.10.10.151/xxx USER=fabio PASSWORD=xxxxxxx
to mount shared folder at boot, the /etc/crontab line should look like this
* * * * * root /root/mountstorage.sh
Then go to /home/pi/Desktop and execute
ln -s /mnt share
Start at boot
Create the file /etc/systemd/system/x11vnc.service:
[Unit] Description="x11vnc" Requires=display-manager.service After=display-manager.service [Service] ExecStart=/usr/bin/x11vnc -xkb -noxrecord -noxfixes -noxdamage -display :0 -auth guess -rfbauth /etc/x11vnc.pass ExecStop=/usr/bin/killall x11vnc Restart=on-failure Restart-sec=2 [Install] WantedBy=multi-user.target
Then, enable it:
systemctl enable x11vnc.service
Disable screen
Go to the menu, and then to Preferences - Light Locker settings. Disable it.
You should create a script that executes this command:
xset dpms force off
If the monitor is seeking for a signal, maybe it will we reactivated in seconds. So, maybe you have to do a script that repeats the same command every second until the monitor gives up searching.
In order to prevent to accidentally log-out (and make it impossible to reconnect again), edit the file
/home/pi/.config/lxpanel/LXDE/panels/panel
and comment the last stanza:
#Plugin { # type=launchbar # Config { # Button { # id=lxde-screenlock.desktop # } # Button { # id=lxde-logout.desktop # } # } #}