Skip to content

VIA does not pad HID output reports to declared report size on Linux #404

Description

@K4rBie

Description

VIA fails to communicate with keyboards on Linux when the keyboard declares an output report size larger than VIA's hardcoded 32 bytes. The device connects successfully (WebHID authorization works, I needed to apply known udev rules) but all commands are silently ignored by the keyboard.

Affected environment

OS Linux (confirmed on Manjaro, likely affects all distros)
Browser Chromium, Brave (any browser using hidraw for WebHID)
Not affected Windows (HID driver pads automatically)
Keyboard Royal Kludge R75 Pro Wireless (VID 0x342D, PID 0xE487)

Likely affects any keyboard declaring output reports larger than 32 bytes.

Root cause

VIA hardcodes 32-byte output reports in _hidCommand:

const paddedArray = new Array(33).fill(0);

On Windows, the HID driver seems to automatically pad writes to match the size declared in the report descriptor. On Linux, hidraw passes bytes to the device exactly as-is with no padding. I understand the original intent was to send properly padded data and not to rely on Windows behaviour, which only masked the bug for most users.

My keyboard declares a 64 bytes report size, receives undersized packets and discards it entirely, with no response.
The same keyboard works correctly on Windows 11, Edge Browser.

Proposed fix

Read the correct output report size dynamically from device.collections and cache it per KeyboardAPI instance.

This is fully backwards compatible — keyboards with standard 32-byte reports are unaffected. The fix correctly handles any report size declared by the keyboard firmware without hardcoding.

I will provide PR asap.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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