Sunday 28 November 2010

Kinect driver for PlayStation 3

Well last weekend i bought a Microsoft Kinect device, today i had free time to make things happens...

First PlayStation 3 only see a NUIMOTOR device. After NUIMOTOR is correctly initialized, NUICAMERA and NUIAUDIO are shown and i can detect and control them, OpenKinect documentation about devices and protocols was very helpfull.

NUICAMERA has 2 isoc endpoints one for rgb and other for depth. Stuff is similar to my old eyetoy driver isoc frames and then parsing them to get real frames for user process and i believe that i can use my old eyetoy code with this.

Now i need only TIME to play with the new toy.....

Output from ugly and unfinished kinect sample driver:


PS3Load v0.1
Waiting for connection...
Receiving data... (0x0000cd83/0x0003da11)
Receiving arguments... 0x0000000d
Launching...
Sample Kinect Driver for PlayStation 3 Antonio José Ramos Márquez aka bigboss
Registering kinect driver return 0
kinect_probe:: dev_id=11
USB device probe for kinect getting device descriptor
Usb device found has idVendor 5e04
New usb device found has NUI_MOTOR idProduct b002
kinect_attach:: dev_id=11
Getting device descriptor
nuimotor_attach:: dev_id=11
Kinect NUI_MOTOR detected
Getting configuration descriptor
Number of interfaces 1
Getting interface descriptor
Verifying number of endpoints
Getting control endpoint descriptor for NUI_MOTOR 0
tryng to open control endpoint 0
nuimotor_control_transfer:: param0=0 param1=1
Set Configuration (bConfigurationValue=1)
nuimotor_control_done:: result=0x0 count=0 arg=0
nuimotor_control_transfer:: param0=1 param1=0
Set Interface (bInterfaceNumber=0, bAlternateSetting=0)
nuimotor_control_done:: result=0x50 count=0 arg=1
result=0x50 count=0 arg=1
nuimotor_control_transfer:: param0=2 param1=0
Sending event NUIMOTOR_READY
Received event NUIMOTOR_READY now it's time to angle and led settings
nuimotor_control_transfer:: param0=3 param1=0
init motor
nuimotor_control_done:: result=0x0 count=1 arg=3
nuimotor_control_transfer:: param0=4 param1=0
set angle
nuimotor_control_done:: result=0x0 count=0 arg=4
nuimotor_control_transfer:: param0=5 param1=0
set led
nuimotor_control_done:: result=0x0 count=0 arg=5
nuimotor_control_transfer:: param0=6 param1=0
motor ready time to camera and audio sending NUIMOTOR_ENABLED
Nuimotor initialized set angle and led to red done tryng to see if other devices are already availables
kinect_probe:: dev_id=12
USB device probe for kinect getting device descriptor
Usb device found has idVendor 5e04
New usb device found has NUI_AUDIO idProduct ad02
kinect_attach:: dev_id=12
Getting device descriptor
nuiaudio_attach:: dev_id=12
Kinect NUI_AUDIO detected
Getting configuration descriptor
Verifying number of endpoints 4
Getting control endpoint descriptor for NUI_AUDIO 1
nuiaudio_control_transfer:: param0=0 param1=1
Set Configuration (bConfigurationValue=1)
nuiaudio_control_done:: result=0x0 count=0 arg=0
nuiaudio_control_transfer:: param0=1 param1=0
Set Interface (bInterfaceNumber=0, bAlternateSetting=0)
nuiaudio_control_done:: result=0x50 count=0 arg=1
result=0x50 count=0 arg=1
nuiaudio_control_transfer:: param0=2 param1=0
Sending event NUIAUDIO_READY
Received event NUIAUDIO_READY TODO audio initialization and isoc stuff
kinect_probe:: dev_id=13
USB device probe for kinect getting device descriptor
Usb device found has idVendor 5e04
New usb device found has NUI_CAMERA idProduct ae02
kinect_attach:: dev_id=13
Getting device descriptor
nuicamera_attach:: dev_id=13
Kinect NUI_CAMERA detected
Getting configuration descriptor
Verifying number of endpoints 2
Getting control endpoint descriptor for NUI_CAMERA 2
nuicamera_control_transfer:: param0=0 param1=1
Set Configuration (bConfigurationValue=1)
nuicamera_control_done:: result=0x0 count=0 arg=0
nuicamera_control_transfer:: param0=1 param1=0
Set Interface (bInterfaceNumber=0, bAlternateSetting=0)
nuicamera_control_done:: result=0x50 count=0 arg=1
result=0x50 count=0 arg=1
nuicamera_control_transfer:: param0=2 param1=0
Sending event NUICAMERA_READY
Received event NUICAMERA_READY TODO camera initialization and isoc stuff
kinect_detach:: dev_id=12
nuiaudio_detach:: dev_id=12
Sending event NUIAUDIO_DETACH
kinect_detach:: dev_id=11
nuimotor_detach:: dev_id=11
Sending event NUIMOTOR_DETACH
kinect_detach:: dev_id=13
nuicamera_detach:: dev_id=13
Sending event NUICAMERA_DETACH
Event received NUIAUDIO_DETACH
Event received NUIMOTOR_DETACH
Event received NUICAMERA_DETACH
time to go to XMB and unregister kinect driver...

5 comments:

K1n3ct said...

Really Interesting I was just going to start doing the same, maybe I can help you ...

bigboss said...

First a fully libusbd for psl1ght must be added, then making a driver would be easy

K1n3ct said...

I see,
in fact I can't find any USB support in psl1ght, where did you get from the basic USB support you are using here ?

do I miss something ?

bigboss said...

Right now we are working to add this support to psl1ght. When you try to call to UsbdInit in psl1ght an interrupt exception is showed and it return to XMB, we are tryng to fix that. A few minutes ago i was speaking with Matthew about this issue.


sample usb stuff still can't be done with psl1ght.

module has 0x1c id and these are their nid exports fuctions
EXPORT(UsbdAllocateMemory,0x074dbb39);
EXPORT(UsbdInterruptTransfer,0x0f411262);
EXPORT(UsbdOpenPipe,0x254289ac);
EXPORT(UsbdScanStaticDescriptor,0x2fb08e1e);
EXPORT(UsbdRegisterLdd,0x359befba);
EXPORT(UsbdEnd,0x35f22ac3);
EXPORT(UsbdSetThreadPriority2,0x5c832bd7);
EXPORT(UsbdGetPrivateData,0x5de3af36);
EXPORT(UsbdSetPrivateData,0x63bfdb97);
EXPORT(UsbdUnregisterLdd,0x64951ac7);
EXPORT(UsbdHSIsochronousTransfer,0x7a1b6eab);
EXPORT(UsbdRegisterExtraLdd,0x7fe92c54);
EXPORT(UsbdUnregisterExtraLdd,0x90460081);
EXPORT(UsbdClosePipe,0x9763e962);
EXPORT(UsbdControlTransfer,0x97cf128e);
EXPORT(UsbdBulkTransfer,0xac77eb78);
EXPORT(UsbdRegisterExtraLdd2,0xbd554bcb);
EXPORT(UsbdGetDeviceSpeed,0xbdbd2428);
EXPORT(UsbdSetThreadPriority,0xc24af1d7);
EXPORT(UsbdInit,0xd0e766fe);
EXPORT(UsbdGetThreadPriority,0xd5263dea);
EXPORT(UsbdGetDeviceLocation,0xdb819e03);
EXPORT(UsbdIsochronousTransfer,0xde58c4c2);

K1n3ct said...

Many thnX, really helpful!

U r doing a really great job ..