forderud / IntelliMouseDriver

Filter drivers for Microsoft Pro IntelliMouse that implements safety checks and exposes a WMI interface
MIT License
1 stars 1 forks source link

Add timer for turning the tail-light off when connecting mouse #39

Closed forderud closed 8 months ago

forderud commented 8 months ago

Done to initialize the HW to a known state. Fixes #35 and #32.

LIMITATION: The SetFeatureColor(device, 0) call seem to fail sporadically, around 5% of the time. Timer callback invocation should therefore probably be deferred somehow, but I haven´t yet figured out what should be the triggering event.

WinDbg output

WinDbg debugging extract while attaching the mouse:

TailLight: DriverEntry - WDF version built on Jan 19 2024 05:50:05
TailLight: PdoName: \Device\000000c3
DimpHidAddDevice: Failed to open device \\?\HID#VID_045E&PID_082A&MI_00&Col01#7&bb7cab7&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} (err=5).
DimpHidAddDevice: Failed to open device \\?\HID#VID_045E&PID_082A&MI_01&Col01#7&181f730b&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\KBD (err=5).
TailLight: EvtSetBlackTimer begin
TailLight: SetFeatureColor
TailLight: ProductID=82a, VendorID=45e, VersionNumber=149, DescriptorSize=476
TailLight: SetFeatureFilter
TailLight: EvtSetBlackTimer end

The DimpHidAddDevice errors also occur without these changes, and can probably be disregarded.

forderud commented 8 months ago

@ManOnTheMountainTech Can you please test and review this proposal?

ManOnTheMountainTech commented 8 months ago

2: kd> g TailLight: DriverEntry - WDF version built on Jan 22 2024 09:09:09 TailLight: PdoName: \Device\00000066 TailLight: EvtSetBlackTimer begin TailLight: SetFeatureColor TailLight: WdfIoTargetOpen failed 0xc000000e -> STATUS_NO_SUCH_DEVICE TailLight: EvtSetBlackTimer failure NTSTATUS=0xc000000e DispBroker.Desktop.dll: 01/22/24 09:39:17 Pacific Standard Time: SessionHandlerBase::EvaluateTargets found new target Concerning target: Id=0x3060b00, Adapter=aacd connected to {DELA017CC3026B21Y9S _2C_07D6_9E} DfsDs RPC server started. util Info Mon Jan 22 2024 09:39:20 [5008:05012] [40ms] Logging to: C:\Windows\TEMP\com.logi.optionsplus.updater.logs\20240122T173920-updater-5008.log Attribute Qt::AAEnableHighDpiScaling must be set before QCoreApplication is created. util Info Mon Jan 22 2024 09:39:22 [6232:06236] [439ms] Logging to: C:\Users\Bryan\AppData\Local\Temp\com.logi.optionsplus.agent.logs\20240122T173922-agent-6232.log LampArray: Package identity is required to support ambient lighting.Populating UpdatePolicy AllowListSKU MDM licensing allow list string from SLAPI: AboveLock|Accounts|ActiveXControls|ADMXIngest|AllowMessageSync|AppHVSI|ApplicationDefaults|AllowAllTrustedApps|AllowAppStoreAutoUpdate|AllowAutomaticAppArchiving|AllowDeveloperUnlock|AllowGameDVR|AllowSharedUserAppData|ApplicationRestrictions|Audit|ConfigureChatIcon|LaunchAppAfterLogOn|MSIAllowUserControlOverInstall|MSIAlwaysInstallWithElevatedPrivileges|RestrictAppDataToSystemVolume|RestrictAppToSystemVolume|AppRuntime|AttachmentManager|Authentication|Autoplay|BitLocker|BITS|Bluetooth|Browser|Camera|Cellular|CloudDesktop|Connectivity|ControlPolicyConflict|CredentialProviders|CredentialsDelegation|CredentialsUI|Cryptography|DataProtection|DataUsage|Defender|DeliveryOptimization|Desktop|DesktopAppInstaller|ConfigureSystemGuardLaunch|EnableVirtualizationBasedSecurity|DeviceHealthMonitoring|DeviceInstallation|DeviceLock|Display|DmaGuard|ErrorReporting|Eap|Education|EnterpriseCloudPrint|EventLogService|AllowClipboardHistory|AllowCopyPaste|AllowCortana|AllowDeviceDiscovery|AllowManualMDMUnenrollment|AllowSaveAsOfOfficeFiles|AllowScreenCapture|AllowSharingOfOfficeFiles|AllowSIMErrorDialogPromptWhenNoSIM|AllowSyncMySettings|AllowTailoredExperiencesWithDiagnosticData|AllowTaskSwitcher|AllowThirdPartySuggestionsInWindowsSpotlight|AllowVoiceRecording|DoNotShowFeedbackNotifications|DoNotSyncBrowserSettings|AllowFindMyDevice|ExploitGuard|FederatedAuthentication|Feeds|FileExplorer|FileSystem|Games|Handwriting|HumanPresence|InternetExplorer|Kerberos|KioskBrowser|Knobs|LanmanWorkstation|Licensing|LocalPoliciesSecurityOptions|LocalSecurityAuthority|LocalUsersAndGroups|Lockdown|Maps|MemoryDump|MSSecurityGuide|MSSLegacy|Multitasking|NetworkIsolation|NetworkListManager|NewsAndInterests|Notifications|OneDrive|Power|Printers|Privacy|RemoteAssistance|RemoteDesktopServices|RemoteDesktop|RemoteManagement|RemoteProcedureCall|RemoteShell|RestrictedGroups|Search|Security|Settings|SettingsSync|SmartScreen|Speech|Start|Storage|System|SystemServices|TaskManager|TaskScheduler|TenantRestrictions|TextInput|TimeLanguageSettings|Troubleshooting|Update|UserRights|VirtualizationBasedTechnology|WebThreatDefense|WiFi|WindowsLogon|WirelessDisplay|Location|WindowsAI|WindowsAutopilot|WindowsConnectionManager|WindowsDefenderSecurityCenter|WindowsInkWorkspace|WindowsPowerShell|WindowsSandbox|WiredNetwork|ADMX All policies are allowed StartDocked.LauncherFrame TailLight: SetFeatureFilter TailLight: TailLightReport: Unknown control Code 0xaf 0x0 TailLight: SetFeatureFilter TailLight: TailLightReport: Unknown control Code 0xb1 0x0 TailLight: SetFeatureFilter TailLight: TailLightReport: Unknown control Code 0x99 0x0 TailLight: SetFeatureFilter TailLight: TailLightReport: Unknown control Code 0xbd 0x1 TailLight: SetFeatureFilter TailLight: TailLightReport: Unknown control Code 0xbd 0x1 TailLight: SetFeatureFilter TailLight: TailLightReport: Unknown control Code 0xbd 0x1 TailLight: SetFeatureFilter TailLight: TailLightReport: Unknown control Code 0xb6 0x0 TailLight: SetFeatureFilter TailLight: TailLightReport: Unknown control Code 0x97 0x0 TailLight: SetFeatureFilter TailLight: TailLightReport: Unknown control Code 0x82 0x0

forderud commented 8 months ago

Comment from Bryan Allen Young: I took your code and set the delay to 100. That worked on my test machine.

I also tried the remote device open path i.e. WdfIoTargetCreateDevice(). The open request fails in FxIoTargetRemote::OpenTargetHandle at the ZwCreateFile() call. 

What we really need is a way to test if DO_DEVICE_INITIALIZING is cleared so that there is no delay.

forderud commented 8 months ago

Merging proposal after adjusting the delay to 100ms and receiving confirmation that it now works for both me and Bryan Allen Young.