Logitech C270 Webcam in Mainsail
Crowsnest via KIAUH

Crowsnest is the Mainsail-crew webcam service (it replaces the old webcamd / mjpg-streamer). It streams with ustreamer, and Mainsail reads it at /webcam/.

1. Install Crowsnest with KIAUH

cd ~ && git clone https://github.com/dw-0/kiauh.git   # skip if you already have it
./kiauh/kiauh.sh
MainsailOS already ships with Crowsnest. Check with ls ~/crowsnest before installing it again.

2. Find the camera device

sudo apt install v4l-utils   # if v4l2-ctl is missing
v4l2-ctl --list-devices
ls -l /dev/v4l/by-id/

The C270 shows up as something like usb-046d_0825_XXXXXXXX-video-index0. Use the by-id path ending in -video-index0, because /dev/video0 can change between reboots. You can also check what the camera supports with v4l2-ctl -d /dev/video0 --list-formats-ext.

3. Configure crowsnest.conf

In Mainsail open Machine → crowsnest.conf, or run nano ~/printer_data/config/crowsnest.conf:

[cam 1]
mode: ustreamer
enable_rtsp: false
rtsp_port: 8554
port: 8080
device: /dev/v4l/by-id/usb-046d_0825_XXXXXXXX-video-index0   # your real path
resolution: 1280x720      # or 640x480 for smoother, lighter streaming
max_fps: 15               # the C270 does ~30 fps at 640x480, less at 720p
# custom_flags: --allow-broken-frames
# v4l2ctl: power_line_frequency=2   # 2 = 60 Hz (US); stops flicker

4. Restart Crowsnest

sudo systemctl restart crowsnest
systemctl status crowsnest
cat ~/printer_data/logs/crowsnest.log

Or restart it in Mainsail from the power/services menu: crowsnest → Restart.

5. Add the webcam in Mainsail

  1. Open the gear icon → Webcams → Add Webcam
  2. Name: C270
  3. URL Stream: /webcam/?action=stream
  4. URL Snapshot: /webcam/?action=snapshot
  5. Service: MJPEG-Streamer, or Adaptive MJPEG-Streamer if your network is slow
  6. Save. The feed appears on the dashboard.

To test it directly, open http://<printer-ip>/webcam/?action=stream in a browser.

6. Common fixes

ProblemFix
Camera not detected / drops outUse a different USB port (preferably directly on the Pi/CB1, not a hub), try a shorter cable, and check dmesg | tail for under-voltage or USB resets. Weak power supplies often cause this.
Low FPS / laggyLower to 640x480 and/or max_fps: 15. The C270 is USB 2.0 and slows down in low light, so add more light. Use the Adaptive MJPEG service in Mainsail.
Black or no streamCheck the device: path, then check crowsnest.log. Make sure no other webcam service (webcamd/mjpg-streamer) is using port 8080.
Flicker / bandingv4l2ctl: power_line_frequency=2 (60 Hz)
Crowsnest missing from Update ManagerAdd the entry below to moonraker.conf, then restart Moonraker.
[update_manager crowsnest]
type: git_repo
path: ~/crowsnest
origin: https://github.com/mainsail-crew/crowsnest.git
managed_services: crowsnest
install_script: tools/pkglist.sh

Also make sure ~/printer_data/moonraker.asvc contains a crowsnest line so Moonraker can restart the service.