Skip to content

Instantly share code, notes, and snippets.

@cyberzed
Created November 5, 2014 09:17
Show Gist options
  • Save cyberzed/6ad5f1aa7f1a37199455 to your computer and use it in GitHub Desktop.
Save cyberzed/6ad5f1aa7f1a37199455 to your computer and use it in GitHub Desktop.
var devices = new HidEnumerator().Enumerate();
var device = devices.Last();
device.OpenDevice();
var success = device.Write(new byte[]{ 0x00, 0x01, 0x80, 0x33, 0x01, 0x00, 0x00, 0x00, 0x00 });
if(success)
{
var data = device.Read();
data.Dump();
if( data.Data[3] > 128 )
{
(-1 * (256 - (data.Data[3] + (data.Data[4] >> 4) / 16d))).Dump();
}
else
{
(data.Data[3] + (data.Data[4] >> 4) / 16d).Dump();
}
if( data.Data[5] > 128 )
{
(-1 * (256 - (data.Data[5] + (data.Data[6] >> 4) / 16d))).Dump();
}
else
{
(data.Data[5] + (data.Data[6] >> 4) / 16d).Dump();
}
}
device.CloseDevice();
device.Dispose();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment