// First search for specific Vid/Pid devices
var infoSetsForAllDevices = HIDManager.GetInfoSets();
var infoSetsForASpecificPidVid =
  from info in infoSetsForAllDevices
  where info.Vid == 0x1111
  where info.Pid == 0x2222
  select info;

if (infoSetsForASpecificPidVid.Count() == 0)
{
  return false; // Did not find any device
}

// Use first InfoSet for device creation
var device = new HIDDevice();
device.Init(infoSetsForASpecificPidVid.First().DevicePath);

// Create and send a report
var outputReport = device.CreateOutputReport();
device.SendOutputReport(outputReport);

// Set individual usages
device.SetUsage(my_usagepage, my_usage1);
device.SetUsage(my_usagepage, my_usage2);
device.UnsetUsage(my_usagepage, my_usage3);
device.UnsetUsage(my_usagepage, my_usage4);

Last edited Mar 17, 2012 at 5:52 PM by mrtn, version 2

Comments

No comments yet.