Page 1 of 2

USBJoystick 0.13

Posted: Tue Nov 06, 2018 9:39 pm
by richw
USBJoystick is a USB joystick driver for RISC OS 5. It supports USB HID-compliant joystick (or gamepad, or steering wheel etc.), including the XBOX 360 wired and wireless controllers. It provides the legacy Acorn, RTFM and SerialPort SWI interfaces, so existing games can be used with modern controllers.


What’s new?
  • I have improved the I/O podule ADC emulation so that ranges can be specified. This allows, for example, a single axis to be used as an accelerator and brake in Saloon Cars Deluxe. It may also allow for an effective deadzone to be specified, but I have not had a chance to try this.
  • The format of the ADC mapping *commands have changed. See the 'MapSCD' file in the src.utils directory for an example.
  • I have also had to re-introduce a couple of floats in the scaling. However, they are not in any SWI handlers, so there should be no regression to the abort situation.

Download

Version 0.13 is attached to this post.

A slightly earlier version is on GitHub for convenient browsing. I intend to sort this out properly at some point, so it can become the master repository. I will keep an eye out on how ROOL and others use Git. Link here: https://github.com/riscos-richard/USBJoystick


Requirements

You need a RISC OS 5 machine with USB hardware. I have only tried a Pi model B+. In theory, any USB HID-compliant joystick will work, but again, I have only tried what I have:
For any *commands, it is particularly useful if you have the LineEditor module installed. If you don’t have this, I would recommend you get it and stick it in your Boot PreDesk directory. You’ll wonder how you ever lived without it! You can grab the module from here: https://github.com/jaylett/zap/blob/61a ... itor%2Cffa

Please make sure you don’t have any unsaved data before trying this module!

SparkFS (or similar) will be needed to open the attached zip file.


Starting

The zip file contains a single RISC OS module, USBJoystick. Just double-click it. The 'src' directory may interest you if you have the ROOL DDE.

Aso in the 'src' directory is a 'utils' directory, which contains a couple of BASIC test applications:
  • ADCTest: tests the I/O module ADC OSByte interface)
  • AcornTest: tests the Acorn 8-bit and 16-bit Joystick_Read SWI
  • RTFMTest: tests the RTFM interface - this is not currently usable
  • SerPortTest: tests the Serial Port (Vertical Twist) Joystick_Status SWI
You can use these from within a Task Window or by double-clicking from the Desktop. They will allow you to verify your joystick configuration without going to the trouble of loading a game.


Joystick discovery/enumeration

Open a Task Window (CTRL-F12) and type '*USBJoystick_List’. You should see some information on whatever joystick(s) you have plugged in. Each joystick is given an id number, starting from zero.

If you don’t see your joystick, then USBJoystick has not been able to detect it (can you see it if you use the OS command, '*USBDevices’?).


Enumeration

Joysticks will be discovered when the module starts. If you connect a joystick later on, it should be automatically detected (without restarting the module). Similarly, if you remove a joystick, the module will stop talking to it.


Mapping

The classic Acorn and Serial Port Joystick APIs refer to joysticks by a joystick number (0 or 1, for player 1 and 2 respectively). Note that the RTFM and Serial Port APIs only support one or two joysticks, but the Acorn API can support many more.

Each joystick number can offer two directional axes, typically up/down (Y) and left/right (X). A modern USB joystick will have multiple analogue axes (X, Y, Z, RX, RY, RZ) and separate digital inputs (DPAD or HAT switches). The desired USB axes need to be 'mapped' to the legacy number, X axis and Y axis.

As of version 0.07, you can map up to 8 buttons, but these will only work independently with the Acorn Joystick APIs. Games using the Serial Port or RTFM API will see a 'fire' when any of the buttons are pressed.

You can see the mapping with *USBJoystick_Mapped.


Automatic mapping

As of version 0.08, USBJoystick tries to automatically map the USB stick, axes and buttons across to the legacy items. The stick numbers will be assigned based on the order the USB devices are identified. If your joystick has a DPAD or HAT switch they will be mapped to the Serial Port, RTFM and Acorn 8-bit X and Y axes. If you have analogue X and Y axes, they will be mapped to the Acorn 16-bit X and Y axes. The buttons will be mapped in their order they the controller reports them - usually the first one reported is the primary.


Manual mapping

If the automatic mapping is not to your satisfaction, it can be adjusted with a number of *commands: *USBJoystick_MapStick, *USBJoystick_MapAxes8, *USBJoystick_MapAxes16 and *USBJoystick_MapButtons. Use the help to discover the exact syntax, e.g. *Help USBJoystick_MapStick will show you how to use the stick mapping feature.

You need to test your joystick to determine which axes and button you want to use. Type 'USBJoystick_Read 0' (or whatever joystick id you want). You should see some raw data showing the state of each axis and button. If you don’t touch the joystick, they will all be at their rest positions. Move the joystick up, and whilst holding that position, enter the read command again. Compare the two read outputs: you should be able to spot the value changing on one of the axes. This will be the Y-axis. Make a note of the axis number.

Repeat the above for identifying the X-axis, and each button. At the end of the process, you should know for each joystick id, the x and y axes numbers, and the primary button number. To map these up to the old Acorn/SerialPort API, you need to use the commands mentioned at the beginning of this section.

If any of your axes are working the wrong way around (e.g. up is down and down is up) then you can use the *USBJoystick_Flip command to invert the direction.

Please note that the mapping is not saved anywhere - it is just remembered in RAM. If you unplug the joystick, kill the USBJoystick module, or reboot your machine, the mapping will be lost. Once you have it figured out, you may wish to create an obey file which will set it up again for you.


Acorn I/O Podule Analogue to Digital converter

USBJoystick can emulate the ADC converter found on the I/O podule. It hooks into OSByte 128, so software using this SWI (including BASIC’s ADVAL function) will work. You can map an axis, or part of an axis, to an ADC channel, and a pair of buttons for fire. Please investigate the *command help: there is some mapping required.

The partial mapping is useful for configurations like a single Y axis (0 for middle, +32768 for top, and -32767 for bottom), where you want to map ADC Channel 0 to ‘up’ (so 0 to 32768 will be translated to 0 to 65520) and Channel 1 to ‘down’ (so 0 to -32767 will be translated to 0 to 65520).


Using the Joystick

Once you have mapped, you can use any software which supports the Acorn (SWI Joystick_Read) or Serial Port (SWI Joystick_Status). The USB Joystick driver module will transform the USB data into a format for those SWIs, and respond to their requests. With the help of ADFFS, games which use the RTFM API should also function.

I have tried some of the games from this web site: James Pond and SWIV work over the Serial Port SWI, and Zool works over the Acorn SWI.


Testing

Obviously, this thing is far from finished. It clearly needs more testing: one machine, two USB joysticks, and three games doesn’t really cut it! :)

All feedback is welcome.


Technical matters

If you have any problems with the module, it would be helpful if you could run Reporter before you run the module. If Reporter is active, some debugging guff will appear in Reporter’s log. This may help me! Reporter is available here: http://www.avisoft.f9.co.uk/Reporter.htm

The *command *USBJoystick_Debug 0 (replacing 0 for your joystick id, or removing it entirely to see all) may also provide useful information for me.

The output from Colin Granville's USBDescriptors output may be useful.


Acknowledgements

Jon’s efforts with JASPP itself was my inspiration for developing this (obviously, this is tiny effort in comparison!). Also, many thanks to the following people over on the ROOL forums who offered advice and put up with my silly questions: Jeffrey Lee, Rick Murray, Stuart Swales, Colin Granville, Simon Birtwhistle, and Chris Mahoney. Thanks to James Peacock for EtherUSB, and Colin Granville for USBDescriptors. The code uses components from NetBSD and XMAME. There are further notes in the source code.


Todo: Refactoring
  • Remove floats so we don’t need FPA DONE IN 0.12
  • Listen for service calls from USBDriver Starting/Dying
  • Do we really need joy_index to be a global?
  • Implement releasing of memory in clean_joystick_data_item() DONE IN 0.10
  • Determine correct error-handling strategy for module_finalise()

Todo: Features
  • Support multiple buttons in the mapping DONE IN 0.07
  • Support SerialPort 'stir', 'flag A' and 'flag B' - extra buttons/mappings?
  • Decide if we need ability to reverse an axis in the mapping DONE IN 0.08
  • Emulate 16-bit Acorn Joystick_Read response DONE IN 0.7
  • Emulate RTFM joystick API (based on Econet hardware peeks) DONE IN 0.06 (with ADFFS)
  • Emulate Acorn I/O podule API (ADVAL and associated OSBYTEs) DONE IN 0.12
  • Save settings into Choices$Write and read back on init
  • Load settings via USB alias system (used by !Printers). Would it be useful?
  • Consider auto-assigning legacy joystick numbers as devices are discovered DONE IN 0.07
  • Allow Joystick actions to be mapped to keypresses or mouse moves
  • Formalise an SWI interface for device enumeration and configuration. This would allow a Configure plug-in to be developed.

Re: USBJoystick 0.13

Posted: Wed Jan 23, 2019 9:17 pm
by JonAbbott
There's a few games that are known to not work with this version:
  • Jahangir Khan World Championship Squash (fixed in next version)
  • Hero Quest (fixed in next version)
  • Mad Professor Mariarti (fixed in next version)
  • Pacmania [Learning Curve version] (fixed in next version)
  • Populous (fixed in next version)
  • S.W.I.V. (press F1 and switch it to Keyboard if no Joystick is attached)

Re: USBJoystick 0.13

Posted: Wed Nov 11, 2020 11:42 pm
by Vanfanel
Hi, Jon!

Since USBJoystick seems to be part of ADFFS now, I don't know if this is the right place to ask, but well, let me know if it's not :)

I have this SN30 Pro gamepad that connects via USB only. It has no wireless capabilities, and it identifies itself as an XBOX360 gamepad in GNU/Linux.
However, on Risc OS, when I have it connected, if I load ADFFS I get "Internal error, abort on instruction fetch at &00000000".
So, since it's somehow an X360 pad, an pretty much popular, isn't it supported by ADFFS/USBJoystick?
Loading USBJoystick alone causes the same problem: it's not an ADFFS problem I guess, but an USBJoystick problem.

Re: USBJoystick 0.13

Posted: Sun Nov 15, 2020 11:05 am
by richw
Can you run the USBDescriptors program and share the output?

And if you run Reporter, then run USBJoystick, can you share the output too?

Re: USBJoystick 0.13

Posted: Mon Nov 16, 2020 4:29 am
by Vanfanel
@richw: Of course! Here they are:

Code: Select all

USBDescriptors v1.06 (29-Mar-2018)

Computer
  |
  +-1.USB1: , Synopsys DWC OTG root hub
  |
  +-2.USB2: VIA, XHCI root hub
      |
      +-1.USB3: USB2.0 Hub
          |
          +-3.USB9: Controller, Controller
          |
          +-4.USB4: Logitech, USB Receiver

=============================================
 Device USB1
=============================================
:  0 :  2 : total size of ServiceCall block : 77
:  2 :  2 : offset to descriptor list       : 0x20
:  4 : 20 : name                            : USB1
: 24 :  1 : bus number                      : 1
: 25 :  1 : device address                  : 1
: 26 :  1 : host address                    : 0
: 27 :  1 : host port                       : 0
: 28 :  1 : speed                           : 3 high speed
---------------------------------------------

 Standard Device Descriptor
+----+----+---------------------------+----------+------------+
:Off :Sz  :Name                       :Value hex :Value dec   :
+----+----+---------------------------+----------+------------+
:  0 :  1 : bLength                   :       12 :         18 :
:  1 :  1 : bDescriptorType           :        1 :          1 :
:  2 :  2 : bcdUSB                    :      200 :        512 :
:  4 :  1 : bDeviceClass              :        9 :          9 : Hub
:  5 :  1 : bDeviceSubClass           :        0 :          0 :
:  6 :  1 : bDeviceProtocol           :        1 :          1 :
:  7 :  1 : bMaxPacketSize            :       40 :         64 :
:  8 :  2 : idVendor                  :        0 :          0 :
: 10 :  2 : idProduct                 :        0 :          0 :
: 12 :  2 : bcdDevice                 :      100 :        256 :
: 14 :  1 : iManufacturer             :        1 :          1 : ''
: 15 :  1 : iProduct                  :        2 :          2 : 'Synopsys DWC OTG root hub'
: 16 :  1 : iSerialNumber             :        0 :          0 : ''
: 17 :  1 : bNumConfigurations        :        1 :          1 :
+----+----+---------------------------+----------+------------+

 Standard Configuration Descriptor
+----+----+---------------------------+----------+------------+
:Off :Sz  :Name                       :Value hex :Value dec   :
+----+----+---------------------------+----------+------------+
:  0 :  1 : bLength                   :        9 :          9 :
:  1 :  1 : bDescriptorType           :        2 :          2 :
:  2 :  2 : wTotalLength              :       19 :         25 :
:  4 :  1 : bNumInterfaces            :        1 :          1 :
:  5 :  1 : bConfigurationValue       :        1 :          1 :
:  6 :  1 : iConfiguration            :        0 :          0 : ''
:  7 :  1 : bmAttributes              :       40 :         64 : (bit6) Self powered, (bit5) No remote wakeup
:  8 :  1 : bMaxPower                 :        0 :          0 : 0mA
+----+----+---------------------------+----------+------------+

     Standard Interface Descriptor
    +----+----+---------------------------+----------+------------+
    :Off :Sz  :Name                       :Value hex :Value dec   :
    +----+----+---------------------------+----------+------------+
    :  0 :  1 : bLength                   :        9 :          9 :
    :  1 :  1 : bDescriptorType           :        4 :          4 :
    :  2 :  1 : bInterfaceNumber          :        0 :          0 :
    :  3 :  1 : bAlternateSetting         :        0 :          0 :
    :  4 :  1 : bNumEndpoints             :        1 :          1 :
    :  5 :  1 : bInterfaceClass           :        9 :          9 : Hub
    :  6 :  1 : bInterfaceSubClass        :        0 :          0 :
    :  7 :  1 : bInterfaceProtocol        :        0 :          0 :
    :  8 :  1 : iInterface                :        0 :          0 : ''
    +----+----+---------------------------+----------+------------+

         Standard Endpoint Descriptor
        +----+----+---------------------------+----------+------------+
        :Off :Sz  :Name                       :Value hex :Value dec   :
        +----+----+---------------------------+----------+------------+
        :  0 :  1 : bLength                   :        7 :          7 :
        :  1 :  1 : bDescriptorType           :        5 :          5 :
        :  2 :  1 : bEndpointAddress          :       81 :        129 : Endpoint 1 - IN
        :  3 :  1 : bmAttributes              :        3 :          3 : Interrupt
        :  4 :  2 : wMaxPacketSize            :        8 :          8 : 1 x 8 byte max packets
        :  6 :  1 : bInterval                 :        c :         12 :
        +----+----+---------------------------+----------+------------+

=============================================
 Device USB2
=============================================
:  0 :  2 : total size of ServiceCall block : 77
:  2 :  2 : offset to descriptor list       : 0x20
:  4 : 20 : name                            : USB2
: 24 :  1 : bus number                      : 2
: 25 :  1 : device address                  : 0
: 26 :  1 : host address                    : 0
: 27 :  1 : host port                       : 0
: 28 :  1 : speed                           : 3 high speed
---------------------------------------------

 Standard Device Descriptor
+----+----+---------------------------+----------+------------+
:Off :Sz  :Name                       :Value hex :Value dec   :
+----+----+---------------------------+----------+------------+
:  0 :  1 : bLength                   :       12 :         18 :
:  1 :  1 : bDescriptorType           :        1 :          1 :
:  2 :  2 : bcdUSB                    :      200 :        512 :
:  4 :  1 : bDeviceClass              :        9 :          9 : Hub
:  5 :  1 : bDeviceSubClass           :        0 :          0 :
:  6 :  1 : bDeviceProtocol           :        1 :          1 :
:  7 :  1 : bMaxPacketSize            :       40 :         64 :
:  8 :  2 : idVendor                  :        0 :          0 :
: 10 :  2 : idProduct                 :        0 :          0 :
: 12 :  2 : bcdDevice                 :      100 :        256 :
: 14 :  1 : iManufacturer             :        1 :          1 : 'VIA'
: 15 :  1 : iProduct                  :        2 :          2 : 'XHCI root hub'
: 16 :  1 : iSerialNumber             :        0 :          0 : ''
: 17 :  1 : bNumConfigurations        :        1 :          1 :
+----+----+---------------------------+----------+------------+

 Standard Configuration Descriptor
+----+----+---------------------------+----------+------------+
:Off :Sz  :Name                       :Value hex :Value dec   :
+----+----+---------------------------+----------+------------+
:  0 :  1 : bLength                   :        9 :          9 :
:  1 :  1 : bDescriptorType           :        2 :          2 :
:  2 :  2 : wTotalLength              :       19 :         25 :
:  4 :  1 : bNumInterfaces            :        1 :          1 :
:  5 :  1 : bConfigurationValue       :        1 :          1 :
:  6 :  1 : iConfiguration            :        0 :          0 : ''
:  7 :  1 : bmAttributes              :       c0 :        192 : (bit7) USB 1.0 bus powered (bit6) Self powered, (bit5) No remote wakeup
:  8 :  1 : bMaxPower                 :        0 :          0 : 0mA
+----+----+---------------------------+----------+------------+

     Standard Interface Descriptor
    +----+----+---------------------------+----------+------------+
    :Off :Sz  :Name                       :Value hex :Value dec   :
    +----+----+---------------------------+----------+------------+
    :  0 :  1 : bLength                   :        9 :          9 :
    :  1 :  1 : bDescriptorType           :        4 :          4 :
    :  2 :  1 : bInterfaceNumber          :        0 :          0 :
    :  3 :  1 : bAlternateSetting         :        0 :          0 :
    :  4 :  1 : bNumEndpoints             :        1 :          1 :
    :  5 :  1 : bInterfaceClass           :        9 :          9 : Hub
    :  6 :  1 : bInterfaceSubClass        :        0 :          0 :
    :  7 :  1 : bInterfaceProtocol        :        0 :          0 :
    :  8 :  1 : iInterface                :        0 :          0 : ''
    +----+----+---------------------------+----------+------------+

         Standard Endpoint Descriptor
        +----+----+---------------------------+----------+------------+
        :Off :Sz  :Name                       :Value hex :Value dec   :
        +----+----+---------------------------+----------+------------+
        :  0 :  1 : bLength                   :        7 :          7 :
        :  1 :  1 : bDescriptorType           :        5 :          5 :
        :  2 :  1 : bEndpointAddress          :       81 :        129 : Endpoint 1 - IN
        :  3 :  1 : bmAttributes              :        3 :          3 : Interrupt
        :  4 :  2 : wMaxPacketSize            :        8 :          8 : 1 x 8 byte max packets
        :  6 :  1 : bInterval                 :        c :         12 :
        +----+----+---------------------------+----------+------------+

=============================================
 Device USB3
=============================================
:  0 :  2 : total size of ServiceCall block : 77
:  2 :  2 : offset to descriptor list       : 0x20
:  4 : 20 : name                            : USB3
: 24 :  1 : bus number                      : 2
: 25 :  1 : device address                  : 1
: 26 :  1 : host address                    : 0
: 27 :  1 : host port                       : 1
: 28 :  1 : speed                           : 3 high speed
---------------------------------------------

 Standard Device Descriptor
+----+----+---------------------------+----------+------------+
:Off :Sz  :Name                       :Value hex :Value dec   :
+----+----+---------------------------+----------+------------+
:  0 :  1 : bLength                   :       12 :         18 :
:  1 :  1 : bDescriptorType           :        1 :          1 :
:  2 :  2 : bcdUSB                    :      210 :        528 :
:  4 :  1 : bDeviceClass              :        9 :          9 : Hub
:  5 :  1 : bDeviceSubClass           :        0 :          0 :
:  6 :  1 : bDeviceProtocol           :        1 :          1 :
:  7 :  1 : bMaxPacketSize            :       40 :         64 :
:  8 :  2 : idVendor                  :     2109 :       8457 :
: 10 :  2 : idProduct                 :     3431 :      13361 :
: 12 :  2 : bcdDevice                 :      421 :       1057 :
: 14 :  1 : iManufacturer             :        0 :          0 : ''
: 15 :  1 : iProduct                  :        1 :          1 : 'USB2.0 Hub'
: 16 :  1 : iSerialNumber             :        0 :          0 : ''
: 17 :  1 : bNumConfigurations        :        1 :          1 :
+----+----+---------------------------+----------+------------+

 Standard Configuration Descriptor
+----+----+---------------------------+----------+------------+
:Off :Sz  :Name                       :Value hex :Value dec   :
+----+----+---------------------------+----------+------------+
:  0 :  1 : bLength                   :        9 :          9 :
:  1 :  1 : bDescriptorType           :        2 :          2 :
:  2 :  2 : wTotalLength              :       19 :         25 :
:  4 :  1 : bNumInterfaces            :        1 :          1 :
:  5 :  1 : bConfigurationValue       :        1 :          1 :
:  6 :  1 : iConfiguration            :        0 :          0 : ''
:  7 :  1 : bmAttributes              :       e0 :        224 : (bit7) USB 1.0 bus powered (bit6) Self powered, (bit5) Remote wakeup
:  8 :  1 : bMaxPower                 :       32 :         50 : 100mA
+----+----+---------------------------+----------+------------+

     Standard Interface Descriptor
    +----+----+---------------------------+----------+------------+
    :Off :Sz  :Name                       :Value hex :Value dec   :
    +----+----+---------------------------+----------+------------+
    :  0 :  1 : bLength                   :        9 :          9 :
    :  1 :  1 : bDescriptorType           :        4 :          4 :
    :  2 :  1 : bInterfaceNumber          :        0 :          0 :
    :  3 :  1 : bAlternateSetting         :        0 :          0 :
    :  4 :  1 : bNumEndpoints             :        1 :          1 :
    :  5 :  1 : bInterfaceClass           :        9 :          9 : Hub
    :  6 :  1 : bInterfaceSubClass        :        0 :          0 :
    :  7 :  1 : bInterfaceProtocol        :        0 :          0 :
    :  8 :  1 : iInterface                :        0 :          0 : ''
    +----+----+---------------------------+----------+------------+

         Standard Endpoint Descriptor
        +----+----+---------------------------+----------+------------+
        :Off :Sz  :Name                       :Value hex :Value dec   :
        +----+----+---------------------------+----------+------------+
        :  0 :  1 : bLength                   :        7 :          7 :
        :  1 :  1 : bDescriptorType           :        5 :          5 :
        :  2 :  1 : bEndpointAddress          :       81 :        129 : Endpoint 1 - IN
        :  3 :  1 : bmAttributes              :        3 :          3 : Interrupt
        :  4 :  2 : wMaxPacketSize            :        1 :          1 : 1 x 1 byte max packets
        :  6 :  1 : bInterval                 :        c :         12 :
        +----+----+---------------------------+----------+------------+

=============================================
 Device USB4
=============================================
:  0 :  2 : total size of ServiceCall block : 111
:  2 :  2 : offset to descriptor list       : 0x20
:  4 : 20 : name                            : USB4
: 24 :  1 : bus number                      : 2
: 25 :  1 : device address                  : 2
: 26 :  1 : host address                    : 1
: 27 :  1 : host port                       : 4
: 28 :  1 : speed                           : 2 full speed
---------------------------------------------

 Standard Device Descriptor
+----+----+---------------------------+----------+------------+
:Off :Sz  :Name                       :Value hex :Value dec   :
+----+----+---------------------------+----------+------------+
:  0 :  1 : bLength                   :       12 :         18 :
:  1 :  1 : bDescriptorType           :        1 :          1 :
:  2 :  2 : bcdUSB                    :      200 :        512 :
:  4 :  1 : bDeviceClass              :        0 :          0 :
:  5 :  1 : bDeviceSubClass           :        0 :          0 :
:  6 :  1 : bDeviceProtocol           :        0 :          0 :
:  7 :  1 : bMaxPacketSize            :        8 :          8 :
:  8 :  2 : idVendor                  :      46d :       1133 :
: 10 :  2 : idProduct                 :     c534 :      50484 :
: 12 :  2 : bcdDevice                 :     2900 :      10496 :
: 14 :  1 : iManufacturer             :        1 :          1 : 'Logitech'
: 15 :  1 : iProduct                  :        2 :          2 : 'USB Receiver'
: 16 :  1 : iSerialNumber             :        0 :          0 : ''
: 17 :  1 : bNumConfigurations        :        1 :          1 :
+----+----+---------------------------+----------+------------+

 Standard Configuration Descriptor
+----+----+---------------------------+----------+------------+
:Off :Sz  :Name                       :Value hex :Value dec   :
+----+----+---------------------------+----------+------------+
:  0 :  1 : bLength                   :        9 :          9 :
:  1 :  1 : bDescriptorType           :        2 :          2 :
:  2 :  2 : wTotalLength              :       3b :         59 :
:  4 :  1 : bNumInterfaces            :        2 :          2 :
:  5 :  1 : bConfigurationValue       :        1 :          1 :
:  6 :  1 : iConfiguration            :        4 :          4 : 'RQR29.00_B0015'
:  7 :  1 : bmAttributes              :       a0 :        160 : (bit7) USB 1.0 bus powered (bit6) Bus powered, (bit5) Remote wakeup
:  8 :  1 : bMaxPower                 :       31 :         49 : 98mA
+----+----+---------------------------+----------+------------+

     Standard Interface Descriptor
    +----+----+---------------------------+----------+------------+
    :Off :Sz  :Name                       :Value hex :Value dec   :
    +----+----+---------------------------+----------+------------+
    :  0 :  1 : bLength                   :        9 :          9 :
    :  1 :  1 : bDescriptorType           :        4 :          4 :
    :  2 :  1 : bInterfaceNumber          :        0 :          0 :
    :  3 :  1 : bAlternateSetting         :        0 :          0 :
    :  4 :  1 : bNumEndpoints             :        1 :          1 :
    :  5 :  1 : bInterfaceClass           :        3 :          3 : HID
    :  6 :  1 : bInterfaceSubClass        :        1 :          1 : Boot interface
    :  7 :  1 : bInterfaceProtocol        :        1 :          1 : Keyboard
    :  8 :  1 : iInterface                :        0 :          0 : ''
    +----+----+---------------------------+----------+------------+

         HID Device Descriptor
        +----+----+---------------------------+----------+------------+
        :Off :Sz  :Name                       :Value hex :Value dec   :
        +----+----+---------------------------+----------+------------+
        :  0 :  1 : bLength                   :        9 :          9 :
        :  1 :  1 : bDescriptorType           :       21 :         33 :
        :  2 :  2 : bcdHID                    :      111 :        273 :
        :  4 :  1 : bCountryCode              :        0 :          0 :
        :  5 :  1 : bNumDescriptors           :        1 :          1 :
        :  6 :  1 : bReportDescType           :       22 :         34 :
        :  7 :  2 : wReportDescLength         :       3b :         59 :
        +----+----+---------------------------+----------+------------+

         Usage Page (Generic Desktop Controls)         :05 01
         Usage (Keyboard)                              :09 06
         Collection (Application)                      :a1 01
           Usage Page (Keyboard/Keypad)                  :05 07
           Usage Minimum                                 :19 e0
           Usage Maximum                                 :29 e7
           Logical Minimum                               :15 00
           Logical Maximum                               :25 01
           Report Size (1)                               :75 01
           Report Count (8)                              :95 08
           ...Input                                      :81 02
           ...Input                                      :81 03
           Report Count (5)                              :95 05
           Usage Page (LEDs)                             :05 08
           Usage Minimum                                 :19 01
           Usage Maximum                                 :29 05
           ...Output                                     :91 02
           Report Count (1)                              :95 01
           Report Size (3)                               :75 03
           ...Output                                     :91 01
           Report Count (6)                              :95 06
           Report Size (8)                               :75 08
           Logical Minimum                               :15 00
           Logical Maximum                               :26 a4 00
           Usage Page (Keyboard/Keypad)                  :05 07
           Usage Minimum                                 :19 00
           Usage Maximum                                 :2a a4 00
           ...Input                                      :81 00
         End Collection                                :c0

         Standard Endpoint Descriptor
        +----+----+---------------------------+----------+------------+
        :Off :Sz  :Name                       :Value hex :Value dec   :
        +----+----+---------------------------+----------+------------+
        :  0 :  1 : bLength                   :        7 :          7 :
        :  1 :  1 : bDescriptorType           :        5 :          5 :
        :  2 :  1 : bEndpointAddress          :       81 :        129 : Endpoint 1 - IN
        :  3 :  1 : bmAttributes              :        3 :          3 : Interrupt
        :  4 :  2 : wMaxPacketSize            :        8 :          8 : 1 x 8 byte max packets
        :  6 :  1 : bInterval                 :        8 :          8 :
        +----+----+---------------------------+----------+------------+

     Standard Interface Descriptor
    +----+----+---------------------------+----------+------------+
    :Off :Sz  :Name                       :Value hex :Value dec   :
    +----+----+---------------------------+----------+------------+
    :  0 :  1 : bLength                   :        9 :          9 :
    :  1 :  1 : bDescriptorType           :        4 :          4 :
    :  2 :  1 : bInterfaceNumber          :        1 :          1 :
    :  3 :  1 : bAlternateSetting         :        0 :          0 :
    :  4 :  1 : bNumEndpoints             :        1 :          1 :
    :  5 :  1 : bInterfaceClass           :        3 :          3 : HID
    :  6 :  1 : bInterfaceSubClass        :        1 :          1 : Boot interface
    :  7 :  1 : bInterfaceProtocol        :        2 :          2 : Mouse
    :  8 :  1 : iInterface                :        0 :          0 : ''
    +----+----+---------------------------+----------+------------+

         HID Device Descriptor
        +----+----+---------------------------+----------+------------+
        :Off :Sz  :Name                       :Value hex :Value dec   :
        +----+----+---------------------------+----------+------------+
        :  0 :  1 : bLength                   :        9 :          9 :
        :  1 :  1 : bDescriptorType           :       21 :         33 :
        :  2 :  2 : bcdHID                    :      111 :        273 :
        :  4 :  1 : bCountryCode              :        0 :          0 :
        :  5 :  1 : bNumDescriptors           :        1 :          1 :
        :  6 :  1 : bReportDescType           :       22 :         34 :
        :  7 :  2 : wReportDescLength         :       b1 :        177 :
        +----+----+---------------------------+----------+------------+

         Usage Page (Generic Desktop Controls)         :05 01
         Usage (Mouse)                                 :09 02
         Collection (Application)                      :a1 01
           Report ID (2)                                 :85 02
           Usage (Pointer)                               :09 01
           Collection (Physical)                         :a1 00
             Usage Page (Button)                           :05 09
             Usage Minimum                                 :19 01
             Usage Maximum                                 :29 10
             Logical Minimum                               :15 00
             Logical Maximum                               :25 01
             Report Count (16)                             :95 10
             Report Size (1)                               :75 01
             ...Input                                      :81 02
             Usage Page (Generic Desktop Controls)         :05 01
             Logical Minimum                               :16 01 f8
             Logical Maximum                               :26 ff 07
             Report Size (12)                              :75 0c
             Report Count (2)                              :95 02
             Usage (X)                                     :09 30
             Usage (Y)                                     :09 31
             ...Input                                      :81 06
             Logical Minimum                               :15 81
             Logical Maximum                               :25 7f
             Report Size (8)                               :75 08
             Report Count (1)                              :95 01
             Usage (Wheel)                                 :09 38
             ...Input                                      :81 06
             Usage Page (Consumer)                         :05 0c
             Usage (Reserved)                              :0a 38 02
             Report Count (1)                              :95 01
             ...Input                                      :81 06
           End Collection                                :c0
         End Collection                                :c0
         Usage Page (Consumer)                         :05 0c
         Usage (Consumer Control)                      :09 01
         Collection (Application)                      :a1 01
           Report ID (3)                                 :85 03
           Report Size (16)                              :75 10
           Report Count (2)                              :95 02
           Logical Minimum                               :15 01
           Logical Maximum                               :26 8c 02
           Usage Minimum                                 :19 01
           Usage Maximum                                 :2a 8c 02
           ...Input                                      :81 00
         End Collection                                :c0
         Usage Page (Generic Desktop Controls)         :05 01
         Usage (System Control)                        :09 80
         Collection (Application)                      :a1 01
           Report ID (4)                                 :85 04
           Report Size (2)                               :75 02
           Report Count (1)                              :95 01
           Logical Minimum                               :15 01
           Logical Maximum                               :25 03
           Usage (System Sleep)                          :09 82
           Usage (System Power Down)                     :09 81
           Usage (System Wakeup)                         :09 83
           ...Input                                      :81 60
           Report Size (6)                               :75 06
           ...Input                                      :81 03
         End Collection                                :c0
         Usage Page (Vendor Defined)                   :06 00 ff
         Usage ()                                      :09 01
         Collection (Application)                      :a1 01
           Report ID (16)                                :85 10
           Report Size (8)                               :75 08
           Report Count (6)                              :95 06
           Logical Minimum                               :15 00
           Logical Maximum                               :26 ff 00
           Usage ()                                      :09 01
           ...Input                                      :81 00
           Usage ()                                      :09 01
           ...Output                                     :91 00
         End Collection                                :c0
         Usage Page (Vendor Defined)                   :06 00 ff
         Usage ()                                      :09 02
         Collection (Application)                      :a1 01
           Report ID (17)                                :85 11
           Report Size (8)                               :75 08
           Report Count (19)                             :95 13
           Logical Minimum                               :15 00
           Logical Maximum                               :26 ff 00
           Usage ()                                      :09 02
           ...Input                                      :81 00
           Usage ()                                      :09 02
           ...Output                                     :91 00
         End Collection                                :c0

         Standard Endpoint Descriptor
        +----+----+---------------------------+----------+------------+
        :Off :Sz  :Name                       :Value hex :Value dec   :
        +----+----+---------------------------+----------+------------+
        :  0 :  1 : bLength                   :        7 :          7 :
        :  1 :  1 : bDescriptorType           :        5 :          5 :
        :  2 :  1 : bEndpointAddress          :       82 :        130 : Endpoint 2 - IN
        :  3 :  1 : bmAttributes              :        3 :          3 : Interrupt
        :  4 :  2 : wMaxPacketSize            :       14 :         20 : 1 x 20 byte max packets
        :  6 :  1 : bInterval                 :        2 :          2 :
        +----+----+---------------------------+----------+------------+

=============================================
 Device USB9
=============================================
:  0 :  2 : total size of ServiceCall block : 191
:  2 :  2 : offset to descriptor list       : 0x20
:  4 : 20 : name                            : USB9
: 24 :  1 : bus number                      : 2
: 25 :  1 : device address                  : 3
: 26 :  1 : host address                    : 1
: 27 :  1 : host port                       : 3
: 28 :  1 : speed                           : 2 full speed
---------------------------------------------

 Standard Device Descriptor
+----+----+---------------------------+----------+------------+
:Off :Sz  :Name                       :Value hex :Value dec   :
+----+----+---------------------------+----------+------------+
:  0 :  1 : bLength                   :       12 :         18 :
:  1 :  1 : bDescriptorType           :        1 :          1 :
:  2 :  2 : bcdUSB                    :      200 :        512 :
:  4 :  1 : bDeviceClass              :       ff :        255 : Vendor Specific
:  5 :  1 : bDeviceSubClass           :       ff :        255 :
:  6 :  1 : bDeviceProtocol           :       ff :        255 :
:  7 :  1 : bMaxPacketSize            :       40 :         64 :
:  8 :  2 : idVendor                  :      45e :       1118 :
: 10 :  2 : idProduct                 :      28e :        654 :
: 12 :  2 : bcdDevice                 :      114 :        276 :
: 14 :  1 : iManufacturer             :        1 :          1 : 'Controller'
: 15 :  1 : iProduct                  :        2 :          2 : 'Controller'
: 16 :  1 : iSerialNumber             :        3 :          3 : 'Controller'
: 17 :  1 : bNumConfigurations        :        1 :          1 :
+----+----+---------------------------+----------+------------+

 Standard Configuration Descriptor
+----+----+---------------------------+----------+------------+
:Off :Sz  :Name                       :Value hex :Value dec   :
+----+----+---------------------------+----------+------------+
:  0 :  1 : bLength                   :        9 :          9 :
:  1 :  1 : bDescriptorType           :        2 :          2 :
:  2 :  2 : wTotalLength              :       8b :        139 :
:  4 :  1 : bNumInterfaces            :        4 :          4 :
:  5 :  1 : bConfigurationValue       :        1 :          1 :
:  6 :  1 : iConfiguration            :        0 :          0 : ''
:  7 :  1 : bmAttributes              :       a0 :        160 : (bit7) USB 1.0 bus powered (bit6) Bus powered, (bit5) Remote wakeup
:  8 :  1 : bMaxPower                 :       fa :        250 : 500mA
+----+----+---------------------------+----------+------------+

     Standard Interface Descriptor
    +----+----+---------------------------+----------+------------+
    :Off :Sz  :Name                       :Value hex :Value dec   :
    +----+----+---------------------------+----------+------------+
    :  0 :  1 : bLength                   :        9 :          9 :
    :  1 :  1 : bDescriptorType           :        4 :          4 :
    :  2 :  1 : bInterfaceNumber          :        0 :          0 :
    :  3 :  1 : bAlternateSetting         :        0 :          0 :
    :  4 :  1 : bNumEndpoints             :        2 :          2 :
    :  5 :  1 : bInterfaceClass           :       ff :        255 : Vendor Specific
    :  6 :  1 : bInterfaceSubClass        :       5d :         93 :
    :  7 :  1 : bInterfaceProtocol        :        1 :          1 :
    :  8 :  1 : iInterface                :        0 :          0 : ''
    +----+----+---------------------------+----------+------------+

*** Unknown Descriptor ***
bLength:          17
bDescriptorType:  0x21 (33)
Byte   2:  0x10 (16)
Byte   3:  0x01 (1)
Byte   4:  0x01 (1)
Byte   5:  0x25 (37)
Byte   6:  0x81 (129)
Byte   7:  0x14 (20)
Byte   8:  0x03 (3)
Byte   9:  0x03 (3)
Byte  10:  0x03 (3)
Byte  11:  0x04 (4)
Byte  12:  0x13 (19)
Byte  13:  0x02 (2)
Byte  14:  0x08 (8)
Byte  15:  0x03 (3)
Byte  16:  0x03 (3)

         Standard Endpoint Descriptor
        +----+----+---------------------------+----------+------------+
        :Off :Sz  :Name                       :Value hex :Value dec   :
        +----+----+---------------------------+----------+------------+
        :  0 :  1 : bLength                   :        7 :          7 :
        :  1 :  1 : bDescriptorType           :        5 :          5 :
        :  2 :  1 : bEndpointAddress          :       81 :        129 : Endpoint 1 - IN
        :  3 :  1 : bmAttributes              :        3 :          3 : Interrupt
        :  4 :  2 : wMaxPacketSize            :       20 :         32 : 1 x 32 byte max packets
        :  6 :  1 : bInterval                 :        4 :          4 :
        +----+----+---------------------------+----------+------------+

         Standard Endpoint Descriptor
        +----+----+---------------------------+----------+------------+
        :Off :Sz  :Name                       :Value hex :Value dec   :
        +----+----+---------------------------+----------+------------+
        :  0 :  1 : bLength                   :        7 :          7 :
        :  1 :  1 : bDescriptorType           :        5 :          5 :
        :  2 :  1 : bEndpointAddress          :        2 :          2 : Endpoint 2 - OUT
        :  3 :  1 : bmAttributes              :        3 :          3 : Interrupt
        :  4 :  2 : wMaxPacketSize            :       20 :         32 : 1 x 32 byte max packets
        :  6 :  1 : bInterval                 :        8 :          8 :
        +----+----+---------------------------+----------+------------+

     Standard Interface Descriptor
    +----+----+---------------------------+----------+------------+
    :Off :Sz  :Name                       :Value hex :Value dec   :
    +----+----+---------------------------+----------+------------+
    :  0 :  1 : bLength                   :        9 :          9 :
    :  1 :  1 : bDescriptorType           :        4 :          4 :
    :  2 :  1 : bInterfaceNumber          :        1 :          1 :
    :  3 :  1 : bAlternateSetting         :        0 :          0 :
    :  4 :  1 : bNumEndpoints             :        2 :          2 :
    :  5 :  1 : bInterfaceClass           :       ff :        255 : Vendor Specific
    :  6 :  1 : bInterfaceSubClass        :       5d :         93 :
    :  7 :  1 : bInterfaceProtocol        :        3 :          3 :
    :  8 :  1 : iInterface                :        0 :          0 : ''
    +----+----+---------------------------+----------+------------+

*** Unknown Descriptor ***
bLength:          27
bDescriptorType:  0x21 (33)
Byte   2:  0x00 (0)
Byte   3:  0x01 (1)
Byte   4:  0x01 (1)
Byte   5:  0x01 (1)
Byte   6:  0x83 (131)
Byte   7:  0x40 (64)
Byte   8:  0x01 (1)
Byte   9:  0x04 (4)
Byte  10:  0x20 (32)
Byte  11:  0x16 (22)
Byte  12:  0x85 (133)
Byte  13:  0x00 (0)
Byte  14:  0x00 (0)
Byte  15:  0x00 (0)
Byte  16:  0x00 (0)
Byte  17:  0x00 (0)
Byte  18:  0x00 (0)
Byte  19:  0x16 (22)
Byte  20:  0x05 (5)
Byte  21:  0x00 (0)
Byte  22:  0x00 (0)
Byte  23:  0x00 (0)
Byte  24:  0x00 (0)
Byte  25:  0x00 (0)
Byte  26:  0x00 (0)

         Standard Endpoint Descriptor
        +----+----+---------------------------+----------+------------+
        :Off :Sz  :Name                       :Value hex :Value dec   :
        +----+----+---------------------------+----------+------------+
        :  0 :  1 : bLength                   :        7 :          7 :
        :  1 :  1 : bDescriptorType           :        5 :          5 :
        :  2 :  1 : bEndpointAddress          :       83 :        131 : Endpoint 3 - IN
        :  3 :  1 : bmAttributes              :        3 :          3 : Interrupt
        :  4 :  2 : wMaxPacketSize            :       20 :         32 : 1 x 32 byte max packets
        :  6 :  1 : bInterval                 :        2 :          2 :
        +----+----+---------------------------+----------+------------+

         Standard Endpoint Descriptor
        +----+----+---------------------------+----------+------------+
        :Off :Sz  :Name                       :Value hex :Value dec   :
        +----+----+---------------------------+----------+------------+
        :  0 :  1 : bLength                   :        7 :          7 :
        :  1 :  1 : bDescriptorType           :        5 :          5 :
        :  2 :  1 : bEndpointAddress          :        4 :          4 : Endpoint 4 - OUT
        :  3 :  1 : bmAttributes              :        3 :          3 : Interrupt
        :  4 :  2 : wMaxPacketSize            :       20 :         32 : 1 x 32 byte max packets
        :  6 :  1 : bInterval                 :        4 :          4 :
        +----+----+---------------------------+----------+------------+

     Standard Interface Descriptor
    +----+----+---------------------------+----------+------------+
    :Off :Sz  :Name                       :Value hex :Value dec   :
    +----+----+---------------------------+----------+------------+
    :  0 :  1 : bLength                   :        9 :          9 :
    :  1 :  1 : bDescriptorType           :        4 :          4 :
    :  2 :  1 : bInterfaceNumber          :        2 :          2 :
    :  3 :  1 : bAlternateSetting         :        0 :          0 :
    :  4 :  1 : bNumEndpoints             :        1 :          1 :
    :  5 :  1 : bInterfaceClass           :       ff :        255 : Vendor Specific
    :  6 :  1 : bInterfaceSubClass        :       5d :         93 :
    :  7 :  1 : bInterfaceProtocol        :        2 :          2 :
    :  8 :  1 : iInterface                :        0 :          0 : ''
    +----+----+---------------------------+----------+------------+

*** Unknown Descriptor ***
bLength:          9
bDescriptorType:  0x21 (33)
Byte   2:  0x00 (0)
Byte   3:  0x01 (1)
Byte   4:  0x01 (1)
Byte   5:  0x22 (34)
Byte   6:  0x86 (134)
Byte   7:  0x07 (7)
Byte   8:  0x00 (0)

         Standard Endpoint Descriptor
        +----+----+---------------------------+----------+------------+
        :Off :Sz  :Name                       :Value hex :Value dec   :
        +----+----+---------------------------+----------+------------+
        :  0 :  1 : bLength                   :        7 :          7 :
        :  1 :  1 : bDescriptorType           :        5 :          5 :
        :  2 :  1 : bEndpointAddress          :       86 :        134 : Endpoint 6 - IN
        :  3 :  1 : bmAttributes              :        3 :          3 : Interrupt
        :  4 :  2 : wMaxPacketSize            :       20 :         32 : 1 x 32 byte max packets
        :  6 :  1 : bInterval                 :       10 :         16 :
        +----+----+---------------------------+----------+------------+

     Standard Interface Descriptor
    +----+----+---------------------------+----------+------------+
    :Off :Sz  :Name                       :Value hex :Value dec   :
    +----+----+---------------------------+----------+------------+
    :  0 :  1 : bLength                   :        9 :          9 :
    :  1 :  1 : bDescriptorType           :        4 :          4 :
    :  2 :  1 : bInterfaceNumber          :        3 :          3 :
    :  3 :  1 : bAlternateSetting         :        0 :          0 :
    :  4 :  1 : bNumEndpoints             :        0 :          0 :
    :  5 :  1 : bInterfaceClass           :       ff :        255 : Vendor Specific
    :  6 :  1 : bInterfaceSubClass        :       fd :        253 :
    :  7 :  1 : bInterfaceProtocol        :       13 :         19 :
    :  8 :  1 : iInterface                :        4 :          4 : ''
    +----+----+---------------------------+----------+------------+

*** Unknown Descriptor ***
bLength:          6
bDescriptorType:  0x41 (65)
Byte   2:  0x00 (0)
Byte   3:  0x01 (1)
Byte   4:  0x01 (1)
Byte   5:  0x03 (3)
And Reporter running while trying to load the module:

Code: Select all

Reporter 2.72 (15 Aug 2020)     List              Mon 16th Nov 2020  03:19 

03:18:34.90 Exec
03:18:37.06 Run SDFS::RISCOSpi.$.Apps.Games.!ADFFS.USBJoystick
03:18:37.06 @RunType_FFA SDFS::RISCOSpi.$.Apps.Games.!ADFFS.USBJoystick
03:18:37.06 RMRun SDFS::RISCOSpi.$.Apps.Games.!ADFFS.USBJoystick
03:18:37.11 RMEnsure UtilityModule 3.70 RMEnsure CallASWI 0.02 RMLoad System:Modules.CallASWI
03:18:37.11 RMEnsure FPEmulator 4.03 RMLoad System:Modules.FPEmulator
03:18:37.11 RMEnsure SharedCLibrary 5.17 RMLoad System:Modules.CLib
USBJoystick: scanning USB devices...
.
Checking device name 'USB1' (sum_length 77, descriptors_offset 32, class 09, subclass 00, protocol 01)
Device descriptor: Length=18, Type=1, Configurations=1, csDeviceClass=0x90001
Device descriptor: iManufacturer=1, iProduct=2, iSerialNumber=0
Device descriptor: Vendor=0x0000, Product=0x0000, Device=0x0100
Configuration descriptor: NumInterfaces=1 
Interface descriptor: InterfaceNumber=0, InterfaceClass=9 (3 is HID), iInterface=0, csInterfaceClass=0x90000
Endpoint descriptor: EndpointAddress=129, (on TnterfaceNumber=0)
Endpoint descriptor: We think this isn't a joystick - ignore this endpoint
.
Checking device name 'USB2' (sum_length 77, descriptors_offset 32, class 09, subclass 00, protocol 01)
Device descriptor: Length=18, Type=1, Configurations=1, csDeviceClass=0x90001
Device descriptor: iManufacturer=1, iProduct=2, iSerialNumber=0
Device descriptor: Vendor=0x0000, Product=0x0000, Device=0x0100
Configuration descriptor: NumInterfaces=1 
Interface descriptor: InterfaceNumber=0, InterfaceClass=9 (3 is HID), iInterface=0, csInterfaceClass=0x90000
Endpoint descriptor: EndpointAddress=129, (on TnterfaceNumber=0)
Endpoint descriptor: We think this isn't a joystick - ignore this endpoint
.
Checking device name 'USB3' (sum_length 77, descriptors_offset 32, class 09, subclass 00, protocol 01)
Device descriptor: Length=18, Type=1, Configurations=1, csDeviceClass=0x90001
Device descriptor: iManufacturer=0, iProduct=1, iSerialNumber=0
Device descriptor: Vendor=0x2109, Product=0x3431, Device=0x0421
Configuration descriptor: NumInterfaces=1 
Interface descriptor: InterfaceNumber=0, InterfaceClass=9 (3 is HID), iInterface=0, csInterfaceClass=0x90000
Endpoint descriptor: EndpointAddress=129, (on TnterfaceNumber=0)
Endpoint descriptor: We think this isn't a joystick - ignore this endpoint
.
Checking device name 'USB4' (sum_length 111, descriptors_offset 32, class 00, subclass 00, protocol 00)
Device descriptor: Length=18, Type=1, Configurations=1, csDeviceClass=0x0
Device descriptor: iManufacturer=1, iProduct=2, iSerialNumber=0
Device descriptor: Vendor=0x046d, Product=0xc534, Device=0x2900
Configuration descriptor: NumInterfaces=2 
Interface descriptor: InterfaceNumber=0, InterfaceClass=3 (3 is HID), iInterface=0, csInterfaceClass=0x30101
Other descriptor: type is 33 - not Device/Config/Interface/Endpoint
csDeviceClass 0x0, csInterfaceClass 0x30101
InterfaceClass 0x3, InterfaceSubClass 0x1, InterfaceProtocol 1, Vendor 0x046d, Product 0xc534
Not a supported device - aborting
Endpoint descriptor: EndpointAddress=129, (on TnterfaceNumber=0)
Endpoint descriptor: We think this isn't a joystick - ignore this endpoint
Interface descriptor: InterfaceNumber=1, InterfaceClass=3 (3 is HID), iInterface=0, csInterfaceClass=0x30102
Other descriptor: type is 33 - not Device/Config/Interface/Endpoint
csDeviceClass 0x0, csInterfaceClass 0x30102
InterfaceClass 0x3, InterfaceSubClass 0x1, InterfaceProtocol 2, Vendor 0x046d, Product 0xc534
Not a supported device - aborting
Endpoint descriptor: EndpointAddress=130, (on TnterfaceNumber=1)
Endpoint descriptor: We think this isn't a joystick - ignore this endpoint
.
Checking device name 'USB9' (sum_length 191, descriptors_offset 32, class ff, subclass ff, protocol ff)
Device descriptor: Length=18, Type=1, Configurations=1, csDeviceClass=0xffffff
Device descriptor: iManufacturer=1, iProduct=2, iSerialNumber=3
Device descriptor: Vendor=0x045e, Product=0x028e, Device=0x0114
Configuration descriptor: NumInterfaces=4 
Interface descriptor: InterfaceNumber=0, InterfaceClass=255 (3 is HID), iInterface=0, csInterfaceClass=0xff5d01
Other descriptor: type is 33 - not Device/Config/Interface/Endpoint
csDeviceClass 0xffffff, csInterfaceClass 0xff5d01
InterfaceClass 0xff, InterfaceSubClass 0x5d, InterfaceProtocol 1, Vendor 0x045e, Product 0x028e
Supported device: XBOX360 wired controller
Will use joystick number 0 (next available) for this HID parse
Shared report descriptor 'rd' (size=166) with libusbhid
Got hid report size 20 for reportid 0, has_report_id is 0
Starting parse of HID report descriptor
HID parser:   reportid=0, got dpad up, copying
HID parser:   reportid=0, got dpad down, copying
HID parser:   reportid=0, got dpad left, copying
HID parser:   reportid=0, got dpad right, copying
HID parser:   reportid=0, got button, setting up button 7
HID parser:   reportid=0, got button, setting up button 6
HID parser:   reportid=0, got button, setting up button 8
HID parser:   reportid=0, got button, setting up button 9
HID parser:   reportid=0, got button, setting up button 4
HID parser:   reportid=0, got button, setting up button 5
HID parser:   reportid=0, got button, setting up button 10
HID parser:   reportid=0, ignoring item
HID parser:   reportid=0, got button, setting up button 0
HID parser:   reportid=0, got button, setting up button 1
HID parser:   reportid=0, got button, setting up button 2
HID parser:   reportid=0, got button, setting up button 3
HID parser:   reportid=0, got supported axis, usage is 0x32, type is 7
HID parser:   copying axis HID item to index 0
HID parser:   reportid=0, got supported axis, usage is 0x35, type is 10
HID parser:   copying axis HID item to index 1
HID parser:   reportid=0, got supported axis, usage is 0x30, type is 5
HID parser:   copying axis HID item to index 2
HID parser:   reportid=0, got supported axis, usage is 0x31, type is 6
HID parser:   copying axis HID item to index 3
HID parser:   reportid=0, got supported axis, usage is 0x33, type is 8
HID parser:   copying axis HID item to index 4
HID parser:   reportid=0, got supported axis, usage is 0x34, type is 9
HID parser:   copying axis HID item to index 5
HID parser:   reportid=0, ignoring item
Parse completed - freeing libusbhid report descriptor memory
Analysing parse output to build axes info
Axis 0, item_usage is 50, type is 7, name is Z
Axis 1, item_usage is 53, type is 10, name is RZ
Axis 2, item_usage is 48, type is 5, name is X
Axis 3, item_usage is 49, type is 6, name is Y
Axis 4, item_usage is 51, type is 8, name is RX
Axis 5, item_usage is 52, type is 9, name is RY
Stick has DPAD and we have two axes spare to use
Joystick/gamepad parsed and configured successfully (joy_index is 0)
Parsed HID report descriptor, got_valid_joystick is 1
usb_hid_set_output_report: dev='USB9' wValue=0x200, wIndex=0, wLength=3, buffer follows...
  Buffer index 00 = 0x01
  Buffer index 01 = 0x03
  Buffer index 02 = 0x00
Unable to initialise device USB9: Bad request
Endpoint descriptor: EndpointAddress=129, (on TnterfaceNumber=0)
Endpoint descriptor: We think this is a joystick (got HID report descriptor and it looks good), so set up
Set up: Fill up joystick info
usb_get_device_string_descriptor: device='USB9', string index=1
usb_get_device_string descriptor: Getting language: device='USB9' wValue=0x300, wIndex=0, wLength=256
usb_get_device_string descriptor: Language is 4
usb_get_device_string descriptor: getting size: device='USB9' wValue=0x301, wIndex=4, wLength=2
usb_get_device_string descriptor: StringSize is 22
usb_get_device_string descriptor: getting string: device='USB9' wValue=0x301, wIndex=4, wLength=22
03:18:37.12 ** Error **
  Error  : &80000001
  Message: Internal error: abort on instruction fetch at &00000000
03:18:37.12 ** WimpError ** from unknown task
  Error  : &80000001
  Message: Internal error: abort on instruction fetch at &00000000
03:18:37.12 Exec
03:18:41.65 Exec

Reporter 2.72 (15 Aug 2020)     Listed 132 lines

Re: USBJoystick 0.13

Posted: Mon Nov 16, 2020 9:30 am
by JonAbbott
From the USB descriptor it has a base class of 0xff "Vendor specific" so the Interface descriptors are unknown. It should really have a base class of 0x03 as it's an HID device. It's possible USBJoystick doesn't know how to interpret the interface descriptors and is doing something odd.

Re: USBJoystick 0.13

Posted: Thu Dec 03, 2020 6:09 pm
by Vanfanel
JonAbbott wrote: Mon Nov 16, 2020 9:30 am From the USB descriptor it has a base class of 0xff "Vendor specific" so the Interface descriptors are unknown. It should really have a base class of 0x03 as it's an HID device. It's possible USBJoystick doesn't know how to interpret the interface descriptors and is doing something odd.
Well, if there's something else I can do to help to support this very nice pad, please tell me.

Re: USBJoystick 0.13

Posted: Mon Dec 07, 2020 9:35 pm
by richw
Hi,

It looks like two problems, which may be connected.

1. USBJoystick tries to detect an 'XBOX360 wired' controller and send a specific configuration sequence to it. The RISC OS USB stack is responding with 'bad request' when I do this (according to the Reporter output you sent).

2. USBJoystick tries to read the serial, product and manufacturer strings to display in the USBJoystick_List command. As the code tries to read the string (which USBDescriptors manages to do so - it says 'Controller'), we get that nasty crash.

Either I have made a mistake in my USB string requesting and decoding code, or problem 1 causes problem 2.

Here is a test build of USBJoystick 0.17 with item 1 removed. So please can you run Reporter, then run this, and let me know how it goes?


Cheers,
Richard.

Re: USBJoystick 0.13

Posted: Thu Dec 10, 2020 8:09 pm
by Vanfanel
@richw: This is what reporter says with the version you just uploaded:

Code: Select all

Reporter 2.72 (15 Aug 2020)     List              Thu 10th Dec 2020  19:06 

19:05:30.50 Exec
19:06:08.61 Run SDFS::RISCOSpi.$.USBJoystick
19:06:08.61 @RunType_FFA SDFS::RISCOSpi.$.USBJoystick
19:06:08.61 RMRun SDFS::RISCOSpi.$.USBJoystick
19:06:08.65 RMEnsure UtilityModule 3.70 RMEnsure CallASWI 0.02 RMLoad System:Modules.CallASWI
19:06:08.65 RMEnsure FPEmulator 4.03 RMLoad System:Modules.FPEmulator
19:06:08.65 RMEnsure SharedCLibrary 5.17 RMLoad System:Modules.CLib
USBJoystick: module_initialise: begin
USBJoystick: module_initialise: Scanning USB devices...
USBJoystick: .
USBJoystick: Checking device name 'USB1' (sum_length 77, descriptors_offset 32, class 09, subclass 00, protocol 01)
USBJoystick: Device descriptor: Length=18, Type=1, Configurations=1, csDeviceClass=0x90001
USBJoystick: Device descriptor: iManufacturer=1, iProduct=2, iSerialNumber=0
USBJoystick: Device descriptor: Vendor=0x0000, Product=0x0000, Device=0x0100
USBJoystick: Configuration descriptor: NumInterfaces=1 
USBJoystick: Interface descriptor: InterfaceNumber=0, InterfaceClass=9 (3 is HID), iInterface=0, csInterfaceClass=0x90000
USBJoystick: Endpoint descriptor: EndpointAddress=129, (on InterfaceNumber=0)
USBJoystick: Endpoint descriptor: We think this isn't a joystick - ignore this endpoint
USBJoystick: .
USBJoystick: Checking device name 'USB2' (sum_length 77, descriptors_offset 32, class 09, subclass 00, protocol 01)
USBJoystick: Device descriptor: Length=18, Type=1, Configurations=1, csDeviceClass=0x90001
USBJoystick: Device descriptor: iManufacturer=1, iProduct=2, iSerialNumber=0
USBJoystick: Device descriptor: Vendor=0x0000, Product=0x0000, Device=0x0100
USBJoystick: Configuration descriptor: NumInterfaces=1 
USBJoystick: Interface descriptor: InterfaceNumber=0, InterfaceClass=9 (3 is HID), iInterface=0, csInterfaceClass=0x90000
USBJoystick: Endpoint descriptor: EndpointAddress=129, (on InterfaceNumber=0)
USBJoystick: Endpoint descriptor: We think this isn't a joystick - ignore this endpoint
USBJoystick: .
USBJoystick: Checking device name 'USB3' (sum_length 77, descriptors_offset 32, class 09, subclass 00, protocol 01)
USBJoystick: Device descriptor: Length=18, Type=1, Configurations=1, csDeviceClass=0x90001
USBJoystick: Device descriptor: iManufacturer=0, iProduct=1, iSerialNumber=0
USBJoystick: Device descriptor: Vendor=0x2109, Product=0x3431, Device=0x0421
USBJoystick: Configuration descriptor: NumInterfaces=1 
USBJoystick: Interface descriptor: InterfaceNumber=0, InterfaceClass=9 (3 is HID), iInterface=0, csInterfaceClass=0x90000
USBJoystick: Endpoint descriptor: EndpointAddress=129, (on InterfaceNumber=0)
USBJoystick: Endpoint descriptor: We think this isn't a joystick - ignore this endpoint
USBJoystick: .
USBJoystick: Checking device name 'USB4' (sum_length 111, descriptors_offset 32, class 00, subclass 00, protocol 00)
USBJoystick: Device descriptor: Length=18, Type=1, Configurations=1, csDeviceClass=0x0
USBJoystick: Device descriptor: iManufacturer=1, iProduct=2, iSerialNumber=0
USBJoystick: Device descriptor: Vendor=0x046d, Product=0xc534, Device=0x2900
USBJoystick: Configuration descriptor: NumInterfaces=2 
USBJoystick: Interface descriptor: InterfaceNumber=0, InterfaceClass=3 (3 is HID), iInterface=0, csInterfaceClass=0x30101
USBJoystick: Other descriptor: type is 33 - not Device/Config/Interface/Endpoint
USBJoystick: csDeviceClass 0x0, csInterfaceClass 0x30101
USBJoystick: InterfaceClass 0x3, InterfaceSubClass 0x1, InterfaceProtocol 1, Vendor 0x046d, Product 0xc534
USBJoystick: Not a supported device - aborting
USBJoystick: Endpoint descriptor: EndpointAddress=129, (on InterfaceNumber=0)
USBJoystick: Endpoint descriptor: We think this isn't a joystick - ignore this endpoint
USBJoystick: Interface descriptor: InterfaceNumber=1, InterfaceClass=3 (3 is HID), iInterface=0, csInterfaceClass=0x30102
USBJoystick: Other descriptor: type is 33 - not Device/Config/Interface/Endpoint
USBJoystick: csDeviceClass 0x0, csInterfaceClass 0x30102
USBJoystick: InterfaceClass 0x3, InterfaceSubClass 0x1, InterfaceProtocol 2, Vendor 0x046d, Product 0xc534
USBJoystick: Not a supported device - aborting
USBJoystick: Endpoint descriptor: EndpointAddress=130, (on InterfaceNumber=1)
USBJoystick: Endpoint descriptor: We think this isn't a joystick - ignore this endpoint
USBJoystick: .
USBJoystick: Checking device name 'USB9' (sum_length 191, descriptors_offset 32, class ff, subclass ff, protocol ff)
USBJoystick: Device descriptor: Length=18, Type=1, Configurations=1, csDeviceClass=0xffffff
USBJoystick: Device descriptor: iManufacturer=1, iProduct=2, iSerialNumber=3
USBJoystick: Device descriptor: Vendor=0x045e, Product=0x028e, Device=0x0114
USBJoystick: Configuration descriptor: NumInterfaces=4 
USBJoystick: Interface descriptor: InterfaceNumber=0, InterfaceClass=255 (3 is HID), iInterface=0, csInterfaceClass=0xff5d01
USBJoystick: Other descriptor: type is 33 - not Device/Config/Interface/Endpoint
USBJoystick: csDeviceClass 0xffffff, csInterfaceClass 0xff5d01
USBJoystick: InterfaceClass 0xff, InterfaceSubClass 0x5d, InterfaceProtocol 1, Vendor 0x045e, Product 0x028e
USBJoystick: Supported device: XBOX360 wired controller
USBJoystick: Will use joystick number 0 (next available) for this HID parse
USBJoystick: Shared report descriptor 'rd' (size=166) with libusbhid
USBJoystick: Got hid report size 20 for reportid 0, has_report_id is 0
USBJoystick: HID parser:   reportid=0, ignoring item where page=0 and usage=0
USBJoystick: HID parser:   reportid=0, ignoring item where page=0 and usage=0
USBJoystick: Parse completed - freeing libusbhid report descriptor memory
USBJoystick: Analysing parse output to build axes info
USBJoystick: Axis 0, item_usage is 50, type is 7, name is Z
USBJoystick: Axis 1, item_usage is 53, type is 10, name is RZ
USBJoystick: Axis 2, item_usage is 48, type is 5, name is X
USBJoystick: Axis 3, item_usage is 49, type is 6, name is Y
USBJoystick: Axis 4, item_usage is 51, type is 8, name is RX
USBJoystick: Axis 5, item_usage is 52, type is 9, name is RY
USBJoystick: Stick has DPAD and we have two axes spare to use
USBJoystick: Joystick/gamepad parsed and configured successfully (joy_index is 0)
USBJoystick: Parsed HID report descriptor, got_valid_joystick is 1
USBJoystick: Endpoint descriptor: EndpointAddress=129, (on InterfaceNumber=0)
USBJoystick: Endpoint descriptor: We think this is a joystick (got HID report descriptor and it looks good), so set up
USBJoystick: Set up: Fill up joystick info
USBJoystick: usb_get_device_string_descriptor: device='USB9', string index=1
USBJoystick: usb_get_device_string descriptor: Getting language: device='USB9' wValue=0x300, wIndex=0, wLength=256
USBJoystick: usb_get_device_string descriptor: Language is 4
USBJoystick: usb_get_device_string_descriptor: Allocating 256 bytes for string descriptor
USBJoystick: usb_get_device_string descriptor: getting size: device='USB9' wValue=0x301, wIndex=4, wLength=2
USBJoystick: usb_get_device_string descriptor: StringSize is 22
USBJoystick: usb_get_device_string descriptor: getting string: device='USB9' wValue=0x301, wIndex=4, wLength=22
19:06:08.66 ** Error **
  Error  : &80000001
  Message: Internal error: abort on instruction fetch at &00000000
19:06:08.66 ** WimpError ** from unknown task
  Error  : &80000001
  Message: Internal error: abort on instruction fetch at &00000000
19:06:08.66 Exec
19:06:25.53 Exec

Reporter 2.72 (15 Aug 2020)     Listed 101 lines

Re: USBJoystick 0.13

Posted: Fri Dec 11, 2020 10:38 pm
by richw
Thanks for that. Looks like I should not have worried about the control sequence!

Can you also do:

USBDevices

and, assuming your device is still number 9:

USBDevInfo 9

and capture the output?

I will produce a new version of USBJoystick with so!e extra debugging around the strings. I could disable it completely, but I would like to understand the issue first.