Rumble and wireless assistance

USB Joystick driver for RISC OS 5
Post Reply
richw
Posts: 178
Joined: Sat Sep 14, 2013

Rumble and wireless assistance

Post by richw »

Hi all,

Has anyone got a controller with 'rumble' motors? Ideally, something which is still pretty popular, like: PS 3/4/5, or XBOX (360 or later) devices. I only have:
  • A cheapo Chinese clone of an XBOX360 wired controller (even though it's wireless) and it doesn't contain any motors. It claims to support rumbling, but testing it out in Windows, shows that it doesn't.
  • An ancient PS 1 (!) to USB adapter with an old 'dual shock' PS 1 controller. Whilst I have got this to work, in that I can control the motors successfully, it doesn't work in the same way as the more modern PS/XBOX devices would, so it's a bit of a dead-end.
I am also interested in controllers like the XBOX360 wireless one, as I recall there being issues with that in the past (flashing lights? poor battery life?).

I've attached a prototype build of USBJoystick (still marked 0.24 - but it isn't!). I would be grateful if anyone can try this module out.

Code: Select all

*USBJoystick_List
lists each controller with its slot number and what it can do (Rumble, if the driver knows how).

Code: Select all

*USBJoystick_Debug <slot>
adds technical detail: how output reaches the controller, and whether it has an OUT endpoint.

If it says Rumble try

Code: Select all

*USBJoystick_Rumble <slot> 65535 0 800
then

Code: Select all

*USBJoystick_Rumble <slot> 0 65535 800. 
These run the big (low-frequency) motor and then the small (high-frequency) one, for 0.8 seconds each.

Code: Select all

*USBJoystick_Rumble <slot> 0 0
should stop it if anything sticks.


If it doesn't say Rumble, and you're experimenting

Code: Select all

*USBJoystick_SendOut <slot> <bytes> 
sends bytes straight to the controller's OUT endpoint, if it has one. The slot's Debug page shows whether it does.

Code: Select all

*USBJoystick_SendReport <slot> <report-id> <bytes> 
sends a HID output report over the USB control pipe. This is for controllers with no OUT endpoint, such as my simple PlayStation adaptor.

Bytes are in hex. Each command prints one line saying what it sent, or says exactly what was wrong.


On the XB360 wireless malarkey, it would be nice to see if we can set the ring to 'player 1'. So please try these:

Code: Select all

*USBJoystick_SendOut <slot> 01 03 06
*USBJoystick_SendOut <slot> 00 00 08 46 00 00 00 00 00 00 00 00
Do either work? The idea is to stop the four flashing LEDs, and have one steady LED.

The 'pattern' could be varied (that is the last byte of the first line, or the fourth byte of the second, where it's 40+pattern).

Pattern:
00 all off
06 to 09 - LED 1-4 steady
02 to 05 - LED 1-4 flashing
0A - rotating
01 - all blinking


I would find useful/interesting:
  • The *USBJoystick_List and *USBJoystick_Debug output.
  • The exact commands you tried, and what the controller did.
  • If it errors or does nothing, the Reporter output from around that moment.

These commands send raw bytes to your hardware, so a guess might make a controller do something odd. Unplugging and re-plugging the controller should reset it!
Attachments
usbjtest.zip
(38.56 KiB) Downloaded 1 time
Post Reply