raleighlittles / PS5-Camera-Firmware-Loader

A cross-platform utility for loading custom firmware onto the PlayStation 5 camera, written in Rust
https://crates.io/crates/ps5_camera_firmware_loader
44 stars 9 forks source link

[Bug]: [Raspberry Pi] OpenCV Fails to retrieve an image from the camera #15

Open Max4programing opened 2 months ago

Max4programing commented 2 months ago

Provide a brief description of the issue

PS5 camera doesn't work with this firmware

I was trying to get this loader and firmware to work on a raspberry pi which is based on linux (it works and uploads the firmware without issue). It shows on the UVC logs as camera device and the logs look fine. But in testing all it did was show a black screen on webcam testers. I tried changing the exposure and the frame per second of the camera with no luck. I decide to use opencv since it worked in this tutorial. After setting a basic script to open a window and display the camera view I got an timeout error.

Here is the code

import cv2

cap = cv2.VideoCapture("/dev/video0")

cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1920)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080)

cap.set(cv2.CAP_PROP_FPS, 15)

while True:
  ret, frame = cap.read()
  if not ret:
    print("Failed to capture image")
    break

  cv2.imshow("Video", frame)
  if cv2.waitKey(1) & 0xFF == ord("q"):
      break
cap.release()
cv2.destroyAllWindows()

Operating System version

Linux (Default)

Which camera model was this for?

PlayStation 5

Relevant log output

[ WARN:0@10.217] global cap_v4l.cpp:1136 tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.
raleighlittles commented 2 months ago

@Max4programing Huh, I'm not able to reproduce the issue you're seeing, instead I get the "Failed to capture image" message.

image

This might either be an issue with the code snippet or something wrong with the UVC firmware (which I didn't make). Can you try changing the frame rate to see if that fixes it? There should be other frame rates you can use in the 1080p mode (check the README)

Max4programing commented 2 months ago

This should be the correct Log Output

[ WARN:0@10.217] global cap_v4l.cpp:1136 tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.

Failed to capture image

The Source of the Problem

When looking through the Dmesg Logs more in depth I found that

[Sun Sep 1 17:42:00 2024] usb 2-1: New USB device found, idVendor=05a9, idProduct=058c, bcdDevice= 1.00 [Sun Sep 1 17:42:00 2024] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [Sun Sep 1 17:42:00 2024] usb 2-1: Product: USB Camera-OV580 [Sun Sep 1 17:42:00 2024] usb 2-1: Manufacturer: Omnivision Technologies, Inc. [Sun Sep 1 17:42:00 2024] usb 2-1: Found UVC 1.00 device USB Camera-OV580 (05a9:058c) [Sun Sep 1 17:42:00 2024] usbcore: registered new interface driver uvcvideo [Sun Sep 1 17:42:01 2024] i2c-bcm2835 fe205000.i2c: i2c transfer timed out [Sun Sep 1 17:42:01 2024] edt_ft5x06 10-0038: Unable to fetch data, error: -110

This error repeats filling the log and never stops until I reboot.

raleighlittles commented 1 month ago

@Max4programing I didn't see those errors unfortunately, I think those are specific to the Raspberry Pi. The I2C module that it's talking about is for the Raspberry Pi specifically, it isn't on a standard linux system. And the edt_ft5x06 module is for the touchscreen display, which again obviously won't be present on a regular linux system..

I'll try to see if i I can borrow a Raspberry Pi to reproduce this issue though.

Max4programing commented 1 month ago

Update

Dmesg Log after removing touch screen

w1_master_driver w1_bus_master1: Attaching one wire slave 00.880000000000 crc 4e w1_master_driver w1_bus_master1: Family 0 for 00.880000000000.4e is not registered. uvcvideo 2-1:1.1: Failed to resubmit video URB (-1).

Log of guvcveiw

V4L2_CORE: Could not grab image (select timeout): Resource temporarily unavailable