tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Reading I2C HID descriptor from userland



See responses further down in-line:

> On Aug 20, 2022, at 8:51 AM, Emmanuel Dreyfus <manu%netbsd.org@localhost> wrote:
> 
> Hello
> 
> I have a ihidev device that fails to find its HID descriptor. In order to
> debug that, I try to retreive it from userspace.
> 
> At kernel boot, I have:
> ihidev1 at iic2 addr 0x5d
> 
> I try the code at the end of this message, inspired from sys/dec/i2c/ihidev.c.
> I am supposed to find the HID descriptor at address sc_hid_desc_addr, which 
> should come frome ACPI.
> 
> The HID over I2C specification is at https://docs.microsoft.com/en-us/previous-versions/windows/hardware/design/dn642101%28v=vs.85%29?redirectedfrom=MSDN
> Section 10 deals with ACPI bindings. It says the HID descriptor
> address is to be find in a _DSM object that "defines a structure
> that contains the HID Descriptor address (2 bytes)"
> 
> acpdump -dt gives me this:
>            Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
>            {
>                If ((Arg0 == HIDG))
>                {
>                    Return (HIDD (Arg0, Arg1, Arg2, Arg3, HID2))
>                }
> 
>                Return (Buffer (One)
>                {
>                     0x00                                             // .
>                })
>            }
> 
> How should this be readen? I found the HIDG definition earlier in the 
> ACPI dump, and my device has Name (HID2, One).
>        Name (HIDG, ToUUID ("3cdff6f7-4267-4555-ad05-b30a3d8938de") /* HID I2C Device */)
> (...)
>        Method (HIDD, 5, Serialized)
>        {
>            If ((Arg0 == HIDG))
>            {
>                If ((Arg2 == Zero))
>                {
>                    If ((Arg1 == One))
>                    {
>                        Return (Buffer (One)
>                        {
>                             0x03                                             // .
>                        })
>                    }
>                }
> 
>                If ((Arg2 == One))
>                {
>                    Return (Arg4)
>                }
>            }
> 
> Hence 1 or 3? Both return garbage. In fact I tried to brute-force the thing, 
> I never get anything relevant.

It’s definitely not going to be 3, because the arguments being passed to the HIDD method from the _DSM are:

Arg0 = 3cdff6f7-4267-4555-ad05-b30a3d8938de
Arg1 = 1
Arg2 = 1
Arg3 = NULL
Arg4 = One (I guess?)

What does the ihidev driver think the descriptor address is?  I.e. what’s the result of the _DSM evaluation?

Can you provide your entire ACPI dump?

-- thorpej



Home | Main Index | Thread Index | Old Index