USB Host PS3 Move Controller

Hey
Since I got the PS3 Controller working via bluetooth (http://wiki.tinyclr.com/index.php?title=PS3_Controller) I really wanted to try to connect a PS3 Move Controller as well.

I can read all the buttons, gyro, accelerometer etc, as described here: http://code.google.com/p/moveonpc/wiki/InputReport , by reading the L2CAP interrupt channel.
But as soon as I write a value, to light up the LED or make it rumble. It stops sending data via the interrupt channel.

As described here: motioninjoy.com - motioninjoy Resources and Information. , one has to read the “read feature report 0”, but how to read a future report via the L2CAP channel?
Do I have to use the control channel like this:

raw.SendSetupTransfer(bmRequestTpe, bRequest, wValue, Index,data, dataOffset, dataCount)

As I did, when setting up the bluetooth dongle?

To read the interrupt channel in the beginning I use the following command, where BulkInPibe, is the Bulk input endpoint:

BulkInPipe.TransferData(BulkInBuffer, 0, BulkInBuffer.Length);

And to set the LED and rumble I use the following code:


public void hid_MoveSetLedOn(byte r, byte g, byte b, byte rumble)
{
HIDMoveBuffer[0] = 0x52;// HID BT Set_report (0x50) | Report Type (Output 0x02)            
HIDMoveBuffer[1] = 0x02;// Report ID
HIDMoveBuffer[2] = 0x00;//Always 0x00

//RGB values for the LED inside controller
HIDMoveBuffer[3] = r;
HIDMoveBuffer[4] = g;
HIDMoveBuffer[5] = b;

HIDMoveBuffer[6] = 0x00;//Always 0x00
HIDMoveBuffer[7] = rumble;//0-255

HID_Command(HIDMoveBuffer, 8);
}


        void HID_Command(byte[] data, int length)
        {
            byte[] buf = new byte[64];
            buf[0] = (byte)(hci_handle & 0xff);    // HCI handle with PB,BC flag
            buf[1] = (byte)(((hci_handle >> 8) & 0x0f) | 0x20);
            buf[2] = (byte)((4 + length) & 0xff); // HCI ACL total data length
            buf[3] = (byte)((4 + length) >> 8);
            buf[4] = (byte)(length & 0xff); // L2CAP header: Length
            buf[5] = (byte)(length >> 8);
            buf[6] = command_scid[0];
            buf[7] = command_scid[1];

            for (uint i = 0; i < length; i++)//L2CAP C-frame            
                buf[8 + i] = data[i];

            BulkOutPipe.TransferData(buf, 0, length + 8);            
            Thread.Sleep(150);//There have to be a delay between commands            
        }

After the LED or rumble is set, nothing is changing on the interrupt channel. I think I have to read the feature report 0 after setting the LED or rumble, as it might not be possible to read it via the interrupt channel anymore, but I simple can not figure out how.

PS: I got a lot of inspiration from the following link: GitHub - thp/psmoveapi: Cross-platform library for 6DoF tracking of the PS Move Motion Controller. Sensor fusion, computer vision, ambient display (LED orb). . See “psmove.c” and “psmove.h”.

Very cool :slight_smile:

What is next? Microsoft Kinnect?

Thanks Gus. It’s just a pain in the ass - sorry for my french - that I can read the report just fine, but when turn on the LED or make it rumble, it just stops working :slight_smile:

I think I will get the navigation controller (PlayStation Move - Wikipedia) working first, as it would be a really nice one-handed remote and then i got all the controllers supported :slight_smile:

I do not own a Xbox 360, and the Kinnect is a bit above my budget - but if I can get my hands on one, then maybe :smiley:

Maybe you have power issues?

I have to take a look at in sunday, it’'s 3am here in Denmark, so it’s time for bed :slight_smile:
But I think it has something to do with the code, but I’m not sure.

I got it working, I was using the wrong channel (HID control instead of HID interrupt). I will update the wiki soon with the new code :slight_smile: