[PATCH 2/2] hid: Don't sign-extend 16-bit values.

Zebediah Figura z.figura12 at gmail.com
Sun Feb 10 15:56:26 CST 2019


Is the controller being reported through udev, then?

Does the attached patch improve anything?

On 2/10/19 1:10 PM, Kai Krakow wrote:
> Hello again!
> 
> I'm not sure if this commit is the problem, with it reverted I still
> see strange effects: Moving the left stick only half-way right still
> works correctly, moving it further turns it mirrored into left. Have
> there been any other changes related to this? It worked fine in 4.0,
> and the only other related change I could find here in my system was
> updating from libSDL2-2.0.8 to 2.0.9 but I AFAIR this version still
> worked with 4.0 correctly.
> 
> Thanks,
> Kai
> 
> Am So., 10. Feb. 2019 um 19:02 Uhr schrieb Kai Krakow <kai at kaishome.de>:
>>
>> Hello!
>>
>> This change seems to introduce odd behavior in at least some games:
>> Gamepad axis are mirrored to one side only now. This happens in Shadow
>> of War (found by me) and Rocket League (reported by a user). I expect
>> other games to fail in a similar way but didn't test those yet.
>>
>> I guess the clue is in "_may_ report a logical range"...
>>
>> I'm using the xpadneo driver with an Xbox One S wireless controller,
>> and it reports -32768..32767 according to the driver (which follows
>> the Linux spec on joysticks for this). This used to work perfectly
>> before this change.
>>
>> Regards,
>> Kai
>>
>> Am Mi., 6. Feb. 2019 um 19:42 Uhr schrieb Aric Stewart <aric at codeweavers.com>:
>>>
>>> Signed-off-by: Aric Stewart <aric at codeweavers.com>
>>>
>>> On 2/5/19 1:09 PM, Zebediah Figura wrote:
>>>> From: Zebediah Figura <zfigura at codeweavers.com>
>>>>
>>>> Some controllers (including, with the previous patch, any reported
>>>> through SDL) may report a logical range of [0,65535], which takes up
>>>> 16 bits but should not be sign-extended.
>>>>
>>>> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
>>>> ---
>>>>    dlls/hid/hidp.c | 4 ----
>>>>    1 file changed, 4 deletions(-)
>>>>
>>>> diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c
>>>> index f9978038e3..15d827edf1 100644
>>>> --- a/dlls/hid/hidp.c
>>>> +++ b/dlls/hid/hidp.c
>>>> @@ -277,8 +277,6 @@ NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE Usag
>>>>                                 element->valueStartBit, element->bitCount, &rawValue);
>>>>            if (rc != HIDP_STATUS_SUCCESS)
>>>>                return rc;
>>>> -        if (element->caps.value.BitSize == 16)
>>>> -            rawValue = (short)rawValue;
>>>>            *UsageValue = rawValue;
>>>>        }
>>>>
>>>> @@ -925,8 +923,6 @@ NTSTATUS WINAPI HidP_GetData(HIDP_REPORT_TYPE ReportType, HIDP_DATA *DataList, U
>>>>                                         element->valueStartBit, element->bitCount, &v);
>>>>                    if (rc != HIDP_STATUS_SUCCESS)
>>>>                        return rc;
>>>> -                if (element->caps.value.BitSize == 16)
>>>> -                    v = (short)v;
>>>>                    DataList[uCount].DataIndex = element->caps.value.u.NotRange.DataIndex;
>>>>                    DataList[uCount].u.RawValue = v;
>>>>                }
>>>>
>>>
>>>
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hid_sign_extend.patch
Type: text/x-patch
Size: 1706 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20190210/8934f623/attachment.bin>


More information about the wine-devel mailing list