Big Red Button - Source not working - Looking at wrong byte

Aug 13, 2014 at 3:11 PM
Hi, I wanted to use the DreamCheeky Big Red USB Button to perfom a number of different actions based on the lid and button state. I downloaded the compiled versions but couldn't get any of them to work. So I downloaded the source, specifically the modified version by PiperMatt. Fired it up in Visual Studio 2013 and enabled some tracing to see why it wasn't working. By not working I mean it recognised he device being present, but didn't detect any changes in state.

When the code reads the state of the button I get back:
Read Data=00-15-00-00-00-00-00-00-03

Yet the code in DreamCheekyBigRedBTN.cs and DreamCheekyBTN.cs are looking at the leftmost byte of that returned data, i.e:
return data[0] == Messages.LID_OPEN;
changing this (and other references to data[0] to data[1] i.e
return data[1] == Messages.LID_OPEN;

Fixed the problem and got it working. Great!

I'm a bit new to codeplex and Git so didn't want to submit my changes back without some further understanding as to why the original values had been picked. I see part of the forked code was to change the HID library to one that was x-platform. I'm not sure if the change in library caused the problem, or if on another platform if the value that we care about is in data[0].

Interested in some feedback here, and if I should fork again and submit?