protected override bool TryCreateDevice(object key, out HidDevice device, out object creationState) { creationState = null; var path = (NativeMethods.io_string_t)key; var hidDevice = new MacHidDevice(path); using (var handle = NativeMethods.IORegistryEntryFromPath(0, ref path).ToIOObject()) { if (!handle.IsSet || !hidDevice.GetInfo(handle)) { device = null; return false; } device = hidDevice; return true; } }
protected override bool TryCreateDevice(object key, out HidDevice device, out object creationState) { creationState = null; var path = (NativeMethods.io_string_t)key; var hidDevice = new MacHidDevice(path); using (var handle = NativeMethods.IORegistryEntryFromPath(0, ref path).ToIOObject()) { if (!handle.IsSet || !hidDevice.GetInfo(handle)) { device = null; return(false); } device = hidDevice; return(true); } }