Playstation Eye

Technical discussion on the newly released and hard to find PS3.

Moderators: cheriff, emoon

jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Playstation Eye

Post by jimparis »

I picked up my Playstation Eye today. The VID/PID are 1415:2000. Strangely, 1415 is not assigned to any company, according to any list that I've found, including the official one here.

For video, it's not just a UVC device (disappointing), so it will take some effort to get it working outside of GameOS.

The audio input works fine under Linux using the usual ALSA usb driver. As advertised there are 4 microphones inside, and they're all individually exposed as different channels. With the camera facing you, the channel order is 1, 3, 2, 4 from left to right.

Code: Select all

Bus 001 Device 102: ID 1415:2000  
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x1415 
  idProduct          0x2000 
  bcdDevice            1.00
  iManufacturer           1 OmniVision Technologies, Inc.
  iProduct                2 USB Camera-B4.04.27.1
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          142
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval              10
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength           42
        bInCollection           1
        baInterfaceNr( 0)       2
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             1
        wTerminalType      0x0201 Microphone
        bAssocTerminal          2
        bNrChannels             4
        wChannelConfig     0x0000
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID             2
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          1
        bSourceID               3
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                 3
        bSourceID               1
        bControlSize            1
        bmaControls( 0)      0x00
        bmaControls( 1)      0x02
          Volume
        bmaControls( 2)      0x02
          Volume
        bmaControls( 3)      0x02
          Volume
        bmaControls( 4)      0x02
          Volume
        iFeature                0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           2
        bDelay                  1 frames
        wFormatTag              1 PCM
      AudioStreaming Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             4
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            1 Discrete
        tSamFreq[ 0]        16000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0300  1x 768 bytes
        bInterval               4
        bRefresh                0
        bSynchAddress           0
        AudioControl Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         0 Undefined
          wLockDelay              0 Undefined
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)
unsolo
Posts: 155
Joined: Mon Apr 16, 2007 2:39 am
Location: OSLO Norway

Post by unsolo »

Usually when you have four microphones(antennas,cameras) they are used for direction/tracking. Figuring out which is which may be nice in order to attempt to make something that translates the signals into relative directions by looking at the doppler shifts.
Don't do it alone.
big
Posts: 5
Joined: Fri Dec 01, 2006 7:05 pm
Contact:

Post by big »

1415 is present also on singstar usb descriptor, reference:

http://www.qbik.ch/usb/devices/showdescr.php?id=2623
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

unsolo wrote:Usually when you have four microphones(antennas,cameras) they are used for direction/tracking. Figuring out which is which may be nice in order to attempt to make something that translates the signals into relative directions by looking at the doppler shifts.
Yep, I already figured out the order, it's listed in the first post.
It's not doppler shift, just the relative phase shift between inputs. If you're sampling at say 44100 then you should be able to resolve about a quarter inch difference in path length between mics. Indeed, I did some quick tests with Audacity and the difference between left/right clapping is definitely visible. I'll focus on getting the camera to work before I play with the audio too much more, though. :)
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

I can take pictures now: http://ps3.jim.sh/eye/
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Some effort? Looks effortless to me. :)

Nice work.
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

Yeah, it wasn't so bad; basically just more-or-less matching the PS3's initialization sequence and then read the frame data on bulk EP 1. It's coming at 640x480 uncompressed YUYV at the moment, so it's a really high data rate and my libusb-based test program is having trouble dealing with that (a kernel driver shouldn't have a problem).

According to the SCCB product & version registers, the OV chip used in here is most likely an OV7721 (or something close). After writing my test program and realizing that the command structure was very similar to the OV51x series interface chips, I took it apart and found that it's just an OV538. In fact it even has "NEW EYETOY OV538 SOLUTION" silkscreened on the board, so it's not that much of an upgrade:

EyeToy: OV519 + OV7648
Playstation Eye: OV538 + OV7721

Getting docs on these chips is difficult, but I'll see what I can find. The "ECX" Windows driver here includes a data/settings file for the OV7720, which might be useful.
big
Posts: 5
Joined: Fri Dec 01, 2006 7:05 pm
Contact:

Post by big »

ov519 and ov7640 documentation is easy to find, i have a complete doc for both it was very helpfull for my full eyetoy(audio and video) iop replacement. However OV538 and OV7720 will be more difficult to find, we will make a try...

Do you know if 0V772X support 120fps with 320x240?

Good place to read http://ovcam.org/ov511/
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

Sony says it supports 120fps at 320x240, but I don't know.

With what I have, I can write a simple limited-functionality driver already, so even if we can't find docs we can get something going and just experiment from there. Right now I'm not sure the best way to write this driver -- looking at existing drivers, it seems I could go the route of a full implementation in one file (like ov7670.c) or add the sensor to the ovcamchip i2c layer and make an interface like w9968cf.
Mihawk
Posts: 29
Joined: Tue Apr 03, 2007 2:04 am

Post by Mihawk »

Any chance to get you to post some sample program with source code? ;)
Ask and it will be given to you; seek and you will find; knock and the door will be opened to you.
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

Mihawk wrote:Any chance to get you to post some sample program with source code? ;)
Here's my test app: https://jim.sh/svn/jim/devl/playstation/ps3/eye/test/. It drops most of the data because libusb just can't handle it well. After initializing it waits for 100 complete frames for the camera to settle, then prints out the last one as a ppm.
Mihawk
Posts: 29
Joined: Tue Apr 03, 2007 2:04 am

Post by Mihawk »

Thanks a lot jimparis. :)
I will have a closer look later after work.
Ask and it will be given to you; seek and you will find; knock and the door will be opened to you.
molster
Posts: 8
Joined: Thu Dec 06, 2007 9:09 am

Post by molster »

Ive been searching the web every day for the last week, and it seems that you are the closest to making a working webcam out of this thing! YOU ROCK! Please keep posting as your make progress.

And even if you can only make it take pics, can you post the drivers for that?
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

I did post it, look 3 posts up. I haven't had time to work on a kernel driver yet, but it's still on my TODO...
molster
Posts: 8
Joined: Thu Dec 06, 2007 9:09 am

Post by molster »

yes, but thats in the source form, Im not sure how to turn it into a usable form for me. Could you explain how to do that if you have the time? cuase that would be great, like i said, out of everywhere ive looked, your the closest to having it working perfectly =)
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

cd in to the folder where you downloaded Jim's files, and type 'make'.

Jim
molster
Posts: 8
Joined: Thu Dec 06, 2007 9:09 am

Post by molster »

Jim thank you very much for your reply =) I saved all the files to a folder, and did make, however, and error came up.

gcc -Wall -c -o eye.o eye.c
make: gcc: Command not found
make: *** [eye.o] Error 127

I dont have a file named eye.o only eye.c

edit: ahh i see I dont have Gnu C Compiler. Anyway I can compile without?
weltall
Posts: 310
Joined: Fri Feb 20, 2004 1:56 am
Contact:

Post by weltall »

molster wrote:Jim thank you very much for your reply =) I saved all the files to a folder, and did make, however, and error came up.

gcc -Wall -c -o eye.o eye.c
make: gcc: Command not found
make: *** [eye.o] Error 127

I dont have a file named eye.o only eye.c

edit: ahh i see I dont have Gnu C Compiler. Anyway I can compile without?
no way, except compiling it somewere else
molster
Posts: 8
Joined: Thu Dec 06, 2007 9:09 am

Post by molster »

I have, Microsoft Viusal C#, Microsoft Visual c/c++ and bloodshed Dev-c++ for compliers.

However, other than compiling DS games, im not to good at the compiling thing, how would I compile the file correctly. Or could someone else compile it, and then upload it?
2.6,CRACKED!
Posts: 18
Joined: Thu Jul 26, 2007 9:02 pm

Post by 2.6,CRACKED! »

dev-c++ does, how else do you think you're compiling it?

its in this directory: C:\Dev-Cpp\bin
molster
Posts: 8
Joined: Thu Dec 06, 2007 9:09 am

Post by molster »

What im trying to say is im a newb when it comes to all this, I can make my homebrew for DS, and script in flash, other than that, 101% noob. Anyway, I tried loading eye.c into dev-c++ but it gets loads of errors cuase im missing files, Im guessing im missing the needed libary.

and I see the gcc.exe in the bin folder... but its not the noraml windows install version, its a version just for dev-c++ for its compiling correct? im guessing thats why it wont work.
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

This is not for noobs. I wouldn't expect it to compile or work under Windows although work could be done to get it there.
molster
Posts: 8
Joined: Thu Dec 06, 2007 9:09 am

Post by molster »

haha, understood, looks like ill just have to wait patiently. Hopefully youll have it fully working, and for windows someday, as im really looking forward to it, and it seems that your the only person working on it!
StrmnNrmn
Posts: 46
Joined: Wed Feb 14, 2007 11:32 pm
Location: London, UK
Contact:

libusb on win32 issue

Post by StrmnNrmn »

hi jimparis,
thanks for this work! I managed to compile your code with minimal changes on win32 using libusb-win32, after creating the necessary windows .inf files etc.

it finds the device ok,
however usb_claim_interface fails with error -22. after a bit of googling it seems that on win32 you need to call usb_set_configuration before you call usb_claim_interface, which I tried. configuration 1 is the ony one I can make succeed (as in, usb_set_configuration(eye, 1)==0)

....and after that the claim_interface works! the led flickers on and off as requested, until it gets to the first eye_bulk_in, which fails again with error -22. this makes your 'wait for frame 100' code loop forever because the eyetoy is not sending back any bulk data for the frame.

help! do you have any ideas how I could bring it to life?
I'll post my win32 patches if its any help.
StrmnNrmn
Posts: 46
Joined: Wed Feb 14, 2007 11:32 pm
Location: London, UK
Contact:

more win32 info

Post by StrmnNrmn »

got a bit further... I found that bulk_in was failing with 'invalid endpoint 0x01' according to libusb; so I tried endpoint 0x81 and it started succeeding.
however the first call to bulk_in sends back 135232 bytes of image data - not enough to trigger your code to see a full frame. in fact that data looks like a 640x105 image of the top of the frame! and then each subsequent call to bulk in just goes into a loop returning alternately 12 and 4160 bytes. and that's it for the rest of time - no idea what is in those packets or where the rest of the frame went (or subsequent frames...). is this all because of my added 'set_configuration(eye,1)' call?....
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

usb_set_configuration & fixing the endpoint should be correct. If you'd like, I can give you svn commit access to that repository so you can add your win32 fixes, just PM me.

Not seeing a full frame is a big problem, but it's most likely because libusb is just too slow. At 640x480 60fps 16bit YUYV that's basically 300 MB/s, which comes close to saturating USB 2.0's theoretical 480 MB/s. I'd guess the Windows libusb library just isn't up to handling it. On my Linux system, I get full frames on maybe 10% of the attempts. A real driver would really help here.

It's not fully clear how the thing behaves on dropped frames. I think the 12-byte packet basically says "sorry, you lost data" and the 4160 is the start of the next frame (which gets dropped early because you spent too much time processing the 12-byte packet).

For testing, you could just modify it to look for the top of the frames (640x100?). Another option would be to look at the commands used to initialize the camera and figure out how to put it in a lower resolution/framerate.
StrmnNrmn
Posts: 46
Joined: Wed Feb 14, 2007 11:32 pm
Location: London, UK
Contact:

Post by StrmnNrmn »

thanks for the quick reply :)
the 4160 byte packets dont look much like image data sadly :(
the 12 byte packets are odd - here are some, 1 line per packet

Code: Select all

[0000]  0C CE 43 ED 0B 02 EB F1  1B 02 36 07              ..C.......6.
[0000]  0C CE F3 2D 1B 02 85 2C  2B 02 57 07              ..........W.
[0000]  0C CE A3 6E 2A 02 C2 73  3A 02 79 07              ...n...s..y.
[0000]  0C CE 53 AF 39 02 83 AE  49 02 9A 07              ..S.9...I...
[0000]  0C CE 03 F0 48 02 A1 F5  58 02 BB 07              ....H...X...
[0000]  0C CE B3 30 58 02 36 2C  68 02 DD 07              ...0X.6.h...
[0000]  0C CE 63 71 67 02 4F 71  77 02 FE 07              ..cqg.Oqw...
[0000]  0C CE 13 B2 76 02 E3 A9  86 02 1F 00              ....v.......
[0000]  0C CE C3 F2 85 02 41 F5  95 02 41 00              ......A...A.
[0000]  0C CE 73 33 95 02 77 3A  A5 02 62 00              ..s3..w...b.
[0000]  0C CE 23 74 A4 02 F5 72  B4 02 83 00              ...t...r....
[0000]  0C CE D3 B4 B3 02 42 BA  C3 02 A5 00              ......B.....
[0000]  0C CE 83 F5 C2 02 D7 F2  D2 02 C6 00              ............
[0000]  0C CE 33 36 D2 02 2B 3C  E2 02 E7 00              ..36........
[0000]  0C CE E3 76 E1 02 A2 72  F1 02 09 01              ...v...r....
[0000]  0C CE 93 B7 F0 02 BB B7  00 03 2A 01              ............
[0000]  0C CE 43 F8 FF 02 71 F4  0F 03 4B 01              ..C...q...K.
[0000]  0C CE F3 38 0F 03 AC 3B  1F 03 6D 01              ...8......m.
[0000]  0C CE A3 79 1E 03 C1 7E  2E 03 8E 01              ...y........
[0000]  0C CE 53 BA 2D 03 90 BB  3D 03 AF 01              ..S.........
[0000]  0C CE 03 FB 3C 03 8E FE  4C 03 D1 01              ........L...
[0000]  0C CE B3 3B 4C 03 21 37  5C 03 F2 01              ....L..7....
[0000]  0C CE 63 7C 5B 03 7C 80  6B 03 13 02              ..c.....k...
[0000]  0C CE 13 BD 6A 03 0D B9  7A 03 34 02              ....j...z.4.M
the bytes that look like '03' at the bottom there are some kind of timestamp, slowly ticking up...
anyway, ignoring them the consistent size of the 4160 byte packet (and it doesnt change when I pause in the debugger) implies I've somehow put the thing into a bad mode. alas.
oh well, I'll have to give up for a bit.
probably not worth committing any code yet :)
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

The 12-byte packet might be something like "you lost data, the next packet starts at this byte offset". Notice how the PS3 handles it if you plug the eye in through a full-speed hub which definitely can't handle the bandwidth: it draws a few lines of data at specific locations in the image as if it knows exactly where to put what little data it can receive. Anyway, I haven't really played with that aspect very much. I'm sure the protocol has a way to handle lost data like that, but again a proper driver for the thing (or figuring out how to maximize libusb performance) would make that less necessary.
StrmnNrmn
Posts: 46
Joined: Wed Feb 14, 2007 11:32 pm
Location: London, UK
Contact:

Post by StrmnNrmn »

jimparis: hmm, that sounds right! I didn't get any further with this, instead I borrowed a PC compatible webcam to solve the problem I was trying to use a ps3 eye for. but hopefully this will be resolved one day. as you say, libusb just isn't fast enough for 640x480x60x2... ah well. thanks for the code anyway :)
molster
Posts: 8
Joined: Thu Dec 06, 2007 9:09 am

Post by molster »

Drat, when I saw strmnnrmn posting here I thought he might actually get it to work for windows =( ohwell, thanks for the effort strmnnrn
Post Reply