[LUFA] Processing an HID report

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello All,

I have built a custom uC circuit that I am running the LUFA framework on to interface to my pc as an HID. I have it enumerating and I have a vb.net software app that is able to connect to it. I want to send the LUFA device 3 bytes at a time (address, command, checksum). I am using the atusbhid.dll to do this. My question is, how do I access the bytes within LUFA once I have sent them? This is what I am currently doing:

void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
          const uint8_t ReportID,
          const uint8_t ReportType,
          const void* ReportData,
          const uint16_t ReportSize)
{
Serial_SendData((uint8_t*)ReportData, ReportSize);

HIDReportEcho.ReportID   = ReportID;
HIDReportEcho.ReportSize = ReportSize;
memcpy(HIDReportEcho.ReportData, ReportData, ReportSize);
}

You can see that I am trying to print the report to a pc console to debug. Right now I am just getting garbage. Any ideas as to how to access the report properly if I am doing it wrong? I know the serial is working fine because I can serial_sendByte('A') without any issues.

Chris

Chief Tinkerer

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Right now I am just getting garbage.

Is the data binary or ASCII? If binary you probably need to run it through something like itoa() to make it human readable.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That should be fine. You can remove ALL the "HIDReportEcho" stuff from the demo - making the demos just echo back bytes was a big mistake, as now everyone seems to think it's a mandatory requirement from the driver. The new demo in the latest beta:

https://github.com/abcminiuser/l...

Controls the board LEDs instead to make the operation clearer.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Alright, I got it working. Thanks again! This is my first real USB project from the ground up, so I am slowly trying to wrap my head around it.

Chief Tinkerer