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

Zebediah Figura z.figura12 at gmail.com
Sun Feb 10 20:39:22 CST 2019

On 2/10/19 8:34 PM, Kai Krakow wrote:
> Hi!
> Am Mo., 11. Feb. 2019 um 03:27 Uhr schrieb Zebediah Figura
> <z.figura12 at gmail.com>:
>> Wine can pick up controllers from udev, either via hidraw or evdev, as
>> well as from SDL. As of bd9e130ee, we shouldn't be using signed offsets
>> anymore when reporting SDL controllers, so I assumed that your
>> controller was coming through hidraw directly.
> Not sure, does the log show this? I'm pretty sure it's going through
> SDL because I can apply SDL controller mappings to it through
> environment.

Log should show this, yes.

>> The symptoms you describe imply that anything above 0x6000 (?) is
>> somehow wrapping around to negative, though that doesn't necessarily
>> make very much sense.
> Indeed, I'm confused too. ;-)

Well, it's close to an explanation. INSIDE, which prompted these 
patches, showed very similar symptoms: the game assumed that the 
controller had a range of 0-32767, and so mapped 0-16383 to "left" and 
16384-32767 to "right", and negative values were interpreted as above 
16384 and therefore also "right". Thus the effect was basically the same 
as you describe, except inverted.

>> Can you provide a log with
>> +hid,+hidp,+hid_report,+rawinput?
> Sure, I'll do. But please wait, I really need some sleep now, this was
> bothering me for a few hours now. ;-)
> Just let me know: Two logs? One with patches reverted and one without?

Just without any patches reverted (so with the bug visible) will 
hopefully be enough.

> Thanks,
> Kai

More information about the wine-devel mailing list