static void Main(string[] args) { var localList = DeviceList.Local; HidStream inData; byte[] mouseBuffer = new byte[128]; //localList. DeviceList deviceList = new FilteredDeviceList(); IEnumerable <Device> attachedDevices = localList.GetAllDevices(); Console.WriteLine(attachedDevices.Count <Device>() + " found"); foreach (Device device in attachedDevices) { Console.WriteLine("Device: " + device.GetFriendlyName()); } IEnumerable <HidDevice> attachedHidDevices = localList.GetHidDevices(); Console.WriteLine(attachedHidDevices.Count <Device>() + " HID found"); foreach (HidDevice device in attachedHidDevices) { Console.WriteLine("Device: " + device.GetFriendlyName()); if (device.GetFriendlyName().ToLower().Contains("mifi")) { inData = device.Open(); inData.BeginRead(mouseBuffer, 0, 128, null, null); string whatRead = BitConverter.ToString(mouseBuffer); Console.WriteLine("What was read: " + whatRead); } } }
static HidStream GetFusionKbdStream() { var loader = new HidDeviceLoader(); var devices = loader.GetDevices(0x1044, 0x7a39); var filteredDeviceList = new FilteredDeviceList(); foreach (var device in devices) { if (device.GetMaxFeatureReportLength() != 0x09) { continue; } HidStream stream; device.TryOpen(out stream); if (stream != null && stream.CanWrite && stream.CanWrite) { return(stream); } } return(null); }