# FS-502 Installation Guide(For Ubuntu 20.04.1)
###### tags: `Fasmedo` `fs500` `ptp`
[TOC]
## System Installation
### Requirements
#### Hardware
- Capture Card: SC540N1-L HDV
- DVI to HDMI(HDMI 2.0)
- PC
- Power cable x 1
- USB Keyboard x 1
- USB Mouse x 1
- XC-895 x 1
- (wifi network card)
- Wifi Dongle(if desktop has no wifi network card inside)
[Please see FS-502 user guide for more details](https://hackmd.io/vgR7VQRHQEuvoQfVblqoOw)
### OS Installation
* Install Ubuntu 20.04.1 with the following selections:
* Select `Minimal installation`
* Select `Erase disk and install Ubuntu`
* Location: Ship location (e.g. Manila)
* Login details
* Your name: ==fasmedo==
* Your computer's name: ==Serial Number== (please see **Naming rules of serial number** section for more details)
* pick a user name: ==fasmedo==
* password: ==fasmedo==
* Select `Log in automatically`
* Enable sudo without password [color=red] Required!
* Edit `/etc/sudoers` to add the following:
`fasmedo ALL=(ALL) NOPASSWD:ALL`
* Disable Ubuntu Software Updates
* Capture card driver may not work if kernel get auto patched, so it's very important to disable auto-updates.
* Launch `Software & Updates` application from command line:
`sudo software-properties-gtk`

1. Switch to `Updates` tab
2. Un-check all the 3 checkboxes
3. Set automatical check to `Never`
4. Set notification to `Never`
5. Click `Close`

6. Then click `Reload` if the above dialog popup.
:::warning
:bulb: **Hint**: Not update to 20.04.1 version yet
:::
### Driver Installation (for XC865 only)
* Disable Secure Boot first:
* Enter BIOS settings by pressing `Del` key on boot, in `Authentication` section, disable `Secure Boot`
* This is required to install device drivers (kernel modules)
* Video Capture Card driver:
* Download ==20210628_V973_QP0203(Ubuntu 20.04 kernel 5.8.0.59-generic X64).zip== from FTP site
* Unzip and follow Readme.txt to install driver
example:
```bash=
sudo cp ./QP* /lib/firmware
sudo cp LXV4L2D_QP0203.ko /lib/modules/`uname -r`/
depmod -a
modprobe LXV4L2D_QP0203
```
### Application Installation
#### Install dependencies for scripts of medicam viewer
```bash=
sudo apt-get update
sudo apt install -y curl openbox obconf feh compton wmctrl xdotool
sudo apt-get install -y ffmpeg v4l-utils
```
:::warning
:bulb: **Hint**: what's obconf? need?
:::
* Download recovery script from AWS S3, change permission and run it:
```
$ cd
$ mkdir prod
$ cd prod
$ sudo apt update
$ sudo apt install curl
$ curl https://medicam-public.s3-us-west-2.amazonaws.com/software/fs500/recovery.sh > recovery.sh
w$ chmod u+x recovery.sh
$ ./recovery.sh
```
:::warning
:bulb: **Hint**: Please check the installer version in recovery.sh before executing the script. The version should be the last release version
:::
### Switch to OpenBox desktop (for once only)
* Logout first:

* Select `openbox` from the login screen

* Login with your password.
## Boot Logo and Menu Settings
1. Replace boot logo and background color
```bash=
sudo cp FASMEDO_LOGO /usr/share/plymouth/themes/spinner/watermark.png
```
# Possible Errors
1. If camera stream didn't show up
Run ffplay to check the streaming player
```bash=
$ ffplay
```
If result as below(can't find libsndio.so.6.1)
```bash=
error while loading shared libraries: libsndio.so.6.1: cannot open shared object file: No such file or directory
```
how to solve this issue
1. find library if newer version has installed
```bash
ls /usr/lib/x86_64-linux-gnu/ | grep libsndio.so
```
2. link old version to the new version
```bash
ln -T /usr/lib/x86_64-linux-gnu/libsndio.so.7.0 /usr/lib/x86_64-linux-gnu/libsndio.so.6.1
```
2. Can't Find the bootable USB stick in bios as removable device:
The USB stick may be recognized as a HDD, please check the contents of the HDD.
3. Ubuntu can't find the HDD
Please change the SATA mode to AHCI in the bios

# Options
* Disable Secure Boot first:
* Enter BIOS settings by pressing `Del` key on boot, in `Authentication` section, disable `Secure Boot`
* This is required to install device drivers (kernel modules)
* Edimax EW-7822ULC driver:
* Connect to Internet first (through Ethernet)
```
$ sudo apt update
$ sudo apt install build-essential git
$ mkdir ~/dev
$ cd ~/dev
$ git clone https://github.com/MeissnerEffect/rtl8822bu.git
$ cd rtl8822bu
$ make
$ sudo make install
$ sudo modprobe 88x2bu
```
* ASUS USB-AC68 driver:
```
sudo apt install git dkms
git clone https://github.com/aircrack-ng/rtl8814au.git
cd rtl8814au
sudo
```
# Reference
### Naming rules of serial number
| Product Name | location | Color | reserve | day | month | year | counter
| -------- | -------- | -------- | ----| ---- | --- | ---- | ---- |
| 502S | T | B | 0 | 26 | 6 | A | 002
|FS502|Taiwan| Black | reserve code | 26 | jun | 2019 | No. 2
### Install Ubuntu desktop
[Install Ubuntu desktop](https://ubuntu.com/tutorials/install-ubuntu-desktop#9-login-details)