Skip to content

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

@pastaq

Description

@pastaq

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthardware supportThis issue requests adding new hardware of fixing a bug with existing hardware

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions