mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 13:17:50 +02:00
Replace custom python connector with ncat (#42)
* Replace custom made daemon with nmap-ncat * Use stderr to log ncat output * Refresh the branch
This commit is contained in:
66
README.md
66
README.md
@@ -23,7 +23,8 @@ security assesment, pentest, ISO certification, etc.
|
||||
|
||||
This project probably doesn't match your needs nor expectations. Be aware.
|
||||
|
||||
Your model train may also catch fire while using this software.
|
||||
> [!CAUTION]
|
||||
> Your model train may catch fire while using this software.
|
||||
|
||||
Check out [my own instance](https://daniele.mynarrowgauge.org).
|
||||
|
||||
@@ -49,7 +50,7 @@ It has been developed with:
|
||||
|
||||
## Requirements
|
||||
|
||||
- Python 3.10+
|
||||
- Python 3.11+
|
||||
- A USB port when running Arduino hardware (and adaptors if you have a Mac)
|
||||
|
||||
## Web portal installation
|
||||
@@ -99,43 +100,52 @@ connected via serial port, to the network, allowing commands to be sent via a
|
||||
TCP socket. A response generated by the DCC++ EX board is sent to all connected clients,
|
||||
providing synchronization between multiple clients (eg. multiple JMRI instances).
|
||||
|
||||
Its use is not needed when running DCC++ EX from a [WiFi](https://dcc-ex.com/get-started/wifi-setup.html) capable board (like when
|
||||
using an ESP8266 module or a [Mega+WiFi board](https://dcc-ex.com/advanced-setup/supported-microcontrollers/wifi-mega.html)).
|
||||
Its use is not needed when running DCC++ EX from a [WiFi](https://dcc-ex.com/get-started/wifi-setup.html) capable board, like when
|
||||
using an ESP8266 module, a [Mega+WiFi board](https://dcc-ex.com/reference/hardware/microcontrollers/wifi-mega.html), or an
|
||||
[ESP32](https://dcc-ex.com/reference/hardware/microcontrollers/esp32.html) (recommended).
|
||||
|
||||
### Customize the settings
|
||||
### Manual setup
|
||||
|
||||
The daemon comes with default settings in `config.ini`.
|
||||
Settings may need to be customized based on your setup.
|
||||
You'll need [namp-ncat](https://nmap.org/ncat/) , and `stty` to setup the serial port.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Other variants of `nc` or `ncat` may not work as expected.
|
||||
|
||||
Then you can run the following commands:
|
||||
|
||||
```bash
|
||||
$ stty -F /dev/ttyACM0 -echo 115200
|
||||
$ ncat -n -k -l 2560 </dev/ttyACM0 >/dev/ttyACM0
|
||||
```
|
||||
|
||||
> [!IMPORTANT]
|
||||
> You'll might need to change the serial port (`/dev/ttyACM0`) to match your board.
|
||||
|
||||
> [!NOTE]
|
||||
> Your user will also need access to the device file, so you might need to add it to the `dialout` group.
|
||||
|
||||
|
||||
### Using containers
|
||||
|
||||
```bash
|
||||
$ cd daemons
|
||||
$ podman build -t dcc/net-to-serial .
|
||||
$ podman run --group-add keep-groups --device /dev/ttyACM0 -p 2560:2560 dcc/net-to-serial
|
||||
```
|
||||
|
||||
### Manual setup
|
||||
|
||||
```bash
|
||||
$ cd daemons
|
||||
$ pip install -r requirements.txt
|
||||
$ python ./net-to-serial.py
|
||||
$ cd connector
|
||||
$ podman build -t dcc/connector .
|
||||
$ podman run -d --group-add keep-groups --device /dev/ttyACM0:/dev/arduino -p 2560:2560 dcc/connector
|
||||
```
|
||||
|
||||
### Test with a simulator
|
||||
|
||||
A [QEMU AVR based simulator](daemons/simulator/README.md) running DCC++ EX is bundled togheter with the `net-to-serial.py`
|
||||
daemon into a container. To run it:
|
||||
A [QEMU AVR based simulator](daemons/simulator/README.md) running DCC++ EX is bundled togheter with the connector
|
||||
into a container. To run it:
|
||||
|
||||
```bash
|
||||
$ cd daemons/simulator
|
||||
$ podman build -t dcc/net-to-serial:sim .
|
||||
$ podman run --init --cpus 0.1 -d -p 2560:2560 dcc/net-to-serial:sim
|
||||
$ cd connector/simulator
|
||||
$ podman build -t dcc/connector:sim .
|
||||
$ podman run --init --cpus 0.1 -d -p 2560:2560 dcc/connector:sim
|
||||
```
|
||||
|
||||
To be continued ...
|
||||
> [!WARNING]
|
||||
> The simulator is intended for light development and testing purposes only and far from being a complete replacement for a real hardware.
|
||||
|
||||
## Screenshots
|
||||
|
||||
@@ -146,15 +156,12 @@ To be continued ...
|
||||

|
||||
|
||||
|
||||
|
||||
#### Dark mode
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
### Backoffice
|
||||
|
||||

|
||||
@@ -166,8 +173,3 @@ To be continued ...
|
||||
### Rest API
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user