SIGN IN SIGN UP
bevyengine / bevy UNCLAIMED

A refreshingly simple data-driven game engine built in Rust

0 0 59 Rust

gilrs: Add code to unknown buttons and axes (#8560)

# Objective

I'm using a joystick to control my game (a flight simulator), so gilrs
has not mapped all of the buttons. As discussed elsewhere, that's
intentional by gilrs, and that's fine - but, gilrs does give us the code
for the axis/button, which games can use to do their own mapping if we
expose it.

Fixes #1916

## Solution

I change the gilrs converter to use the (already existing) `Other`
variant of the axis/button types to expose the code, so users can access
them through events.

The code is given to us as a u32, but here I store it as a u8 just by
casting. The presumption is that joysticks will not typically have more
than 256 axes or buttons, indeed as of
[2020](https://patchwork.kernel.org/project/linux-input/patch/CACa7zykn0q9XJAUvrqnNATr4DUv3Kc7XujF3vm6sfRB5pE6YNQ@mail.gmail.com/)
linux only supported 80 buttons. So I think it should be fine.

---

## Changelog

- Exposed unmapped gamepad events

## Migration Guide

I don't think there should be any action required for users who don't
want this functionality.

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
L
Lane Kolbly committed
2997aa879353d0718dc1983ed69952aa3fefdb86
Parent: 1b16850
Committed by GitHub <noreply@github.com> on 5/22/2026, 10:04:33 AM