Rumble and wireless assistance

USB Joystick driver for RISC OS 5
Post Reply
richw
Posts: 182
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!
Last edited by richw on Fri Oct 09, 2026, edited 1 time in total.
JonAbbott
Posts: 3308
Joined: Thu Apr 11, 2013
Location: Essex
Contact:

Re: Rumble and wireless assistance

Post by JonAbbott »

richw wrote: Tue Oct 06, 2026 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 have a selection of XB360 wireless controllers, so will try to test this for you.

I also need to update USBJoystick in ADFFS 2.89 and test some games. I'm hoping to also use some of the new SWI to support dual sticks on the couple of games that could use them, Bloodlust and Conqueror spring to mind.
richw
Posts: 182
Joined: Sat Sep 14, 2013

Re: Rumble and wireless assistance

Post by richw »

JonAbbott wrote: Fri Oct 09, 2026 I have a selection of XB360 wireless controllers, so will try to test this for you.
Great, thanks. I'm looking to see if I can also buy some knock-offs from eBay, but it's never clear what you're going to get with a clone!
JonAbbott wrote: Fri Oct 09, 2026 I also need to update USBJoystick in ADFFS 2.89 and test some games. I'm hoping to also use some of the new SWI to support dual sticks on the couple of games that could use them, Bloodlust and Conqueror spring to mind.
I wouldn't rush to those new SWIs just yet: they are very much drafts. I will probably be making some tweaks to them before long. I'm trying to keep some basic functionality in-place (such as the auto-map for the basic Joystick_Read, and then some new SWIs for enumeration and additional axes/buttons, and soon rumble). I also want to be able to expose a slightly lower-level interface which, say, SDL could harness (it has all sorts of community-led cleverness for dealing with the large number of controllers out there in the real world).

I never thought that some legacy games could be candidates for this. Ideally, you don't want to try patching in brand-new controller enumeration and mapping screens (!) so maybe we can think of a way to make that work.

Oh, and I also want to see what the wider community thinks. Ideally, it would become acceptable to end up in the ROOL Wiki/PRM. I appreciate that this may be the most difficult part. ;)
JonAbbott
Posts: 3308
Joined: Thu Apr 11, 2013
Location: Essex
Contact:

Re: Rumble and wireless assistance

Post by JonAbbott »

I've just gone to test this and both this and 0.24 trigger an Abort on a Pi3 due to an unaligned read.

I suspect you just need to tweak the compile options, but should you need to look at the code, in the uncompressed 0.24 @ +7858:

Code: Select all

LDR R3,[R3,#2]     ; R3=&2025F3B8
richw
Posts: 182
Joined: Sat Sep 14, 2013

Re: Rumble and wireless assistance

Post by richw »

Oh, rats! That'll be why someone on the ROOL forums said there was an AODT when they ran it, and I couldn't see why! I'm running on a combination of RPCEmu and Pi 1, so pre ARM v7.

I've re-issued 0.24 based on the ROOL GitLab CI output (which should be the latest Norcroft, which should be v7 safe by default).

For this test version, please see attached. I've gone with ROOL's advice from https://www.riscosopen.org/wiki/documen ... y%20primer and added the compiler flag. My DDE is from 2016, so wasn't making v7-safe code by default.

Would you mind trying again with this module?
Last edited by richw on Sat Oct 10, 2026, edited 1 time in total.
JonAbbott
Posts: 3308
Joined: Thu Apr 11, 2013
Location: Essex
Contact:

Re: Rumble and wireless assistance

Post by JonAbbott »

The recompiled 0.24 and test build have resolved the Abort.

Testing with an official Xbox 360 Wireless Receiver for Windows with a wireless XB360 controller:

Rumble wasn't detected so I couldn't test any of those commands.

USBJoystick_List output (controller on and attached to slot 0):

Code: Select all

Joystick slot 0 ( - Xbox 360 Wireless Receiver for Windows)
  Local USB device name            : USB5
  Interface                        : 0
  Endpoint                         : 1
  Device manufacturer              : 
  Device product name              : Xbox 360 Wireless Receiver for Windows
  Device serial number             : FD8EAC00
  Driver                           : XBOX360 wireless controller
  Capabilities                     : None
  Number of axes                   : 8
  Number of buttons                : 11
  HAT switch                       : No
  DPAD                             : Yes
Joystick slot 1 ( - Xbox 360 Wireless Receiver for Windows)
  Local USB device name            : USB5
  Interface                        : 2
  Endpoint                         : 3
  Device manufacturer              : 
  Device product name              : Xbox 360 Wireless Receiver for Windows
  Device serial number             : FD8EAC00
  Driver                           : XBOX360 wireless controller
  Capabilities                     : None
  Number of axes                   : 8
  Number of buttons                : 11
  HAT switch                       : No
  DPAD                             : Yes
Joystick slot 2 ( - Xbox 360 Wireless Receiver for Windows)
  Local USB device name            : USB5
  Interface                        : 4
  Endpoint                         : 5
  Device manufacturer              : 
  Device product name              : Xbox 360 Wireless Receiver for Windows
  Device serial number             : FD8EAC00
  Driver                           : XBOX360 wireless controller
  Capabilities                     : None
  Number of axes                   : 8
  Number of buttons                : 11
  HAT switch                       : No
  DPAD                             : Yes
Joystick slot 3 ( - Xbox 360 Wireless Receiver for Windows)
  Local USB device name            : USB5
  Interface                        : 6
  Endpoint                         : 7
  Device manufacturer              : 
  Device product name              : Xbox 360 Wireless Receiver for Windows
  Device serial number             : FD8EAC00
  Driver                           : XBOX360 wireless controller
  Capabilities                     : None
  Number of axes                   : 8
  Number of buttons                : 11
  HAT switch                       : No
  DPAD                             : Yes
USBJoystick_Debug output for slot 0 (the slot the controller is on):

Code: Select all

Joystick slot 0 ( - Xbox 360 Wireless Receiver for Windows)
  Path                    : devices#interface=0;endpoint=1;nopad;noblock:USB5
  File handle             : 251
  Data stream open        : Yes
  Local USB device name   : USB5
  Interface               : 0
  Endpoint                : 1
  Device manufacturer     : 
  Device product name     : Xbox 360 Wireless Receiver for Windows
  Device serial number    : FD8EAC00
  Driver                  : XBOX360 wireless controller
  Output transport        : None
  Capabilities            : None
  Report descriptor       : Baked in
  Report id               : None
  Report data offset      : 4
  Data validator          : Yes
  Start-up routine        : No
  Auto-flipped axis types : 2
  USB vendor id           : 0x045e
  USB product id          : 0x0719
  USB device id           : 0x0100
  Buffer handle           : 258
  Buffer internal id      : 220
  Buffer service routine  : 0xfc1e9fb4
  Buffer workspace        : 0x20003eb4
  DeviceFS handle         : 0x202b6af4
  Report data length      : 20
  Upcalls                 : 141 (delta: 130)
  Good reads              : 140 (delta: 130)
  Bad reads               : 1 (delta: 0)
  Raw report data         : 00 00 00 f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
  Number of axes          : 8
  Number of buttons       : 11
  HAT switch              : No
  DPAD                    : Yes
  Axes:
  Axis 00     Z : Slope 8 =    1 (mul), Slope 16 =  257 (mul), Mouse factor =    1, SP =     97:   159, Invert = off, ReportId = 
  Axis 01    RZ : Slope 8 =    1 (mul), Slope 16 =  257 (mul), Mouse factor =    1, SP =     97:   159, Invert = off, ReportId = 
  Axis 02     X : Slope 8 =  257 (div), Slope 16 =    1 (mul), Mouse factor =    1, SP =  -8191:  8191, Invert = off, ReportId = 
  Axis 03     Y : Slope 8 =  257 (div), Slope 16 =    1 (mul), Mouse factor =    1, SP =  -8191:  8191, Invert =  on, ReportId = 
  Axis 04    RX : Slope 8 =  257 (div), Slope 16 =    1 (mul), Mouse factor =    1, SP =  -8191:  8191, Invert = off, ReportId = 
  Axis 05    RY : Slope 8 =  257 (div), Slope 16 =    1 (mul), Mouse factor =    1, SP =  -8191:  8191, Invert =  on, ReportId = 
  Axis 06 DPADX : Slope 8 =    1 (mul), Slope 16 =    1 (mul), Mouse factor =    1, SP =      0:     0, Invert = off, ReportId = 
  Axis 07 DPADY : Slope 8 =    1 (mul), Slope 16 =    1 (mul), Mouse factor =    1, SP =      0:     0, Invert = off, ReportId = 
  Button ReportIds : 00=0 01=0 02=0 03=0 04=0 05=0 06=0 07=0 08=0 09=0 10=0
USBJoystick_Debug output for slot 1 for comparison (no controller on this slot):

Code: Select all

Joystick slot 1 ( - Xbox 360 Wireless Receiver for Windows)
  Path                    : devices#interface=2;endpoint=3;nopad;noblock:USB5
  File handle             : 250
  Data stream open        : Yes
  Local USB device name   : USB5
  Interface               : 2
  Endpoint                : 3
  Device manufacturer     : 
  Device product name     : Xbox 360 Wireless Receiver for Windows
  Device serial number    : FD8EAC00
  Driver                  : XBOX360 wireless controller
  Output transport        : None
  Capabilities            : None
  Report descriptor       : Baked in
  Report id               : None
  Report data offset      : 4
  Data validator          : Yes
  Start-up routine        : No
  Auto-flipped axis types : 2
  USB vendor id           : 0x045e
  USB product id          : 0x0719
  USB device id           : 0x0100
  Buffer handle           : 259
  Buffer internal id      : 264
  Buffer service routine  : 0xfc1e9fb4
  Buffer workspace        : 0x20003eb4
  DeviceFS handle         : 0x203670f4
  Report data length      : 20
  Upcalls                 : 0 (delta: 0)
  Good reads              : 0 (delta: 0)
  Bad reads               : 0 (delta: 0)
  Raw report data         : 20 00 00 00 44 00 38 00 45 00 41 00 43 00 30 00 30 00 66 00 
  Number of axes          : 8
  Number of buttons       : 11
  HAT switch              : No
  DPAD                    : Yes
  Axes:
  Axis 00     Z : Slope 8 =    1 (mul), Slope 16 =  257 (mul), Mouse factor =    1, SP =     97:   159, Invert = off, ReportId = 
  Axis 01    RZ : Slope 8 =    1 (mul), Slope 16 =  257 (mul), Mouse factor =    1, SP =     97:   159, Invert = off, ReportId = 
  Axis 02     X : Slope 8 =  257 (div), Slope 16 =    1 (mul), Mouse factor =    1, SP =  -8191:  8191, Invert = off, ReportId = 
  Axis 03     Y : Slope 8 =  257 (div), Slope 16 =    1 (mul), Mouse factor =    1, SP =  -8191:  8191, Invert =  on, ReportId = 
  Axis 04    RX : Slope 8 =  257 (div), Slope 16 =    1 (mul), Mouse factor =    1, SP =  -8191:  8191, Invert = off, ReportId = 
  Axis 05    RY : Slope 8 =  257 (div), Slope 16 =    1 (mul), Mouse factor =    1, SP =  -8191:  8191, Invert =  on, ReportId = 
  Axis 06 DPADX : Slope 8 =    1 (mul), Slope 16 =    1 (mul), Mouse factor =    1, SP =      0:     0, Invert = off, ReportId = 
  Axis 07 DPADY : Slope 8 =    1 (mul), Slope 16 =    1 (mul), Mouse factor =    1, SP =      0:     0, Invert = off, ReportId = 
  Button ReportIds : 00=0 01=0 02=0 03=0 04=0 05=0 06=0 07=0 08=0 09=0 10=0
For the lights, this did nothing:

Code: Select all

*USBJoystick_SendOut <slot> 01 03 06
But this worked without the command above. I confirmed 6/7/8 fixed the light on 1/2/3:

Code: Select all

*USBJoystick_SendOut <slot> 00 00 08 46 00 00 00 00 00 00 00 00
richw
Posts: 182
Joined: Sat Sep 14, 2013

Re: Rumble and wireless assistance

Post by richw »

Great, thanks Jon. Can you try this one? (test 4)

Check the *USBJoystick_List again and see if it says 'Rumble' against capabilities?

Does it show 'Microsoft' somewhere in the heading? If you do *USBDevInfo <n> (check with *USBDevices) what does the manufacturer say there?

If you do *USBJoystick_Read for slots 0-3, does it respond to button presses?

Does this produce a rumble?

Code: Select all

*USBJoystick_Rumble <slot> 65535 0 800
*USBJoystick_Rumble <slot> 0 65535 800
Can you tell which motor, and how strong?

Code: Select all

*USBJoystick_Rumble <slot> 0 0
should stop it.

I'm after seeing any packets which tell us when a pad connects, and the battery level. With Reporter open, do you see any 'pktlog' lines? If so, it would be nice to know what is captured when you do, say:

1. switch the pad off, wait for 10 seconds, then switch on again
2. leave pad alone for 1 minute
3. press and hold the Guide button briefly

Inbetween each, *USBJoystick_Debug <slot> should show useful 'recent packets' and 'non-input packets seen'. Would be interesting to see what happens as the battery life lowers, but I appreciate it's all tricky. I probably need to get one of these controllers myself, as my clone doesn't cut it!

Does the previous LED command

Code: Select all

*USBJoystick_SendOut <slot> 00 00 08 46 00 00 00 00 00 00 00 00
still steady the ring light? Does the battery last longer than when it was flashing?

Honestly, any info would be useful. I appreciate that this is all very faffy. You'd think the local CeX would have loads of these second-hand and cheap, but no!
Attachments
usbjtest4.zip
(39.48 KiB) Downloaded 1 time
Post Reply