meshtastic/docs/software/linux/usage.mdx

103 lines
2.8 KiB
Plaintext
Raw Normal View History

---
id: usage
title: Usage - meshtasticd
description: Usage of the Meshtastic daemon on Linux systems.
sidebar_label: Usage
sidebar_position: 2
---
## meshtasticd CLI options
Additional arguments can be given to the program, which are listed as follows:
- `-c CONFIG_FILE`: The configuration file to use.
- `-d DIRECTORY`: The directory to use as the virtual filesystem (VFS).
- `-e`: Erase the virtual filesystem before use.
- `-h MAC_ADDRESS`: The MAC address to assign to this virtual machine.
- `-p TCP_PORT`: The local TCP port to use for running the Meshtastic API.
## Usage with Docker
If you do not own a Linux machine, or you just want to separate things, you might want
to run the application inside a docker container.
### Usage
First, [Pull the image](/docs/software/linux/installation/?os=docker)
To run a container, type
```shell
docker run -p 4403:4403 --restart unless-stopped --name meshtasticd meshtastic/meshtasticd:beta
```
or, to get an interactive shell on the docker created container:
```shell
docker run -it -p 4403:4403 --restart unless-stopped --name meshtasticd meshtastic/meshtasticd:beta bash
```
### CH341 USB
If you want to use a `CH341` USB adapter (MeshStick), you need to pass the `bus` device to the container with the `--device` flag:
First, locate the USB device with `lsusb`:
```shell
lsusb
```
You should see something like this:
```plaintext
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 1199:9091 Sierra Wireless, Inc. EM7565-9
Bus 001 Device 003: ID 8087:0032 Intel Corp. AX210 Bluetooth
Bus 001 Device 004: ID 13d3:56b2 IMC Networks Integrated Camera
Bus 001 Device 005: ID 06cb:009a Synaptics, Inc. Metallica MIS Touch Fingerprint Reader
Bus 001 Device 006: ID 1a86:5512 QinHeng Electronics CH341 in EPP/MEM/I2C mode, EPP/I2C adapter
```
Locate the `CH341` device and take note of the **Bus** and **Device** numbers. In this example: `001/006`.
Then, run the container with the `--device` flag,
additionally mounting a local configuration file:
```shell
docker run -it -p 4403:4403 --restart unless-stopped --name meshtasticd --device=/dev/bus/usb/001/006 -v ./config.yaml:/etc/meshtasticd/config.yaml:ro meshtastic/meshtasticd:beta
```
### Executing the application interactively
To use Python CLI against exposed TCP port 4403,
type this in the host machine:
```shell
meshtastic --info --host localhost
```
You can interact with the container in the same way as a normal device using a client that supports TCP connections.
### Stop the container
If started with the `--name meshtasticd` arg, you can stop the container with the following command:
```shell
docker kill meshtasticd
```
Else, run this to get the ID:
```shell
docker ps
```
Then, stop the container with command:
```shell
docker kill <id>
```
> Tip: you can just use the first few characters of the ID in docker commands