Hello folks.
I need to create virtual mouse device that will contain two features: ability of setting coordinates and clicking (pretty standard thing isn’t it?).
I decided to modify vhidmini sample, as it seem to fit to my requirements. What I did till now:
- I found HID spec for mouse.
- Modified report descriptor to fit to mouse class HID spec
- Prepared structures and modifed code to react accrodingly to reports
Issue I have now is with installation of this driver.
Here is my INF:
===================================================== STARTof INF =====================================================
;/++
;
;Copyright (c) Microsoft Corporation All rights Reserved
;
;Module Name:
;
; vihidmini.inf
;
;Abstract:
; INF file for installing HID minidriver (KMDF version)
;
;Installation Notes:
; Using Devcon: Type “devcon install vhidmini.inf root\vhidmini” to install
;
;–/
[Version]
Signature=“$WINDOWS NT$”
Class=Mouse
ClassGUID={4d36e96f-e325-11ce-bfc1-08002be10318}
Provider=%ProviderString%
DriverVer = 12/22/2018,23.12.1.10
CatalogFile=wudf.cat
; ================= Class section =====================
;[ClassInstall32]
;Addreg=SampleClassReg
;[SampleClassReg]
;HKR,0,%ClassName%
;HKR,Icon,-5
; ================= Device section =====================
[Manufacturer]
%ManufacturerString%=Microsoft,NTx86.6.1
; Works on Win7 and later because we use inbox HID-KMDF mapper
[Microsoft.NTx86.6.1]
%DeviceDesc%=vhidmini,{4d36e96f-e325-11ce-bfc1-08002be10318}\vhidmini
[vhidmini.NT]
CopyFiles=KMDriverCopy
[vhidmini.NT.hw]
AddReg=vhidmini_AddReg
[vhidmini.NT.Services]
AddService=vhidmini,0,vhidmini_Service_Inst,
AddService=mshidkmdf,0x00000002,mshidkmdf_Service_Inst ;flag 0x2 sets this as the service for the device
[vhidmini_AddReg]
HKR,“LowerFilters”,0x00010008,“vhidmini” ; FLG_ADDREG_TYPE_MULTI_SZ | FLG_ADDREG_APPEND
[mshidkmdf_Service_Inst]
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\mshidkmdf.sys
[vhidmini_Service_Inst]
DisplayName = %ServiceDesc%
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\vhidmini.sys
[vhidmini.NT.Wdf]
KmdfService=vhidmini, vhidmini_wdfsect
[vhidmini_wdfsect]
KmdfLibraryVersion=1.9
; ================= copy files =====================
[KMDriverCopy]
vhidmini.sys
[SourceDisksNames]
1=%DiskDesc%,
[SourceDisksFiles]
vhidmini.sys=1
[DestinationDirs]
KMDriverCopy=12
;---------------------------------------------------------------;
[Strings]
ProviderString = “TODO-Set-Provider”
ManufacturerString = “TODO-Set-Manufacturer”
ClassName = “Sample Device”
DeviceDesc = “HID minidriver (KMDF version) Device virtual MOUSE”
ServiceDesc = “HID minidriver (KMDF version) Service”
DiskDesc = “HID minidriver (KMDF version) Installation Disk”
===================================================== END of INF =====================================================
way Im installing driver is:
devcon install vhidmini.inf “{4d36e96f-e325-11ce-bfc1-08002be10318}\vhidmini”
Driver is installing, and in device manager I see device under MOUSE node, but additionally in “Other devices” group I see “unknown device” that is created along with my driver.
It appears to be related with report descriptor as if I change it for test to one from sample it is working. Here is my descriptor:
HID_REPORT_DESCRIPTOR G_DefaultReportDescriptor = {
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x02, // USAGE (Mouse)
0xA1, 0x01, // COLLECTION (Application)
0x09, 0x01, // USAGE_PAGE (Pointer)
0xA1, 0x00, // COLLECTION (Physical)
0x05, 0x09, // USAGE_PAGE (Buttons)
0x19, 0x01, // USAGE_MINIMUM (1)
0x29, 0x03, // USAGE_MAXIMUM (3)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x95, 0x03, // REPORT_COUNT (3)
0x75, 0x01, // REPORT_SIZE (1)
0x81, 0x02, // INPUT (Data, Variable, Absolute) ; 3 button bits
0x95, 0x01, // REPORT_COUNT (1)
0x75, 0x05, // REPORT_SIZE (5)
0x81, 0x01, // INPUT (Constant)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x30, // USAGE (X)
0x09, 0x31, // USAGE (Y)
0x15, 0x81, // LOGICAL_MINIMUM (-127)
0x25, 0x7F, // LOGICAL_MAXIMUM (127)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x02, // REPORT_COUNT (2)
0x81, 0x06, // Input (Data, Variable, Relative) ; 2 position bytes (X&Y)
0xC0, // END_COLLECTION
0xC0, // END_COLLECTION
};
in Logs I see “no hardware id found”.
Can you please point me some directions I should follow to go further?
Thanks for help,
JJ