-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HID minidriver module? #69
Comments
Hi, Hans, |
Hi Sam, |
@hansmbakker, can you elaborate on what specific use scenario of HID output reports you think are not supported? Output reports are supported by IOCTL_HID_WRITE_REPORT in HID mini drivers and VHF callback EVT_VHF_ASYNC_OPERATION in VHF source drivers. |
Oh, in that case it is my misunderstanding and then the only limitation imposed by VHF is that it is KMDF-only. Thank you for explaining! I'll update the opening post. |
@hansmbakker Thanks for the reply. Sam and you are right that UMDF support for VHF is a known limitation right now. However, we are actually evaluating that for the coming Windows release. Stay tuned. |
@AndrewYangMSFT that is really good to hear! I know Microsoft presented VHF as the recommended alternative to HID minidrivers but I went for the latter because of its limitation to KMDF. While I really welcome the VHF for UMDF evaluation, I also suspect that will be a long(er)-term solution since it is being evaluated. In this github issue I meant to ask whether there are any nearer-term plans for a solution that works for UMDF, and if not, whether I could help with that in collaboration with you. |
Hi, Hans, |
Hi, Hans, Because there is no clear time line about VHF UMDF support, I am going to try make a Module that acts like vhidmini. I can do it pretty easily. I will try to send a branch with that code that you can use to verify on your end and fix any issues you find. After you are satisfied then either you or i can submit the branch. I think that is the most efficient way to get you up and running. It also provides a nice sample that shows how to convert from a driver to a Module. Disclaimer: This is the plan at this point. There is a possibility something may come up or there might be an issue that cause a delay. |
Hi Sam, |
Hi, Hans, |
Thank you for keeping me updated, Sam! |
Hello, Hans, |
Hello, Hans, I am happy to report that I have created a branch with an initial code for the DMF version of VHIDMINI2. Branch: https://github.com/microsoft/DMF/tree/personal/satertza/vhidmini2 The code basically works but there are some issues with the test application that comes with the original MSDN sample. It runs but shows a few errors. Also, the code needs to be cleaned up for style and formatting as well as general clean up. I have single stepped the code and verified a lot of it.
Note the layering: a. Sample drivers are just containers for DMF_VirtualHidDeviceMiniSample. I will continue working on this branch until I am satisfied that everything is working and the quality of the code is good enough to check in to master and, obviously, it has been code reviewed (following our normal procedures). However, you can use this branch to start working on your driver and see how it goes. If you see things that are obviously wrong, please create a pull request against that branch. I hope this conversion shows you and others the differences between DMF and non-DMF drivers and how to convert non-DMF drivers to DMF drivers. I am sorry for the delay in getting this done...It is not due to negligence...just conflicting priorities. Thank you for your patience. I am interested to get feedback from you. Like i said, I will concentrate on making sure the application works as it is supposed to. |
Hi Sam, I'll let you know my feedback when I've tried it :) |
Hi Sam, |
Hi, Hans, |
Hi, Hans, I have pushed a commit that shows how I prefer to make the HID definitions available to all Clients. I have not been able to make the other changes yet but this was simple so I just got that in. I agree with your other feedback, however. I will not be able to get to it until next week. |
Hi Sam, I’ll wait for your update then, and I am curious how you think the timer code can best be restructured. |
Hi Hans |
Hi Sam, From a functional perspective I'm not sure whether the timer code should be in the HID module or in the driver that calls the HID module? (see my feedback in #73). I noticed when manually queuing HID reports using the function in #73, they were correctly processed immediately (already before the timer expiry function was called). Is that timer expiry function a kind of "cleanup" function? Or is it merely to simulate incoming HID reports? If the latter is the case, then I believe the timer logic should be moved from https://github.com/microsoft/DMF/blob/personal/satertza/vhidmini2/Dmf/Modules.Library/Dmf_VirtualHidDeviceMini.c to https://github.com/microsoft/DMF/blob/personal/satertza/vhidmini2/Dmf/Modules.Template/Dmf_VirtualHidDeviceMiniSample.c I would then keep a function like |
Hi, Hans, I am working on a merge of latest updates to DMF. After that, I will continue to work on the VHIDMINI Module. When, I do so, I will look at your comments and try to address them one way or another. I hope to get back to this today or tomorrow. One more thing: It so happens we are also going to be using the VHIDMINI Module internally so it we can get more feedback as well as actual use here. It should help to resolve many issues you would have encountered. So far the work has been geared toward creating parity with the existing sample. Also, it seems I did not inform your that I had made changes. I don't see the comment on this thread. I thought I had. I will make sure to keep you up to date. Thank you again for your feedback. I will address all your comments and queries above in a separate post when I have more time to consider all your points carefully. |
That’s great to hear! I think more use benefits all :) If there is something I can help with, let me know. |
Hello, Hans. I have good news for you. I have just submitted several changes to the branch to correct the bugs in the code. There are no known bugs at this time. The sample executable that tests the driver appears to be working properly. Also, other people here will begin using DMF_VirtualHidMini so we will get more feedback from them. NOTE: The name of the Modules has changes to VirtualHidMini from VirtualHidDeviceMini per feedback here. The code will go into master via a merge later next week. Now, let me answer your questions from above: You will see in the latest branch that I have made the changes you suggested as I agree with your assessment of how the input report should be handled (by the Client Module). My implementation is slightly different than yours, but it is the same idea. Give me your feedback about it. I will also get feed back here when people use it. Thank you again for your time and feedback. I intended to respond more promptly but I was unable to due to various issues. |
Hi Sam! Nice! I see you’ve done a lot already! Thank you for the nice collaboration so far :) I’m not able to take an in-depth look at it today, probably I can do that tomorrow or during the weekend. |
Hello, Hans, |
Hi Sam, My points of discussion would be the following:
I'm curious to hear your thoughts! I had some guesses why a callback might be needed:
Is this something you could explain more? That way it might be also a point for me to learn. |
Hi, Hans. I was travelling the past 3 days and unable to respond. I will try to answer all your questions later today. They are good questions that I hope will help others understand how DMF works. |
That’s fine, I hope you had a nice trip :) |
Hi Sam, |
Hi, Hans, I apologize again for the delay. I have answered your questions here: It would be nice if the HID definitions from Dmf_VirtualHidDeviceVhf.h could be factored out into a common file (reasoning here), or was that a deliberate choice? Yes, I agree with you that it would be nice to place these definitions in a separate location since they are shared by a subset of Modules. But for right now, lets leave these definitions where they are. We have two classes of definitions right now: 1) Definitions shared by all Modules and 2) Definitions shared by a single Module. There is a place for both those classes. However, in the HID case, it is a different class where the definitions are shared by a subset of Modules (more than one Module). Currently there is no location for such definitions. I will discuss this issue and see if we can find a better way to expose such definitions. I agree with you in principle that right now the solution is not Would it be possible to get the APIs of Dmf_VirtualHidDeviceVhf and Dmf_VirtualHidMini more similar? At the core VHF and VHIDMINI are different. VHF does a lot more and is actually a separate driver. The APIs exposed by DMF are based on the APIs exposed by the core (VHF or VHIDIMIN). Keep in mind that the new Module (DMF_VirtualHidMini) is designed to be a used for User-mode Could you explain why Dmf_VirtualHidDeviceVhf (and Dmf_VirtualHidKeyboard which uses it), just use a direct function call (DMF_VirtualHidDeviceVhf_ReadReportSend) while Dmf_VirtualHidMini uses a callback pattern for Input reports? VHF is much more robust than that VHIDMINI2. VHF performs its own queuing where as VHIDMINI has a simplified queuing system. The purpose of DMF_VirtualHidMini is to simply replicate the functionality of the MSDN VHIDHIMI2 sample so that people can easily used that sample code Being able to call something like GenerateInputReport / DMF_VirtualHidDeviceVhf_ReadReportSend directly instead of using a callback system could result in less "ties" between the Modules and might make keeping the overview simpler. **I hope the above answers answer this question. Having said all of the above: The nice thing about DMF is that if you want to modify the interface (as you indicated in your last point) you can do any of the following:
The short answer to all your questions, it seems, is: DMF_VirtualHidMini is designed as a temporary measure until Microsoft fully unifies VHF for Kernel and User-mode. When that happens this new Module will become deprecated. I am awaiting feedback from others who are using |
Hi Sam, The only thing I do not understand yet is the use of the (maybe this is out of scope for this issue but it made me wonder how these modules work) |
Hello, Hans,
The reason that the DMF_VirtualHidKeyboard does not use that call is that it does not support any calls initiated by VHF. In this Module the calls are initiated by the Client. Note that in this case there is no Let me know if that answers your question. I am happy to elaborate. |
Sounds good 👍 thank you for the explanation! Also good to hear that a team is testing it. Could you please also say something about #67? If the outcome is, that publishing this as a NuGet package is unfeasible, then that could also be an answer (so that it is clear for everyone). Have a good weekend! |
Hi, Hans, |
Ok, I'm curious how you will change it in that case! |
Hello, Hans, |
Hi Sam, |
Hi, Hans, |
Hi, Hans, we have not forgotten about you. We wanted to debug one issue...we are making a merge now...I hope to merge in the update today or tomorrow. Note that the Module is similar to what is in the branch I sent before. |
Hi, Hans, the final PR for VirtualHidMini into master is pending now. I am waiting for one person to approve it...I think by tomorrow it will be in. Thank you for your patience. That code is now being used in a production driver so it does have some milage. |
Hi, Hans.... the DMF_VirtualHidMini and associated sample is in master, finally. Thank you for your patience. Let me know if you have any questions. |
Hi, Hans, |
Hi, Hans, Ok, the sample is there. There was just a mistake in the project file for the library path. I am making a PR for that now. |
Hi, Hans, |
Great @samtertzakian, thank you very much for this! I will certainly include this in my project! |
Great, please refer to the sample: |
I see that vhf can now be used in user mode as well as kernel mode - so this sample is deprecated, right? Where can I find sample code for user mode vhf based driver? |
Hi.
The plan has been to support User-mode VHF in the existing Module and
deprecate the VHidMini.
We can try to that by middle of June. Sorry, it has been on the list for a
while, but other things came up. We bump it up in priority since you
request it.
…On Sun, May 21, 2023, 5:57 PM feature-engineer ***@***.***> wrote:
I see that vhf
<https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/vhf/> can
now be used in user mode as well as kernel mode - so this sample is
deprecated, right? Where can I find sample code for user mode vhf based
driver?
—
Reply to this email directly, view it on GitHub
<#69 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHY5IWRPDZ7IIRNFZI4OAELXHHKIZANCNFSM4H3WL6NQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
This issue is a follow-up to #13.
Currently there is a
Virtual HID Framework
module but it does not support UMDF since VHF only supports KMDF.@samtertzakian could you please comment on these two questions:
I am not a professional driver developer (I am a C# developer), so some best practices that are used in the DMF codebase might be missing from my code.
The text was updated successfully, but these errors were encountered: