Problems with JOYSTICK_SIZE = 64

Status
Not open for further replies.

Maes2ro

Active member
I am having some difficulties with the larger joystick configuration.
I am using Teesy 3.2 with Teensyduino 1.53. I have changed all 4 instances of JOYSTICK_SIZE in usb_desc.h to 64, but have not changed any other configuration files.

After many hours of struggles, I have gone back to the ExtremeJoystickTest.ino to take all the rest of my application out of the picture, and have further simplified the test, by putting fixed values in to the various functions

// place fixed values
Joystick.X(512);
Joystick.Y(512);
Joystick.Z(512 * 64);
Joystick.Xrotate(512 * 64);
Joystick.Yrotate(512 * 64);
Joystick.Zrotate(512 * 64);

Joystick.slider(1, 512 * 64);
Joystick.slider(2, 512 * 64);
Joystick.slider(3, 512 * 64);
Joystick.slider(4, 512 * 64);
Joystick.slider(5, 512 * 64);
Joystick.slider(6, 512 * 64);
Joystick.slider(7, 512 * 64);
Joystick.slider(8, 512 * 64);

You will see that I have got small mid-range values in for X & Y. This is because from an earlier test, I found that 16bit values over-ranged them, and I had to put 10bit values in to be able to observe anything.

On windows device manager, I can see X&Y set at mid range with 512 as input, followed by Joystick.Z, XRot, YRot & ZRot at mid range with 32768 as input values. Two sliders are visible, but they show no value. The hat is rotating as expected, and the buttons are visible.

If I connect the teensy to a Debian computer, jstest-gsk shows no axis inputs at all, but the hat and buttons appear as expected.

Referring briefly back to my own application, this worked fine with JOYSTICK_SIZE = 12.

Is there another configuration file that I need to change, to get the HID message correctly formatted? I'm thinking that this might be the type of problem beause X & Y do not behave correctly,

I've hit the limits of my detective abilities at this stage, so any guidance would be very gratefully recieved!
 
I have been continuing to work on this problem, and have done another interesting test.

My application requires both the joystick and a serial interface, so I have been compiling with the Serial + Keyboard + Mouse + Joystick USB type, which is where I have been having the problems.

I have just tried recompiling just with the Keyboard + Mouse + Joystick type, and now all the main Joystick axes work properly at 16bit (X,Y,Z,XR,YR, ZR). Still no sliders, but I don't need those at the moment. Sadly I do need the Serial though, so I'm not out of the woods yet.

I'm sure there is a clue there for someone who knows their way around HID.
 
This effect is repeatable on both teensy 3.2 and 3.6. I've not tried on 3.5 and 4.1, but I'm guessing it will be the same.
 
Often times, when I run into issues like this, particularly when I am working on the USBHost code with new devices, I will try to get as much information from a new device. Sometimes I like to do this on a linux device including even an RPI...

To do this I will often times use the HID dump and other utilities... From another thread I did this:
Code:
kurt@kurt-UP-CHT01:~$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 0424:2530 Standard Microsystems Corp.
Bus 001 Device 004: ID 0bda:8178 Realtek Semiconductor Corp. RTL8192CU 802.11n WLAN Adapter
Bus 001 Device 003: ID 0424:4603 Standard Microsystems Corp.
Bus 001 Device 007: ID 056a:00d8 Wacom Co., Ltd
Bus 001 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
kurt@kurt-UP-CHT01:~$ sudo usbhid-dump
001:007:001:DESCRIPTOR         1504887181.952739
 06 00 FF 09 01 A1 01 85 02 05 0D 09 22 A1 00 06
 00 FF 09 01 15 00 26 FF 00 75 08 95 02 81 02 05
 01 09 30 35 00 46 44 48 26 E4 02 75 10 95 01 81
 02 09 31 46 D4 30 26 F4 01 81 02 06 00 FF 09 01
 26 FF 00 75 08 95 0D 81 02 C0 C0

001:007:000:DESCRIPTOR         1504887181.956943
 05 01 09 02 A1 01 85 01 09 01 A1 00 05 09 19 01
 29 05 15 00 25 01 95 05 75 01 81 02 95 01 75 03
 81 01 05 01 09 30 09 31 15 81 25 7F 75 08 95 02
 81 06 C0 C0 05 0D 09 01 A1 01 85 02 A1 00 06 00
 FF 09 01 15 00 26 FF 00 75 08 95 08 81 02 C0 09
 01 85 02 95 01 B1 02 09 01 85 03 95 01 B1 02 09
 01 85 04 95 01 B1 02 09 01 85 05 95 01 B1 02 09
 01 85 10 95 02 B1 02 09 01 85 11 95 10 B1 02 09
 01 85 13 95 01 B1 02 09 01 85 20 95 01 B1 02 09
 01 85 21 95 01 B1 02 09 01 85 06 95 01 B1 02 09
 01 85 07 95 01 B1 02 09 01 85 14 95 01 B1 02 C0

kurt@kurt-UP-CHT01:~$ sudo usbhid-dump  -i0 | grep -v : | xxd -r -p | hidrd-convert -o spec
Usage Page (Desktop),               ; Generic desktop controls (01h)
Usage (Mouse),                      ; Mouse (02h, application collection)
Collection (Application),
    Report ID (1),
    Usage (Pointer),                ; Pointer (01h, physical collection)
    Collection (Physical),
        Usage Page (Button),        ; Button (09h)
        Usage Minimum (01h),
        Usage Maximum (05h),
        Logical Minimum (0),
        Logical Maximum (1),
        Report Count (5),
        Report Size (1),
        Input (Variable),
        Report Count (1),
        Report Size (3),
        Input (Constant),
        Usage Page (Desktop),       ; Generic desktop controls (01h)
        Usage (X),                  ; X (30h, dynamic value)
        Usage (Y),                  ; Y (31h, dynamic value)
        Logical Minimum (-127),
        Logical Maximum (127),
        Report Size (8),
        Report Count (2),
        Input (Variable, Relative),
    End Collection,
End Collection,
Usage Page (Digitizer),             ; Digitizer (0Dh)
Usage (Digitizer),                  ; Digitizer (01h, application collection)
Collection (Application),
    Report ID (2),
    Collection (Physical),
        Usage Page (FF00h),         ; FF00h, vendor-defined
        Usage (01h),
        Logical Minimum (0),
        Logical Maximum (255),
        Report Size (8),
        Report Count (8),
        Input (Variable),
    End Collection,
    Usage (01h),
    Report ID (2),
    Report Count (1),
    Feature (Variable),
    Usage (01h),
    Report ID (3),
    Report Count (1),
    Feature (Variable),
    Usage (01h),
    Report ID (4),
    Report Count (1),
    Feature (Variable),
    Usage (01h),
    Report ID (5),
    Report Count (1),
    Feature (Variable),
    Usage (01h),
    Report ID (16),
    Report Count (2),
    Feature (Variable),
    Usage (01h),
    Report ID (17),
    Report Count (16),
    Feature (Variable),
    Usage (01h),
    Report ID (19),
    Report Count (1),
    Feature (Variable),
    Usage (01h),
    Report ID (32),
    Report Count (1),
    Feature (Variable),
    Usage (01h),
    Report ID (33),
    Report Count (1),
    Feature (Variable),
    Usage (01h),
    Report ID (6),
    Report Count (1),
    Feature (Variable),
    Usage (01h),
    Report ID (7),
    Report Count (1),
    Feature (Variable),
    Usage (01h),
    Report ID (20),
    Report Count (1),
    Feature (Variable),
End Collection
kurt@kurt-UP-CHT01:~$ sudo usbhid-dump  -i1 | grep -v : | xxd -r -p | hidrd-convert -o spec Usage Page (FF00h),                 ; FF00h, vendor-defined
Usage (01h),
Collection (Application),
    Report ID (2),
    Usage Page (Digitizer),         ; Digitizer (0Dh)
    Usage (Finger),                 ; Finger (22h, logical collection)
    Collection (Physical),
        Usage Page (FF00h),         ; FF00h, vendor-defined
        Usage (01h),
        Logical Minimum (0),
        Logical Maximum (255),
        Report Size (8),
        Report Count (2),
        Input (Variable),
        Usage Page (Desktop),       ; Generic desktop controls (01h)
        Usage (X),                  ; X (30h, dynamic value)
        Physical Minimum (0),
        Physical Maximum (18500),
        Logical Maximum (740),
        Report Size (16),
        Report Count (1),
        Input (Variable),
        Usage (Y),                  ; Y (31h, dynamic value)
        Physical Maximum (12500),
        Logical Maximum (500),
        Input (Variable),
        Usage Page (FF00h),         ; FF00h, vendor-defined
        Usage (01h),
        Logical Maximum (255),
        Report Size (8),
        Report Count (13),
        Input (Variable),
    End Collection,
End Collection
kurt@kurt-UP-CHT01:~$
Note: you will probably need to install some components... I don't remember exactly which ones, but I think I was simply able to type in the command like usbhid-dump and it told me which one.

Again it might help verify that the system sees the different HID devices and they have the right attributes and fields.
 
Thank you very much for helping me with this.
I'm very new to Linux, and do the vast majority of my work on Windows, and in fact the problems manifest themselves pretty clearly on Windows anyway.
I've done a HID dump of the same Teensy, wiht the identical code compiled in both configurations, with and without Serial. I'm attaching these as text files, so might you be able to cast an expert eye to see if anything jumps out at you?
I will of course be studying them myself, but I'm at the bottom of the curve at the moment
 

Attachments

  • KBD_Mouse_Jstick.txt
    5.6 KB · Views: 55
  • Serial_KBD_Mouse_Jstick.txt
    7 KB · Views: 47
Thanks,

Unfortunately it does not show the HID information. I will try to get around to generating simple sketch like this and program T3.x with it and see...
 
I'm sorry about that, I didn't check.
To save you time, I'm attaching the actual sketch that I am using. it's just a really minor adaptation of Paul's original
 

Attachments

  • ExtremeJoystickTest-1.ino
    3.1 KB · Views: 55
I did a bit more experimenting last week as I needed to get my device out of the door, and found that if I compiled with 'All of the above' the large joystick behaved properly. Clearly there is a load of extra functionality there, but at least I got the 16bit joystick that I need right now.
 
Glad that worked. Sorry I was not able to see why the other did not work... And my Ubuntu 20.04 Linux machines don't have the hidrd-convert utility on them,
and the: sudo apt-get install hidrd
does not find the package... Not sure why but tried both on 64 bit PC as well as a RPI4 running Ubuntu 64 bit ARM...
also: apt-cache search hidrd
did not find anything. So not sure how to properly install it these days.

EDIT: Although I could install it on Windows 10 Ubuntu window. So I may still be able get the data when needed.
 
Status
Not open for further replies.
Back
Top