Skip to content

Support Wiitar #529

@appsforartists

Description

@appsforartists

The Guitar Hero controllers for Nintendo Wii were famously implemented as a fancy nunchuk - the colored buttons and strum bar are part of the guitar, but the Wiimote itself is used as a tilt sensor.

In the kernel, the guitar and the Wiimote are exposed as separate controllers. Moreover, they use button codes like BTN_1 that don't map to modern games.

Here's my Gemini-assisted attempt to merge them back into a single device, using the conventional button maps for plastic instruments:

# yaml-language-server: $schema=https://raw.githubusercontent.com/ShadowBlip/InputPlumber/main/rootfs/usr/share/inputplumber/schema/capability_map_v2.json
version: 2
kind: CapabilityMap
name: Wiitar
id: wiitar

mapping:
- name: Green
  source_events:
  - evdev: {event_code: "BTN_1"}
  target_event: {gamepad: {button: "South"}}

- name: Red
  source_events:
  - evdev: {event_code: "BTN_2"}
  target_event: {gamepad: {button: "East"}}

- name: Yellow
  source_events:
  - evdev: {event_code: "BTN_3"}
  target_event: {gamepad: {button: "North"}}

- name: Blue
  source_events:
  - evdev: {event_code: "BTN_4"}
  target_event: {gamepad: {button: "West"}}

- name: Orange
  source_events:
  - evdev: {event_code: "BTN_5"}
  target_event: {gamepad: {button: "LeftBumper"}}

- name: Whammy
  source_events:
  - evdev: {event_code: "ABS_HAT1X"}
  target_event: {gamepad: {axis: {name: "RightStick", direction: "x"}}}

- name: Accelerometer X
  source_events:
  - evdev: {event_code: "ABS_RX"}
  target_event: {accelerometer: {name: "Center", direction: "x"}}

- name: Accelerometer Y
  source_events:
  - evdev: {event_code: "ABS_RY"}
  target_event: {accelerometer: {name: "Center", direction: "y"}}

- name: Accelerometer Z
  source_events:
  - evdev: {event_code: "ABS_RZ"}
  target_event: {accelerometer: {name: "Center", direction: "z"}}


# yaml-language-server: $schema=https://raw.githubusercontent.com/ShadowBlip/InputPlumber/main/rootfs/usr/share/inputplumber/schema/composite_device_v1.json
version: 1
kind: CompositeDevice
name: Wiitar

matches:
- udev:
    vendor_id: "057e"
    product_id: "0306"
- udev:
    vendor_id: "057e"
    product_id: "0330"

source_devices:
- group: "guitar"
  capability_map_id: "wiitar"
  udev:
    subsystem: "input"
    name: "Nintendo Wii Remote Guitar"
    vendor_id: "057e"

- group: "accelerometer"
  capability_map_id: "wiitar"
  udev:
    subsystem: "input"
    name: "Nintendo Wii Remote Accelerometer"
    vendor_id: "057e"

- group: "buttons"
  capability_map_id: "wiitar"
  udev:
    subsystem: "input"
    name: "Nintendo Wii Remote"
    vendor_id: "057e"

target_devices:
- ds5
- mouse

However, inputplumber isn't handling the devices. Gemini tells me it's because Bluetooth devices are considered virtual, and that the check for these should be udevice.get_property_from_tree("ID_BUS") rather than udevice.get_property("ID_BUS").

Does this sound accurate? Would unifying Wii peripherals like this be a supported InputPlumber yaml use case, or would I need to generate lower level sources that treat the composite as a single device?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions