Skip to content

feat(Hardware Support): Add AYN Odin 3 - #659

Open
jenneron wants to merge 1 commit into
ShadowBlip:mainfrom
jenneron:odin-3
Open

feat(Hardware Support): Add AYN Odin 3#659
jenneron wants to merge 1 commit into
ShadowBlip:mainfrom
jenneron:odin-3

Conversation

@jenneron

@jenneron jenneron commented Aug 23, 2026

Copy link
Copy Markdown

Adds support for AYN Odin 3.

This follows #627 to make use of this in postmarketOS: https://wiki.postmarketos.org/wiki/AYN_Odin_3_(ayn-odin-3). I haven't tested it in UI yet (since https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8979 is not merged), but evtest seems to produce expected results

It combines 2 input devices (gamepad + gpio-keys for paddles). It maps D-Pad, paddles and also maps back button to QuickAccess (please let me know whether it's a good choice).

Note that this device kernel support is not upstreamed yet, so if anything changes during upstreaming there would have to be a follow-up PR. pmOS uses ROCKNIX kernel patches, so we should be on the same page between different distributions.

@justradical

justradical commented Aug 25, 2026

Copy link
Copy Markdown

Hi, this is missing this piece if its the rocknix DTBs, at least this is what we have in Armada. I'm working on upstreaming our devices as well https://github.com/justradical/InputPlumber/tree/armada-devices

  - name: West Button
    source_events:
      - evdev:
          event_type: KEY
          event_code: BTN_NORTH
          value_type: button
    target_event:
      gamepad:
        button: West

  - name: North Button
    source_events:
      - evdev:
          event_type: KEY
          event_code: BTN_WEST
          value_type: button
    target_event:
      gamepad:
        button: North

@jenneron

Copy link
Copy Markdown
Author

Hi, this is missing this piece if its the rocknix DTBs, at least this is what we have in Armada. I'm working on upstreaming our devices as well https://github.com/justradical/InputPlumber/tree/armada-devices

@justradical As far as I understand this is supposed to make physical Nintendo labels match Xbox ones? Please correct me if I'm wrong

In my opinion, we should match Xbox gamepad not by labels, but by key positions in order to fit Xbox ergonomics and muscle memory. If someone wants to match labels on their device they should swap physical buttons as this is what AYN advertises to do on their product page:

Product page picture image

@jenneron

Copy link
Copy Markdown
Author

Ah, I see, Xbox layout relies on north and west swapped

@justradical

Copy link
Copy Markdown

Ah, I see, Xbox layout relies on north and west swapped

yes the north and west keys are incorrectly labelled

@jenneron

Copy link
Copy Markdown
Author

yes the north and west keys are incorrectly labelled

i've pushed the chage with Co-authored-by, so this is fixed

@justradical

Copy link
Copy Markdown

yes the north and west keys are incorrectly labelled

i've pushed the chage with Co-authored-by, so this is fixed

also have you tested that volume keys work without the keyboard target? Volume up doesnt function on the retroid pocket 6 without also targeting keyboard as an output

@jenneron

Copy link
Copy Markdown
Author

also have you tested that volume keys work without the keyboard target? Volume up doesnt function on the retroid pocket 6 without also targeting keyboard as an output

no problems with volume keys when inputplumber is running, at least on phosh

Volume up doesnt function on the retroid pocket 6 without also targeting keyboard as an output

maybe volume up on this device shares gpio-keys DT node with gamepad keys?

it's not the case on odin 3, it has two separated gpio-keys nodes:

which results in:

I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="gpio-keys"
P: Phys=gpio-keys/input0
S: Sysfs=/devices/platform/gpio-keys/input/input2
U: Uniq=
H: Handlers=kbd event2 
B: PROP=0
B: EV=3
B: KEY=8000000000000 0

I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="gpio-keys-paddles"
P: Phys=gpio-keys/input0
S: Sysfs=/devices/platform/gpio-keys-paddles/input/input3
U: Uniq=
H: Handlers=event3 
B: PROP=0
B: EV=3
B: KEY=24000000000000 0 0 0 0

and this config only matches name: gpio-keys-paddles

Comment on lines +36 to +37
vendor_id: "0001"
product_id: "0001"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any reason to be specifying vendor_id and product_id here at all? This doesnt do anything in here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are generic VID/PID so they can be dropped

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dropped

Comment on lines +27 to +28
vendor_id: "2020"
product_id: "3001"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind of redundant with the devicetree but @pastaq or @ShadowApex should comment on that

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree about this one and previous, it should be able to work without it, although keeping these makes it more explicit documenting expected vendor/product ids. i'm happy to remove it if maintainers prefer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please retain any identifying information. It helps looking back historically.

Comment on lines +78 to +80
# Kernel reports NORTH/WEST by phisical position, but Xbox layout
# relies on these swapped. This results in NORTH/WEST swapped in
# evtest, but produces expected behaviour in games.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this note here is incorrect, it doesn't report by physical position, if it was by physical then the config wouldn't be needed, for some reason they arent for NORTH/WEST and have to be swapped in the config, SOUTH/EAST keys are correct, it might be a driver bug. but anyways, apart from this comment id say this lgtm

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be a driver bug

if it's a driver bug i would rather fix kernel instead, but i think my comment is correct

it seems that for some historical reason all xbox gamepads have to be "wrong" for userspace apps to understand them. i tested it with my 8bitdo gamepad and north/west are swapped in evtest, meanwhile odin 3 reports it correctly. I honestly don't understand why

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basically:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange stuff..

@justradical

Copy link
Copy Markdown

also have you tested that volume keys work without the keyboard target? Volume up doesnt function on the retroid pocket 6 without also targeting keyboard as an output

no problems with volume keys when inputplumber is running, at least on phosh

Volume up doesnt function on the retroid pocket 6 without also targeting keyboard as an output

maybe volume up on this device shares gpio-keys DT node with gamepad keys?

it's not the case on odin 3, it has two separated gpio-keys nodes:

* [ROCKNIX/distribution@`6166516`/projects/ROCKNIX/devices/SM8750/patches/linux/0046-arm64-dts-qcom-Add-AYN-CQ8725S-Common.patch#L118-L132](https://github.com/ROCKNIX/distribution/blob/6166516b9f5e6ae331eb98e9fce2f7349cb1422f/projects/ROCKNIX/devices/SM8750/patches/linux/0046-arm64-dts-qcom-Add-AYN-CQ8725S-Common.patch#L118-L132)

* [ROCKNIX/distribution@`6166516`/projects/ROCKNIX/devices/SM8750/patches/linux/0047-arm64-dts-qcom-Add-AYN-Odin3.patch#L363-L382](https://github.com/ROCKNIX/distribution/blob/6166516b9f5e6ae331eb98e9fce2f7349cb1422f/projects/ROCKNIX/devices/SM8750/patches/linux/0047-arm64-dts-qcom-Add-AYN-Odin3.patch#L363-L382)

which results in:

I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="gpio-keys"
P: Phys=gpio-keys/input0
S: Sysfs=/devices/platform/gpio-keys/input/input2
U: Uniq=
H: Handlers=kbd event2 
B: PROP=0
B: EV=3
B: KEY=8000000000000 0

I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="gpio-keys-paddles"
P: Phys=gpio-keys/input0
S: Sysfs=/devices/platform/gpio-keys-paddles/input/input3
U: Uniq=
H: Handlers=event3 
B: PROP=0
B: EV=3
B: KEY=24000000000000 0 0 0 0

and this config only matches name: gpio-keys-paddles

seeing varying results with other armada devs on this, odin 2 portal seemingly needs it, thor doesnt, retroid pocket 6 does. Maybe AYN fixed something in their devices between the odin 2 and 3/thor

@jenneron

Copy link
Copy Markdown
Author

seeing varying results with other armada devs on this, odin 2 portal seemingly needs it, thor doesnt, retroid pocket 6 does

are all of these devices upstream? we could patch dts

Maybe AYN fixed something in their devices between the odin 2 and 3/thor

this is really trivial to change in kernel, i can help with this if needed, but we need to have a good reason for it, "it's better for userspace" doesn't always work in kernel development. i think we should use "consistency" as the reason to do this

@justradical

Copy link
Copy Markdown

seeing varying results with other armada devs on this, odin 2 portal seemingly needs it, thor doesnt, retroid pocket 6 does

are all of these devices upstream? we could patch dts

Maybe AYN fixed something in their devices between the odin 2 and 3/thor

this is really trivial to change in kernel, i can help with this if needed, but we need to have a good reason for it, "it's better for userspace" doesn't always work in kernel development. i think we should use "consistency" as the reason to do this

Not upstreamed afaik, we carry dts files and patches for them in our armada-packages repo, armada-packages/kernel/dts. On mobile now since its late so i cant send a link easily


# Kernel reports NORTH/WEST by physical position, but Xbox layout
# relies on these swapped. This results in NORTH/WEST swapped in
# evtest, but produces expected behaviour in games.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you attach a picture of the ABXY with these mappings labeled?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what this config results into in evtest image

which matches my 8bitdo with xbox layout

Co-authored-by: Radical <radical@radical.fun>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants