prusa3d/Prusa-Link

Arducam B0202 (IMX291) not working with Prusalink

Opened this issue · 0 comments

kd4vrf commented

PrusaLink type = Raspberry Pi 4

PrusaLink version = PrusaLink 0.8.1

Printer type = MK3s

Printer firmware version = 3.14.1-8237

I had a Logitech C505 and C270 working but the images don't display properly in safari (It did work with Firefox). So I choose a camera off the supported devices list (Arducam B0202) so I could use safari to view the images. However the Arducam B0202 isn't working at all.

I can see the camera but I'm not able to see any images and I can't configure the camera

Screenshot 2024-12-15 at 11 21 32 PM

I connected to Prusalink via ssh and ran "libcamera-hello --list-cameras". It shows no available cameras:
jo@3dPrinter1:~ $ libcamera-hello --list-cameras No cameras available!

In the log file I see the following:

Dec 16 03:49:18 3dPrinter1 camera_driver[8634]: ERROR: Initialization of camera USB 2.0 Camera: USB Camera has failed {connect():80}
                                                Traceback (most recent call last):
                                                  File "/home/jo/.local/lib/python3.11/site-packages/prusa/connect/printer/camera_driver.py", line 78, in connect
                                                    self._connect()
                                                  File "/home/jo/.local/lib/python3.11/site-packages/prusa/link/cameras/v4l2_driver.py", line 572, in _connect
                                                    raise NotSupported(
                                                prusa.connect.printer.const.NotSupported: Sorry, PrusaLink supports only YUYV 4:2:2 and MJPEG. Camera leevaGUNYrog supports only these formats: {875967048}
Dec 16 03:49:18 3dPrinter1 prusa.link.cameras.v4l2_driver[8634]: ERROR: Camera leevaGUNYrog could not be closed - unknown error {_disconnect():627}
                                                                 Traceback (most recent call last):
                                                                   File "/home/jo/.local/lib/python3.11/site-packages/prusa/connect/printer/camera_driver.py", line 78, in connect
                                                                     self._connect()
                                                                   File "/home/jo/.local/lib/python3.11/site-packages/prusa/link/cameras/v4l2_driver.py", line 572, in _connect
                                                                     raise NotSupported(
                                                                 prusa.connect.printer.const.NotSupported: Sorry, PrusaLink supports only YUYV 4:2:2 and MJPEG. Camera leevaGUNYrog supports only these formats: {875967048}
                                                                 
                                                                 During handling of the above exception, another exception occurred:
                                                                 
                                                                 Traceback (most recent call last):
                                                                   File "/home/jo/.local/lib/python3.11/site-packages/prusa/link/cameras/v4l2_driver.py", line 622, in _disconnect
                                                                     self.device.stop()
                                                                   File "/home/jo/.local/lib/python3.11/site-packages/prusa/link/cameras/v4l2_driver.py", line 390, in stop
                                                                     raise RuntimeError("Already stopped")
                                                                 RuntimeError: Already stopped

lsusb does show a webcam but it shows up as "Microdia Webcam Vitade AF":

jo@3dPrinter1:~ $ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 2c99:0002 Prusa Original Prusa i3 MK3
Bus 001 Device 005: ID 0c45:6366 Microdia Webcam Vitade AF
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Journal log file shows the device is discovered at boot up:

Dec 16 22:19:22 3dPrinter1 kernel: usb 1-1.3: New USB device found, idVendor=0c45, idProduct=6366, bcdDevice= 1.00
Dec 16 22:19:22 3dPrinter1 kernel: usb 1-1.3: New USB device strings: Mfr=2, Product=1, SerialNumber=3
Dec 16 22:19:22 3dPrinter1 kernel: usb 1-1.3: Product: USB 2.0 Camera
Dec 16 22:19:22 3dPrinter1 kernel: usb 1-1.3: Manufacturer: Arducam Technology Co., Ltd.
Dec 16 22:19:22 3dPrinter1 kernel: usb 1-1.3: SerialNumber: SN0001

v4l2 driver appears to recognize the devices properly:

jo@3dPrinter1:~ $ v4l2-ctl --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
	/dev/video10
	/dev/video11
	/dev/video12
	/dev/video18
	/dev/video31
	/dev/media4

bcm2835-isp (platform:bcm2835-isp):
	/dev/video13
	/dev/video14
	/dev/video15
	/dev/video16
	/dev/video20
	/dev/video21
	/dev/video22
	/dev/video23
	/dev/media1
	/dev/media3

rpivid (platform:rpivid):
	/dev/video19
	/dev/media0

USB 2.0 Camera: USB Camera (usb-0000:01:00.0-1.3):
	/dev/video0
	/dev/video1
	/dev/video2
	/dev/video3
	/dev/media2

and video0 appears to support the formats the Prusalink requires:

jo@3dPrinter1:~ $ v4l2-ctl --device /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
	Type: Video Capture

	[0]: 'MJPG' (Motion-JPEG, compressed)
		Size: Discrete 1920x1080
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 1280x720
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 640x480
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 320x240
			Interval: Discrete 0.033s (30.000 fps)
	[1]: 'YUYV' (YUYV 4:2:2)
		Size: Discrete 640x480
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 320x240
			Interval: Discrete 0.033s (30.000 fps)

However, Prusalink selects "video2" instead of "video0".

I was able to test the camera by taking a single image using the following command and everything worked as expected and I was able to see a still image of the print bed:

v4l2-ctl --device /dev/video0 --set-fmt-video=width=1280,height=720,pixelformat=MJPG --stream-mmap --stream-to=frame.jpg --stream-count=1

Just out of curiosity I plugged in the Logitech c505 to see if libcamera recognized it since it works just fine in firefox. "libcamera-hello --list-cameras" shows the same output as the non working Arducam module.

`jo@3dPrinter1:~ $ libcamera-hello --list-cameras
No cameras available!`

I was thinking that it was a libcamera issue and I was going to start troubleshooting there but it doesn't seem to matter since the working logictech c505 shows the V4l2 drivers in the status screen and doesn't show available to libcamera even though it works.

Let me know if you need any additional information