Sunday, 21 September 2014

PS4EYECam released

I had released the first public version of PS4EYECam driver.

You can get full information in my PS4EYECam repository

It is the first public driver for PlayStation 4 Camera licensed under gpl.

I have free afternoons availables if someone is interested to offer me a partial job :P

Enjoy and remember the best is yet to come....




9 comments:

xiaNaix said...

Glad to see some cool homebrew on the new Sony console! ;)

bigboss said...

Thank you xiaNaix, we only open the doors. We need more people involved and perhaps we will see native homebrew on PlayStation 4 in near future :P

Simon Stannus said...

Hi, thanks for creating the driver. I don't have a Mac with USB3, so I tried to adapt your code to both Windows 7 and Ubuntu 14.10, but I ran into problems. In both cases I was able to get it to compile and it seems the firmware uploaded successfully, but it fails during PS4EYECam::open_usb().

On Windows it would fail during libusb_open (see here: http://i.imgur.com/klhbwFj.png) and on Ubuntu it failed during libusb_set_configuration, giving this output:

Found PlayStation Camera
found device(s)
uploading firmware...
Firmware already loaded...
initialising...
<*** here it displayed the device descriptor ***>
set configuration error: -6
init failed
libusbx: error [submit_iso_transfer] submiturb failed error -1 errno=16
libusbx: error [submit_iso_transfer] submiturb failed error -1 errno=16
libusbx: error [submit_iso_transfer] submiturb failed error -1 errno=16
libusbx: error [submit_iso_transfer] submiturb failed error -1 errno=16
libusbx: error [submit_iso_transfer] submiturb failed error -1 errno=16
libusbx: error [submit_iso_transfer] submiturb failed error -1 errno=16
libusbx: error [submit_iso_transfer] submiturb failed error -1 errno=16
libusbx: error [submit_iso_transfer] submiturb failed error -1 errno=16


Apparently -6 is LIBUSB_ERROR_BUSY. Do you have any idea why I'm getting these errors? Do you know if anyone else has got your code working on these other platforms?

Cheers,
- Simon

bigboss said...

Simon thank you for your test. About Linux i know that there is some kernel issues. I have comments about Kernel version 3.17.3 is fine with ubuntu but no information about my driver under ubuntu.

About windows, you are the first person to report test on windows if you can enable debug mode in libusb and send me output i could try to help you, some researchers are asking me to give windows support

Simon Stannus said...

Thanks for your response. I had been running Ubuntu with a 3.16 kernel, so I updated it to 3.19 but I ran into the same issue. I reran the builds on both platforms with debugging info and shared the outputs here:

https://drive.google.com/file/d/0BwI4dmnrr4BRZ0NYQkJ1VHdteVU/view?usp=sharing
https://drive.google.com/file/d/0BwI4dmnrr4BRTVV6a1NTN0hFRUE/view?usp=sharing
https://drive.google.com/file/d/0BwI4dmnrr4BRMS1ibWxPQ2hBWDg/view?usp=sharing

The first link is the output when it uploads the firmware (under Windows). Actually, every time I unplug and plug the camera back in it thinks it needs to upload the firmware. The second link is the output when it crashes under Windows (I don't think that error number is correct; it's a different random number every time) and the third is the output when it crashes under Ubuntu.

I hope that information helps. It's not actually crucial for me, but please let me know if you come across anyone who does get it working on either Windows or Ubuntu.

Thanks again,
- Simon

bigboss said...

Simon, firmware loading is needed if you unplug and plug again the device. Playstation camera is in boot mode waiting for firmware when you plug in it. Try in linux with lsusb -v before load the firmware the first time and again after program exit with firmware loaded. You must see the difference. I will analyze your log.

bigboss said...

Simon error -6 in linux is LIBUSB_ERROR_BUSY, you are trying to set configuration but interface was previously claimed from other site. Check if you has enabled uvcvideo kernel module and disable it. You can enable debug info in ps4eye.h. Problem can be monitored and fixed in open_usb function in ps4eye.cpp.

I am using pure libusb , you are using libusbx.

Joseph Weber said...

Hi BigBoss or Simon,

I am hoping to eventually use the PS4Eye camera at 120 fps as the detector for a touch table, where I am currently using a PS3Eye camera at 60 fps (faster is almost always better). For that reason, I recently tried to get the PS4Eye camera going on a Windows 8 machine using libusb 1.0 and the PS4EYECam class.

The first part, loading the firmware.bin file, looked like it went quite well. When I would plug the PS4Eye camera into a USB3 port, it would initially show up in the Windows 8 "Device Manager" window as a "USB Boot" device under "libusbK USB Devices". Then when the PS4EYECam::firmware_upload() function declared success, the "USB Boot" device would go away and "USB Camera-ov580" would show up under "Imaging devices", so I am pretty sure that the firmware is being uploaded correctly. So far so good.

But after that, the routine to initialize the camera stalls out. I used a debugger to see what was going on, and also added several print statements along with turning the libusb verbosity level up to its highest setting by using libusb_set_debug(usb_context, 4). I saved the output as a text file named README-PS4EYECam-debug-output-on-Windows.txt, and posted it on a public Google Drive site at the following URL:

https://drive.google.com/folderview?id=0B1nqHP6XOiJ8fjdud09qbUI3VmVhVm5JYWh0a0dsVUNMVklEMDVvWjB5QVdqcDdzcVJUVWs&usp=sharing

The README file also has a summary at the top with more details on how I was testing and my interpretation. The program stalls after the init() function calls on check_sensors() to see if it is possible to read a register from one of the cameras. Shortly after libusb_submit_transfer(control_transfer) is used to send the request to the USB system, the program focus goes to a while-loop at the bottom of the submitAndWait_controlTransfer() function. Inside the while-loop is a single line of code, a call to USBMgr::handleEvents(), and that is where the program stalls out, just waiting in vain for an answer back from the USB system.

It seems to me that the info packed into the control_transfer argument (a libusb_transfer struct) would be the same on Macintosh or Windows, so I am guessing the problem is somewhere in libusb, which is still a work in-progress. I don't think that I know enough about drivers to dive into the libusb code, so unless BigBoss or anyone else has suggestions on what I might try, I plan to wait till the next version of libusb comes out and try again.

-Joe Weber
joe.weber77
AT
gmail.com

bigboss said...

Hi i will try to see your log this week. I have not windows machine with usb 3 so i can't test it, but i will try to help if i can find something in your debug logs