Add sample systemd file

This commit is contained in:
Kamil Trzcinski 2022-04-11 17:53:06 +02:00
parent 0ff48e449e
commit 2fb7a53122
4 changed files with 31 additions and 32 deletions

View File

@ -1,4 +1,4 @@
TARGET := camera_stream TARGET := camera-streamer
SRC := $(wildcard **/*.c **/*/*.c **/*.cc **/*/*.cc) SRC := $(wildcard **/*.c **/*/*.c **/*.cc **/*/*.cc)
HEADERS := $(wildcard **/*.h **/*/*.h **/*.hh **/*/*.hh) HEADERS := $(wildcard **/*.h **/*/*.h **/*.hh **/*/*.hh)
HTML := $(wildcard html/*.js html/*.html) HTML := $(wildcard html/*.js html/*.html)

View File

@ -41,7 +41,7 @@ camera_options_t camera_options = {
}; };
http_server_options_t http_options = { http_server_options_t http_options = {
.port = 9092, .port = 8080,
.maxcons = 10 .maxcons = 10
}; };

View File

@ -1,30 +0,0 @@
#include "opts/opts.h"
#include "opts/log.h"
#include "opts/fourcc.h"
#include "device/camera/camera.h"
log_options_t log_options = {
.debug = true,
.verbose = false
};
int main(int argc, char *argv[])
{
device_t *dev = NULL;
dev = device_libcamera_open("CAMERA", "/base/soc/i2c0mux/i2c@1/imx519@1a");
if (!dev) {
printf("Failed to open libcamera\n");
return -1;
}
if (device_open_buffer_list(dev, true, 2328, 1748, V4L2_PIX_FMT_VYUY, 0, 4, true) < 0) {
printf("Failed to open buffer list\n");
return -1;
}
printf("Opened libcamera\n");
device_close(dev);
return 0;
}

View File

@ -0,0 +1,29 @@
[Unit]
Description=camera-streamer web camera
After=network.target
[Service]
User=nobody
Group=nogroup
SupplementaryGroups=video i2c
ExecStart=/usr/local/bin/camera-streamer \
-camera-path=/base/soc/i2c0mux/i2c@1/imx519@1a \
-camera-type=libcamera \
-camera-format=YUYV \
-camera-width=2328 -camera-height=1748 \
-camera-high_res_factor=1.5 \
-camera-fps=30
# set auto-focus for IMX519
ExecStartPost=-/bin/bash -c 'sleep 3s; /usr/sbin/i2ctransfer -y 11 w4@0x0c 0x0 0x85 0x00 0x00'
Restart=always
RestartSec=10
Nice=10
IOSchedulingClass=idle
IOSchedulingPriority=7
CPUWeight=20
AllowedCPUs=1-2
MemoryMax=250M
[Install]
WantedBy=multi-user.target