PlayStation 3 SIXAXIS, PlayStation 3 BDRemote, and XBox 360 Controller - GlovePIEPreservation/GlovePIE GitHub Wiki

Jump to PlayStation BDRemote
Jump to XBox360 Controller

PlayStation 3 SIXAXIS

The SIXAXIS, or PS3 Controller, is intended to be a wireless Bluetooth HID device, which can also connect via a USB charge cable.

Unfortunately it is NOT a valid Bluetooth device, so it can’t connect to the PC via Bluetooth without rewriting the operating system. Rewriting the operating system is only an option on Linux.

So you can only use it with GlovePIE while it is plugged into a USB port with a USB charge cable. So it effectively becomes a wired controller instead of a wireless one.

If you don’t own a PS3, you will need to buy a USB charge cable. I bought a MadCatz one.

GlovePIE 0.40 now sort of supports the Dual Shock 3, except that you can’t use the gyro without making it rumble constantly at 50% strength. That’s because the same value seems to control the voltage to both the gyro and the rumble.

Installation

True to form, it is also NOT a valid HID device, so the only way to read it from Windows is by using a special driver called LibUSB-win32. This driver allows it to communicate with USB devices directly without going through the normal windows HID layer.

You can download LibUSB-win32 from here: http://sourceforge.net/project/showfiles.php?group_id=78138

There are two varieties of LibUSB-Win32. There is a "Filter Driver", which allows the program to talk to any USB device but also allows Windows to talk to it at the same time. This means you can use the SIXAXIS with GlovePIE and as a normal joystick at the same time.

The other variety is the the "Device Driver", which is a replacement driver for that particular device, and only allows GlovePIE and other libusb-win32 programs to talk to that hardware. Windows will no longer be able to talk to that device if you use the device driver. The "Device Driver" works fine with GlovePIE (you will need PPJoy to use it as a fake joystick) but won't work with anyone else's sixaxis driver, because they rely on windows being able to talk to it.

On Windows Vista, I couldn't get the Filter Driver to install successfully, so you will probably need to use the "Device Driver" if you have Vista. On my Windows XP computer I got the Filter Driver to install, but it crashes whenever I run GlovePIE or any of the SIXAXIS drivers made by other people. However it must work for some people, because all the other sixaxis drivers say to use the Filter Driver. So if you are not using Vista, try the Filter Driver first.

The filter driver is easy to install. So you won't need any help with that.

The device driver is much harder to install. It comes with a program called "inf-wizard" in the "bin" folder. You need to run this program. Then you need to plug in your SIXAXIS into a USB port that you DON'T want to use for the SIXAXIS. Because windows will detect it and install its own driver on that port, stopping that port from working with LibUSB. If windows asks you about installing a driver when you plug it in, say no. Then press "Next" in inf-wizard. Then choose the device which says "0x054C, 0x0268" (your SIXAXIS). Then click next. You don't need to change the manufacturer name or device name unless you want to, so click next. Then it will pop up a save dialog box. You need to save it in the same bin folder where you ran inf-wizard from. It doesn't matter what you call it, but I called it "sixaxis-libusb.inf". If User Account Control won't let you save it in the bin folder, save it somewhere you can find it, and then afterwards copy the ".inf" and ".cat" files into the bin folder manually. You now have a libusb driver for the sixaxis ready to install. You can't install it by right-clicking, so instead go into Control Panel, Add [New] Hardware. Click Next. Choose to install the hardware from a list, Show all devices, have disk. Then browse to the libusb-win32 bin directory. Select the .inf file you created, and click next to install it. The driver is unsigned because Microsoft doesn’t allow anyone except companies to sign drivers, so if it complains, tell it to install anyway. Then your libusb device driver should be installed. Now you need to plug your SIXAXIS into a port that you haven't plugged it into before, and it should work. To use it on a port that you have plugged it into before, you will need to remove the existing HID driver installed by windows.

Once you have got the libusb installed, and your sixaxis plugged into a new usb port, you should use the testlibusb-win program to test it. It should include the Sony Playstation 3 controller in its list. If it doesn't, and the driver says version -1,-1,-1,-1 it means the filter driver didn't install correctly, so you may want to uninstall it and either try again, or use the device driver instead. On the other hand, if the driver version is right, but the Sony playstation 3 controller isn't listed, try plugging it into a different port and running testlibusb-win again. If it doesn't show up in testlib-usb then it won't work with GlovePIE.

Once you have libusb-win32 working, you can run GlovePIE.

Using SIXAXIS in GlovePIE

The SIXAXIS won't do anything until you switch it on by pressing the PS button.

There is a chance glovepie will freeze up when you try to use the sixaxis due to a bug in Libusb-win32. This happened to me on my WinXP computer. If this happens then you won't be able to end the task in task manager, and you have to reboot. Uninstall the filter driver if this is happening and try the device driver.

When you start your script, you should leave the SIXAXIS sitting still for a few seconds while it calibrates the rate gyro so it can calculate Yaw. The SIXAXIS accelerometers should be calibrated first from the CP-Settings menu for this to work properly.

To read the raw accelerations, use SixAxis.RawForceX, Sixaxis.RawForceY, and Sixaxis.RawForceZ. When the sixaxis is in free-fall all the forces will be 0. When you hold it up against gravity, the force of you holding it up will be included, along with any actual accelerations. X means towards the right of the sixaxis (in the direction of the circle button), Y means towards the top of the sixaxis, Z means towards the front of the sixaxis (where the USB cable is).

You should not use the raw accelerations in your scripts. Instead you should go to the CP-Settings menu and choose SIXAXIS calibration. Then follow the instructions to calibrate all your SIXAXES. Once you have saved the calibration you will be able to use SixAxis.Roll, SixAxis.Pitch, SixAxis.SmoothRoll, and SixAxis.SmoothPitch to get the SIXAXIS rotation. You will also be able to use SixAxis.gx, SixAxis.gy, and SixAxis.gz to get the raw accelerations (including gravity) measured in Gs. You can then use SixAxis.RelAccX, SixAxis.RelAccY, and SixAxis.RelAccZ.

To read the analog sticks use SixAxis.Joy1x, Joy1y, Joy2x, and Joy2y. They are between -1 and 1. You can also read DPadX and DPadY the same way.

Pushing vertically down on the analog sticks gives you the L3 and R3 buttons. They are digital and can only be true or false. The Select, Start, and PS buttons are the same.

The other buttons can all be read as either analog or digital. The analog version will be between 0 and 1, and end with "Analog". The digital versions are true or false.

Sixaxis.yaw tells you the yaw angle. Unlike the pitch and roll, the absolute yaw can never be measured. The SIXAXIS uses a rate-gyro to measure the speed of yaw rotation, and keeps track of the yaw value based on yaw speed. If you rotate the SIXAXIS too fast, the gyro sensor will max out, and the yaw value will become incorrect. Also if you are tilting the SIXAXIS while you yaw it, the yaw value will also become incorrect.

Unlike pitch and roll, your script can set Sixaxis.yaw. Normally you will want to set it to zero when the user presses a button. For example:

If sixaxis.circle then sixaxis.yaw = 0

To calibrate the SIXAXIS gyro, you can read sixaxis.RawGyro. You can then set sixaxis.RawGyroZero to the value that corresponds to not rotating at all. You should do this if your yaw keeps drifting. Eg.

If sixaxis.square then sixaxis.RawGyroZero = smooth(sixaxis.RawGyro)

You can also read or set sixaxis.DegreesPerRawGyro if turning the SIXAXIS 180 degrees doesn’t turn the yaw by 180 degrees.

The SIXAXIS has 4 player LEDs, like the Wiimote. Unlike the Wiimote, these LEDs are controlled by a timer chip and can be set to flash at any rate, in any pattern.

Sixaxis.Led1Frequency = 10Hz

You can also make an LED turn itself off after a specific duration:

Sixaxis.Led1Duration = 1 second

You can set it to infinity if you want it to stay on:

Sixaxis.Led1Duration = infinity

Bluetooth

You can read or set the BlueTooth MAC Address which is stored in the Sixaxis, by using Sixaxis.BlueToothMAC. On a new sixaxis it will be "00:00:00:00:00:00". You should set it to the address of the bluetooth adapter on your computer. Then your SIXAXIS will be able to connect to that Bluetooth adapter. You will need to go into your bluetooth stack to find the address of your bluetooth adapter. You could also try setting it to the bluetooth address of any other device you want to pair the SIXAXIS with. Here is an example of how to use it:

debug = sixaxis.BluetoothMAC
if pressed(sixaxis.PS) then
  sixaxis.BluetoothMAC = "00:10:C6:59:00:4A" // put your BT address here
end if

Once you have set the BluetoothMAC, you can make the SIXAXIS discoverable by pressing the PS button.

Unfortunately when I try to pair the SIXAXIS using Bluetooth it keeps connecting and then disconnecting. I have never successfully paired the SIXAXIS via bluetooth. If you do get the SIXAXIS to pair via bluetooth, let me know how you did it. But GlovePIE does not support SIXAXES connected via Bluetooth yet.

Sometimes it stops working

If your SIXAXIS stops working one day, you can fix the problem by pressing the Reset button on the back of your SIXAXIS. You will need a pin or skewer or something like that. The reset button will not reset the BluetoothMac. You can set the BluetoothMac back to its original value by setting it to "" or "00:00:00:00:00:00" in GlovePIE.

PlayStation 3 BDRemote

The BD Remote is the PlayStation 3's Blueray Disc remote. It is a Bluetooth remote control, like the Wii Remote is. You need to connect it using your Bluetooth software before you can use it in GlovePIE. You also need to use the correct setting for Bluetooth Fix in the troubleshooter menu. It should be off for BlueSoleil, and on for Microsoft.

The BD Remote has many buttons, they will be either true or false. You can assign them to keys like this:

Escape = BDRemote.Eject

Here is the complete list of buttons:

Eject, Num1, Num2, Num3, 
Audio, Num4, Num5, Num6,
Angle, Num7, Num8, Num9,
Subtitle, Clear, Num0, Time,
Blue, Red, Green, Yellow,
Display, TopMenu, Popup, Return,
Triangle, Circle
Up, Down, Left, Right, Enter
Square, Cross
L1, PS, R1,
L2, R2,
L3, Select, Start, R3,
Rewind, Play, FastForward,
Prev, Stop, Next,
StepRev, Pause, StepFwd

Some buttons can be read while you're holding down multiple buttons, and some buttons can only be read when you're only holding down a single button.

The buttons which are also on a SIXAXIS or normal playstation controller, plus the Enter button (which is not on a SIXAXIS) can always be read even when you hold down multiple buttons. Other buttons can't.

You can tell when the user is holding down too many buttons at the same time with: BDRemote.TooManyButtons. It is true or false.

You can also tell which button is currently down by reading: BDRemote.Button which is 0 for no button, or a number between 1 and 254 indicating which button is down, or -1 for too many buttons.

You can tell whether any button is pressed or not with BDRemote.AnyButton which is either true or false.

There is also BDRemote.Exists, and BDRemote.Count.

XBox360 Controller

!The XBox360 controller can't be emulated in GlovePIE 0.45 Free!

The XBox360 controller is a Microsoft gamepad that is only partially compatible with Microsoft’s DirectInput. GlovePIE can read it both as a joystick, or as an XInput device. XInput is Microsoft’s new alternative to DirectInput that only works on Microsoft gamepads.

I don’t have an XBox360 controller, so I haven’t GlovePIE with it yet.

Unlike its competitors, the XBox360 controller has no motion sensing. It has two analog sticks (joy1, and joy2), and two analog triggers (LeftTrigger, RightTrigger). The rest of the buttons are digital. The gamepad can also vibrate.

GlovePIE supports a maximum of four XBox360 controllers. They will be called XInput1, XInput2, XInput3, and XInput4. If you need more than 4, then you can read them as joysticks instead.

You can’t control the LEDs in the “Ring Of Light”. They will be set automatically to whatever the player number is. You also can’t use the home button.

XInput1.A, XInput1.B, XInput1.X, and XInput1.Y are the main buttons. They are either true or false.

XInput1.Back and XInput1.Start are the Back and Start buttons on either side of the ring of light. They are either true or false.

XInput1.Up, XInput1.Down, XInput1.Left, and XInput1.Right are the DPad directions. They are also either true or false.

XInput1.LeftShoulder and XInput1.RightShoulder are the (digital) shoulder buttons, and are true or false.

XInput1.LeftTrigger and XInput1.RightTrigger are the analog trigger buttons under the shoulder buttons. They will be between 0 and 1.

XInput1.LeftThumb and XInput1.RightThumb are the buttons that you trigger by pushing in the two joysticks (with your thumb). They are the equivalent of L3 and R3 buttons on a PlayStation controller (But don’t try this on a Wii Classic Controller).

XInput1.Joy1X is the horizontal input of the left joystick. It is between -1 and 1, with 1 being to the right. Joy1Y is the vertical input of the left joystick. Positive means down. You can also access it as a vector [x, y], with just XInput1.Joy1.

XInput1.Joy2X, XInput1.Joy2Y, and XInput1.Joy2 are the right joystick.

XInput1.ExtraButton1, and XInput1.ExtraButton2 don’t exist yet. But XInput allows for future controllers to add those buttons.

XInput1.Vibration1, and XInput1.Vibration2 control the vibration. You can set them to a value between 0 and 1.

XInput1.Exists is true if that controller exists. XInput.count is the total number of XInput controllers connected (0 to 4).