[PATCH v3] winebus.sys: Handle device reports for hidraw devices

Aric Stewart aric at codeweavers.com
Fri Oct 21 00:49:02 CDT 2016



On 10/21/16 7:21 AM, Sebastian Lackner wrote:
> On 21.10.2016 05:39, Aric Stewart wrote:
>>>>
>>>> Another idea we could consider (at least for Linux) would be to
>>>> use wine_server_fd_to_handle(), and then NtReadFile(). This would
>>>> allow to get rid of the thread, and we could use an APC to run
>>>> IoCompleteRequest(). Have you actually looked into that? And
>>>> which mechanism is required on other platforms, do they also
>>>> require a separate thread?
>>>>
>>
>> I have not explored wine_server_fd_to_handle as I was not really
>> aware of it, Mac and IOHID uses a callback, so a run loop thread is
>> needed, but no read of any sort.  If you thinking doing that wine
>> magic is correct then I would be up for exploring it, but it seems
>> like the sort of thing that Alexandre would frown on.
>>
>> -aric
> 
> Well, using async NtReadFile would have the advantage that we can
> start listening for reports at any time, without spawning a thread.
> Nevertheless, if other platforms do not offer some similar mechanism,
> it probably does not make any sense to implement it like that. I'm
> also fine with a thread based approach.
> 
> I would still suggest to do further investigations regarding report
> loss though. If there is not sufficient evidence that this happens
> on Windows aswell, I would still prefer a more reliable Wine
> implementation. MSDN suggests that in order to avoid dropped HID
> reports, applications can try to increase HidD_SetNumInputBuffers -
> but that will obviously not help if we already drop them in the
> lower level drivers. The idea with a simple flags only works if we
> can be sure that the thread runs fast enough to ensure records
> are never dropped. Otherwise a more complicated approach would be
> required.
> 

Yes HidD_SetNumInputBuffers only affects the size of the ring buffer at the upper level HID device.

I my preferences is to go forward with the flag and wait to see if this is really an issue or not and then revisit it if we really see an issue. 

-aric


> Regards,
> Sebastian
> 



More information about the wine-devel mailing list