Code: Select all
$ sudo ./hidtool write 0x66,0x66
Error sending message: Connection timed out
error writing data: Communication error with device
Here are the changes I made to the hid-data example main.c:
Code: Select all
#include "ledmatrix7219d88.h"
uint8_t rows[8];
...
uchar usbFunctionWrite(uchar *data, uchar len)
{
uchar i;
if (len > bytesRemaining)
len = bytesRemaining;
bytesRemaining -= len;
for (i = 0; i < len; i++)
rows[currentAddress++] = data[i];
return bytesRemaining;
}
...
usbMsgLen_t usbFunctionSetup(uchar data[8])
{
usbRequest_t *rq = (void *)data;
if((rq->bmRequestType & USBRQ_TYPE_MASK) == USBRQ_TYPE_CLASS){ /* HID class request */
if(rq->bRequest == USBRQ_HID_GET_REPORT){ /* wValue: ReportType (highbyte), ReportID (lowbyte) */
/* since we have only one report type, we can ignore the report-ID */
bytesRemaining = 8;
currentAddress = 0;
return USB_NO_MSG; /* use usbFunctionRead() to obtain data */
}else if(rq->bRequest == USBRQ_HID_SET_REPORT){
/* since we have only one report type, we can ignore the report-ID */
bytesRemaining = 8;
currentAddress = 0;
return USB_NO_MSG; /* use usbFunctionWrite() to receive data from host */
}
}else{
/* ignore vendor type requests, we don't use any */
}
return 0;
}
...
ledmatrix7219d88_setmatrix(0, rows); /*this one added right after the call to usbPoll() in main() */
What am I doing wrong?