diff --git a/docs/config.for.camera.usb.md b/docs/config.for.camera.usb.md index 0e07cc3..6ade220 100644 --- a/docs/config.for.camera.usb.md +++ b/docs/config.for.camera.usb.md @@ -37,6 +37,9 @@ For more details about formats it is better to use Next, [test config](./test.config.md). +Note: if you have more cameras you probably want to use device by-id or by-path, +see [tuning](./configuration.tuning.md) for more details. + ## Real world example Raspberry Pi Zero W with endoscope camera over USB, registered as `/dev/video1`: diff --git a/docs/configuration.env.full.md b/docs/configuration.env.full.md index 8cbf9c1..1dae0c9 100644 --- a/docs/configuration.env.full.md +++ b/docs/configuration.env.full.md @@ -9,7 +9,7 @@ Config for camera is to the script as environment variables (env vars). * `PRINTER_ADDRESS` - Printer address to ping, if address is unreachable there is no point in sending an image. Set to `127.0.0.1` to always send images. Set to empty value to disable ping check and always send images. - Default value `127.0.0.1` + Default value `127.0.0.1`. * `PRUSA_CONNECT_CAMERA_TOKEN` - required, PrusaConnect API key @@ -22,6 +22,8 @@ Config for camera is to the script as environment variables (env vars). * `CAMERA_DEVICE` - camera device to use, if you use Raspberry Pi camera attached to the CSI via camera ribbon then leave as is Default `/dev/video0` which points to first detected camera. + If you have more cameras you probably want to use device + by-id or by-path, see [tuning](./configuration.tuning.md) for more details. * `CAMERA_SETUP_COMMAND` - camera setup command and params executed before taking image, default value is empty, because some cameras do not support it, diff --git a/docs/configuration.tuning.md b/docs/configuration.tuning.md index 984e7dd..dbd5f3f 100644 --- a/docs/configuration.tuning.md +++ b/docs/configuration.tuning.md @@ -7,6 +7,51 @@ Below steps depend on the camera capabilities, thus your mileage may vary. Notice that Prusa Connect has file size limit something about 8MB of the image uploaded, so there may be no point in getting images with super high resolutions. +## Using predicable camera device names + +Somethimes devices change their id so once given camera is under `/dev/video1` +while another restart and it is under `/dev/video2` and swaps with another one. + +If you want to have a predictable camera identifiers then see directory +`/dev/v4l/by-id` or `/dev/v4l/by-path` and choose the one that you prefer + +Example on Rasberry Pi with CSI camera and two USB cameras: + +```text +pi@hormex:~ $ tree /dev/v4l +/dev/v4l +├── by-id +│   ├── usb-Generic_USB_Camera_200901010001-video-index0 -> ../../video3 +│   ├── usb-Generic_USB_Camera_200901010001-video-index1 -> ../../video4 +│   ├── usb-Microsoft_Microsoft®_LifeCam_HD-3000-video-index0 -> ../../video1 +│   └── usb-Microsoft_Microsoft®_LifeCam_HD-3000-video-index1 -> ../../video2 +└── by-path + ├── platform-bcm2835-codec-video-index0 -> ../../video18 + ├── platform-bcm2835-isp-video-index0 -> ../../video20 + ├── platform-bcm2835-isp-video-index1 -> ../../video21 + ├── platform-bcm2835-isp-video-index2 -> ../../video22 + ├── platform-bcm2835-isp-video-index3 -> ../../video23 + ├── platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.3:1.0-video-index0 -> ../../video3 + ├── platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.3:1.0-video-index1 -> ../../video4 + ├── platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.4:1.0-video-index0 -> ../../video1 + ├── platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.4:1.0-video-index1 -> ../../video2 + ├── platform-fe801000.csi-video-index0 -> ../../video0 + └── platform-feb10000.codec-video-index0 -> ../../video19 +``` + +so now if I want to have a Camera-1 always to point to the LifeCam_HD-3000 +I can use: + +```shell +CAMERA_DEVICE=/dev/v4l/by-id/usb-Microsoft_Microsoft®_LifeCam_HD-3000-video-index0 +``` + +and for CSI camera (notice it is not available under `by-id`): + +```shell +CAMERA_DEVICE=/dev/v4l/by-path/platform-fe801000.csi-video-index0 +``` + ## Getting higher quality camera images Use `v4l2-ctl` to get the list of available resolutions that camera provides diff --git a/docs/service.kubernetes.md b/docs/service.kubernetes.md index 024ea3e..a2ea96d 100644 --- a/docs/service.kubernetes.md +++ b/docs/service.kubernetes.md @@ -18,6 +18,9 @@ for the content you can use with a [kustomize](https://kustomize.io/). - deployment possible using for example kustomize +- camera device - if you have more cameras you probably want to use device + by-id or by-path, see [tuning](./configuration.tuning.md) for more details + ## Examples - [deployment-1.yaml](https://github.com/nvtkaszpir/prusa-connect-camera-script/blob/master/k8s/deployment-1.yaml)