Skip to content

hid-service: clarify ELAN input-report length discrepancy (44 vs 46 bytes) #988

Closed

Description

@felipebalbi

Summary

The ELAN HC4909-20H5V0 programming guide gives conflicting descriptions of input-report length. We should record the interpretation used by hid-service and obtain clarification before anyone adds a touchpad-specific length adjustment.

This is a vendor-documentation/integration question, not a confirmed software defect. The current implementation is consistent with the guide's numeric descriptor field and packet layout. There is no hardware capture demonstrating that it reads the wrong length.

Conflicting requirements

ELAN HC4909-20H5V0 I2C Programming Guide, v1.0:

  • Section 2.1 sets wMaxInputLength = 0x002C, which is 44 bytes.
  • The annotation in that same table describes 44 data bytes plus a two-byte length field, which would total 46.
  • Section 4.2 lays out the PTP packet from Byte0 through Byte43, with the length field already occupying Byte0 and Byte1: 44 bytes total.

Section 3.4 describes input retrieval but does not reconcile the conflicting count in section 2.1.

Current behavior

Device::handle_input_report() uses the advertised value directly for both the I2C read and returned slice:

buf.get_mut(0..desc.w_max_input_length as usize)

Consequently, a descriptor advertising 0x002C produces a 44-byte I2C read and a 44-byte returned slice. This is consistent with the numeric field and packet layout; it does not establish how the physical touchpad behaves. A mock returning 46 bytes would merely encode the opposite assumption and could not settle the documentation conflict.

Why track this

  • Following the annotation literally could lead to an unconditional +2 adjustment that conflicts with the numeric field and packet layout.
  • Following the numeric field without recording the discrepancy leaves the same ambiguity for the next integration or review.
  • Firmware/bootloader modes could need separate evidence; the available software tests do not establish their actual descriptor values or transfer behavior.

This was identified during the documentation audit of #984. The descriptor-driven input-length arithmetic predates that PR; its freshness changes do not introduce a two-byte adjustment. The follow-up tests pin the numeric interpretation, not a newly invented hardware requirement.

Desired resolution

  1. Obtain vendor clarification or an updated guide identifying whether the annotation is erroneous and whether the length includes its own two bytes.
  2. If available, retain a device/controller trace together with the actual advertised descriptor and firmware version.
  3. Record the resolved interpretation beside the relevant code/test with the document revision and section references.

Until then, do not change the generic input-length arithmetic solely because of the conflicting annotation. This issue is not requesting a speculative fix.

Evidence required

No failing software test is justified yet: the unresolved part is the vendor/hardware contract, not demonstrated wrong output from the implementation. A vendor clarification or an actual descriptor/transfer trace must establish the expected behavior before a regression test can honestly assert that the current result is wrong. The separate comment records this limitation rather than presenting a passing characterization test as a bug reproducer.

Activity

  1. felipebalbi commented on Nov 18, 2026

    @felipebalbi
    ContributorAuthor

    Evidence needed before writing a failing regression test

    This is a documentation-clarification issue, not an established software defect. The previous passing characterization test has been removed; it was not a failing reproducer of incorrect behavior.

    ELAN HC4909-20H5V0 I2C Programming Guide v1.0, section 2.1 gives numeric length 0x002C, while its annotation implies 46 total bytes. Section 4.2 lays out 44 bytes including the two-byte length field. Current code follows the numeric field and packet layout.

    We need vendor clarification or an actual descriptor/transfer trace for the relevant firmware/mode before a test can honestly assert that current behavior is wrong. Asserting 46 bytes merely to create a red test would invent a requirement contradicted by the other evidence. Once the intended contract is established, a regression test should assert that verified behavior. No speculative length change or hardware claim is being made.

  2. yourongtang commented on Nov 19, 2026

    @yourongtang

    section 4.2 is correct, section 2.1 is incorrect, confirmed by dumping the ELAN report descriptor

  3. moved this to Done in ECon Nov 20, 2026
  4. closed this as completedby moving to Done in ECon Nov 20, 2026
  5. felipebalbi commented on Nov 20, 2026

    @felipebalbi
    ContributorAuthor

    Closing as fixed based on @yourongtang's comment

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions