Trying to understand how to create new settings option #1306
-
|
Hi everyone, I'm trying to add a new settings option and need some help. I'm currently trying to add serial port capability to Part-DB. This is achieved by having Part-DB talk to a C program ("driver") via the REST API that then leverages the Linux kernel's API to interface with other peripherals (libgpiod for gpio pins, usb for usb to serial adapter, kernel serial interface to convert raw binary to something usefull). After creating the base of the driver, i wanted to work on the interface for it, in which you could compile the C program (this prevents shipping a binary blob which cannot be inspected + makes it possible to have different CPU architectures supported (compile with your own CPU + optimizations instead of having 1 prog for ARM, x86 or RISC-V), making the whole setup more secure + portable ) + configure the pins (which one?, Function?, Serial or Simple I/O?). After trying for an hour to display a simple text, i reach to you for guidance on how to structure the php file. Thx a lot in advance Int-Circuit |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Part-DB uses symfony, there are some tutorials explaining the basics of symfony: https://symfonycasts.com/screencast/symfony6 Besides that i dont really think its wise to do things like compiling a separate daemon from inside Part-DB. PHP is not really well suited to start longer running processes. When Part-DB is running from inside an docker container, you probably will not have access to kernel things, and a webserver user will normally not have enough permissions to interact with hardware, or start a daemon... I think the best approach for something like this, is having that IO stuff as a separate project and running as a server in the background, and Part-DB then triggers webhooks on certain actions. And on the Part-DB side only the endpoints for the webhooks should be configured. |
Beta Was this translation helpful? Give feedback.
-
|
and for pure configuration stuff there is https://jbtronics.github.io/settings-bundle/ |
Beta Was this translation helpful? Give feedback.
Part-DB uses symfony, there are some tutorials explaining the basics of symfony: https://symfonycasts.com/screencast/symfony6
Besides that i dont really think its wise to do things like compiling a separate daemon from inside Part-DB. PHP is not really well suited to start longer running processes. When Part-DB is running from inside an docker container, you probably will not have access to kernel things, and a webserver user will normally not have enough permissions to interact with hardware, or start a daemon...
I think the best approach for something like this, is having that IO stuff as a separate project and running as a server in the background, and Part-DB then triggers webhooks on…