Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add support for all buttons on modern OneXPlayer devices. #305

Open
pastaq opened this issue Mar 3, 2025 · 0 comments
Open

[Feature] Add support for all buttons on modern OneXPlayer devices. #305

pastaq opened this issue Mar 3, 2025 · 0 comments
Labels
enhancement New feature or request hardware support This issue requests adding new hardware of fixing a bug with existing hardware

Comments

@pastaq
Copy link
Contributor

pastaq commented Mar 3, 2025

OneXPlayer devices from the 2 onward, including the fly and X1 models, have had macro buttons that don't use traditional HID devices. Instead, they are serial devices. Below are some results of investigating. Thanks to discord user @soost for the majority of this information.

X1 Intel:

udevadm_info.txt
udevadm_info_walk.txt

This python script allows for the identification of each button.

import serial
                
DATA_SIZE = 15
ID=3
EV=9

buttons = {
    0x22: "m1",
    0x23: "m2",
    0x24: "kbd",
}

events = {
    0x01: "down",
    0x02: "up",
}

if __name__ == "__main__":
    prev_data = None
    try:
        with serial.Serial(port='/dev/ttyUSB0', baudrate=115200, 
                           bytesize = serial.EIGHTBITS, parity = serial.PARITY_EVEN,
                           stopbits = serial.STOPBITS_TWO) as ser:

            while True:
                if ser.in_waiting > DATA_SIZE:
                    data = ser.read(DATA_SIZE)
                    if data == prev_data:
                        continue
                    hex_data = data.hex()
                    print(f"Received data: {hex_data} [ Button: {buttons.get(data[ID])}, Event: {events.get(data[EV])} ]")
                    prev_data = data
    except Exception as e:
        print(f"Error: {e}")

Raw data:

// right button pressed
Received data: 521a3f220200000000010000003f1a521a3f220200000000010000003f1a
// right button released
Received data: 531a3f220200000000020000003f1a531a3f220200000000020000003f1a
// left button pressed
Received data: 541a3f230200000000010000003f1a541a3f230200000000010000003f1a
//left button released
Received data: 551a3f230200000000020000003f1a551a3f230200000000020000003f1a
// kbd button pressed
// kbd button released
Received data: 151a3f240202020000010000003f1a
Received data: 151a3f240202020000010000003f1a
Received data: 161a3f240202020000020000003f1a
Received data: 161a3f240202020000020000003f1a

The OneXFly Pro has the following devices:
/dev/usb/hiddev0 and /dev/usb/hiddev1

A driver will need to be written and more data is needed for all models.

@pastaq pastaq added enhancement New feature or request hardware support This issue requests adding new hardware of fixing a bug with existing hardware labels Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hardware support This issue requests adding new hardware of fixing a bug with existing hardware
Projects
None yet
Development

No branches or pull requests

1 participant