You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2023-05-16 OctoPrint adaptation to expected kernel change - master branch - PR 1 of 2
Background:
- #690 – Kernel update may remove /dev/ttyAMA0
Changes:
1. Adopts generic syntax for device specification to prompt user to add
the relevant key (`OCTOPRINT_DEVICE_PATH`) and path (eg `/dev/ttyUDB0`)
to `.env`. Example:
```
$ echo OCTOPRINT_DEVICE_PATH=/dev/ttyUSB0 >>~/IOTstack/.env
```
2. Adopts `TZ=${TZ:-Etc/UTC}`
3. Corrects YAML "errors" identified by `yamllint`.
4. Rewrites documentation to explain the how-to of device-path setup in
various situations.
Signed-off-by: Phill Kelley <[email protected]>
When you select "OctoPrint" in the IOTstack menu, the service definition in your `docker-compose.yml`, contains the following under the `devices:` heading:
15
+
The first time you try to bring up the OctoPrint container, you should expect to see the following error:
16
16
17
-
```yaml
18
-
devices:
19
-
- /dev/ttyAMA0:/dev/ttyACM0
20
-
# - /dev/video0:/dev/video0
17
+
```
18
+
parsing ~/IOTstack/docker-compose.yml: error while interpolating services.octoprint.devices.[]: required variable OCTOPRINT_DEVICE_PATH is missing a value: eg echo OCTOPRINT_DEVICE_PATH=/dev/serial0 >>~/IOTstack/.env
21
19
```
22
20
23
-
### *the `/dev/ttyAMA0:/dev/ttyACM0` mapping*
24
-
25
-
The `/dev/ttyAMA0:/dev/ttyACM0` mapping should be read as saying "the physical Raspberry Pi device `/dev/ttyAMA0` is mapped to the logical OctoPrint container device `/dev/ttyACM0`".
26
-
27
-
The `/dev/ttyAMA0` device is used as a default because it is always present on Raspbian. If you bring up your container like that, the mapping will succeed and the container is unlikely to go into a restart loop.
21
+
The message is telling you that you need to define the device path to your 3D Printer.
28
22
29
-
However, the OctoPrint container is unlikely to be able to connect to your 3D printer via `/dev/ttyAMA0` for the very simple reason that that is not how 3D printers usually appear on the Raspberry Pi. You need to work out *how* your printer presents itself and change the device mapping accordingly.
23
+
You need to work out *how* your printer presents itself and define the external device accordingly.
30
24
31
-
####option 1 - `/dev/ttyUSBn`
25
+
### option 1 - `/dev/ttyUSBn`
32
26
33
27
Using "ttyUSBn" will "work" but, because of the inherent variability in the name, this approach is not recommended.
34
28
35
29
The "n" in the "ttyUSBn" can vary depending on which USB devices are attached to your Raspberry Pi and the order in which they are attached. The "n" may also change as you add and remove devices.
36
30
37
31
If the OctoPrint container is up when the device number changes, the container will crash, and it will either go into a restart loop if you try to bring it up when the expected device is not "there", or will try to communicate with a device that isn't your 3D printer.
38
32
39
-
#### option 2 - `/dev/serial/by-id/xxxxxxxx`
33
+
Suppose you choose this method and your 3D Printer mounts as `/dev/ttyUSB0`, you would define your printer like this:
* If you have multiple serial devices attached, you will get multiple lines in the output. It is up to you to sort out which one belongs to your 3D printer, possibly by disconnecting and re-attaching the printer and observing how the list changes.
56
-
* The uniqueness of device IDs is under the control of the device manufacturer. Each manufacturer *should* ensure their devices are unique but some manufacturers are more diligent than others.
57
-
58
-
Assuming the above example output was the answer, edit `docker-compose.yml` to look like this:
53
+
Suppose you choose this method and your 3D Printer mounts as shown above. You would define your printer like this:
* If you have multiple serial devices attached, you will get multiple lines in the output. It is up to you to sort out which one belongs to your 3D printer, possibly by disconnecting and re-attaching the printer and observing how the list changes.
62
+
* The uniqueness of device IDs is under the control of the device manufacturer. Each manufacturer *should* ensure their devices are unique but some manufacturers are more diligent than others.
67
63
* device *by-id* names follow the device. In other words, if you have two or more Raspberry Pis and a collection of serial devices (3D printers, Zigbee adapters, UARTs, and so on), a 3D printer will always get the same by-id name, irrespective of which Raspberry Pi it is attached to.
68
64
* device *by-id* names do not persist if the physical device is disconnected. If you switch off your 3D printer or disconnect the USB cable while the OctoPrint container is running, the container will crash.
69
65
70
-
#### option 3 - `/dev/humanReadableName`
66
+
### option 3 - `/dev/humanReadableName`
71
67
72
68
Suppose your 3D printer is a MasterDisaster5000Pro, and that you would like to be able to set up the device to use a human-readable name like:
73
69
@@ -134,21 +130,22 @@ Check your work by disconnecting, then re-connecting your 3D printer, and then r
134
130
$ ls /dev
135
131
```
136
132
137
-
You should expect to see the human-readable name you chose in the list of devices. You can then edit `docker-compose.yml` to use the name in the device mapping.
133
+
You should expect to see the human-readable name you chose in the list of devices.
* device names follow the device. In other words, if you have two or more Raspberry Pis and a collection of serial devices (3D printers, Zigbee adapters, UARTs, and so on), you can build a single `99-usb-serial.rules` file that you install on *all* of your Raspberry Pis. Then, you can attach a named device to any of your Raspberry Pis and it will always get the same name.
147
144
* device names do not persist if the physical device is disconnected. If you switch off your 3D printer or disconnect the USB cable while the OctoPrint container is running, the container will crash.
148
145
149
-
### *the `/dev/video0:/dev/video0` mapping*
146
+
##the `/dev/video0:/dev/video0` mapping
150
147
151
-
The `/dev/video0` device is assumed to be an official Raspberry Pi camera attached via ribbon cable.
148
+
By default, video camera support is disabled. This is because it is unsafe to assume a camera is present on `/dev/video0`.
152
149
153
150
> See the [Webcams topic of the Octoprint Community Forum](https://community.octoprint.org/c/support/support-webcams/18) for help configuring other kinds of cameras.
154
151
@@ -161,27 +158,19 @@ To activate a Raspberry Pi camera attached via ribbon cable:
161
158
3. Edit `docker-compose.yml` and uncomment **all** of the commented-out lines in the following:
162
159
163
160
``` yaml
164
-
devices:
165
-
# - /dev/video0:/dev/video0
166
161
environment:
167
-
# - ENABLE_MJPG_STREAMER=true
168
-
# - MJPG_STREAMER_INPUT=-r 640x480 -f 10 -y
169
-
# - CAMERA_DEV=/dev/video0
162
+
# - ENABLE_MJPG_STREAMER=true
163
+
# - MJPG_STREAMER_INPUT=-r 640x480 -f 10 -y
164
+
# - CAMERA_DEV=/dev/video0
165
+
166
+
devices:
167
+
# - /dev/video0:/dev/video0
170
168
```
171
169
172
170
Note:
173
171
174
172
* The device path on the right hand side of the `CAMERA_DEV` environment variable corresponds with the right hand side (ie *after* the colon) of the device mapping. There should be no reason to change either.
175
173
176
-
The three environment variables are required:
177
-
178
-
``` yaml
179
-
environment:
180
-
- ENABLE_MJPG_STREAMER=true
181
-
- MJPG_STREAMER_INPUT=-r 640x480 -f 10 -y
182
-
- CAMERA_DEV=/dev/video0
183
-
```
184
-
185
174
The "640x480" `MJPG_STREAMER_INPUT` settings will probably result in your camera feed being "letterboxed" but they will get you started. A full list of options is at [mjpg-streamer-configuration-options](https://community.octoprint.org/t/available-mjpg-streamer-configuration-options/1106).
186
175
187
176
The typical specs for a baseline Raspberry Pi camera are:
@@ -478,3 +467,4 @@ $ docker-compose up -d octoprint
478
467
```
479
468
480
469
The OctoPrint container is well-behaved and will re-initialise its persistent storage area correctly. OctoPrint will adopt "first run" behaviour and display the Setup Wizard.
0 commit comments