Removing Unwanted Axis/Axes from a Joystick

I have a Teensy 4.1 that I'm using to build a button box with 32 buttons and 1 analog input using Teensy Joystick, but I'm wondering if it is possible to remove the unwanted axes.

I would like to do away with the X, Y, Z Rotation and Slider axes, as well as the HAT. I only need 32 buttons and a single Z axis. Is this possible?

I think I've managed to figure out that the USB HID descriptor file is where I need to be looking, but I'm not sure of what exactly needs to be done. My trial and error expermients have only resulted in total failure so far.

Any help is greatly appreciated.
Sorry been awhile since I played with the joystick stuff. Most of my playing has been done on the USB Host side.

There are at least three things to do to see if it works.

a) Update the HID descriptor. It may or may not be as easy as removing items. That is there are some types of fields that may want
to have their input aligned to maybe byte boundaries. So if you for example remove a HAT that maybe uses 4 bits. You may need
to see if you need to adjust something and/or add/remove a buffer. Also the total size of the data bits of the packet must be in
full bytes...

b) Your code on the Teensy, needs to be setup, such that when you set a value it sets the right bits in the packet for that field. That is if you look at usb_joystick.h you will see things like:
void Y(unsigned int val) {
        if (val > 1023) val = 1023;
        usb_joystick_data[1] = (usb_joystick_data[1] & 0xFF003FFF) | (val << 14);
        if (!manual_mode) usb_joystick_send();
This is the 12 byte version, and it knows that the data is stored in specific bits in the second uint32_t value....
If you modified the HID, this code or similar needs to be updated to reflect this.

c) Not sure if some hosts (either their drivers or specific apps) might complain about a joystick that does not have some fields contained in their hid descriptor... Again I don't know. Something for you to experiment with.

Good luck
Just a quick update on this, I managed to get it to work as I wanted. Removed 3x axes and the HAT switch.

I amended usb_desc.h to reduce the Joystick size to 10 (I didn't quite need that many bytes, but it wouldn't compile with anything less, but I didn't see the value in pursuing that problem so I just went with it).

I amended the HID Descriptor code in usb_desc.c to remove the unwanted axes, and had to add some padding bits to align the bytes at 10 (80 bits). Had no idea what a USB HID Descriptor really was before last week, so spent a little bit of time studying the information on A joystick is expected to have an X and Y axis and two buttons as a minimum, which makes perfect sense.

I also had to amend the usb_joystick.h file.

So once again, thanks for pointing me in the right direction. It wasn't easy but I got there in the end. These tricky problems are what I refer to as opportunities to excel.