Cant manage to receive Report > 8 byte
Posted: Thu May 31, 2007 12:53 am
Hi,
im using ur code for usb implementation and i got a report descriptor like this:
This means, i get 1 byte report-id and another 63 for data usage.
My write function looks like this:
Any suggestions? Im using a windows tool set SET_REPORT and it works out, but it only sets the first 7 byte of data and i cant see why.
Thanks in advance...
im using ur code for usb implementation and i got a report descriptor like this:
Code: Select all
(...)
0x09, 0x00, // USAGE (Undefined)
0xb1, 0x02, // FEATURE (Data,Var,Abs)
0x85, 0x04, // REPORT_ID (4)
0x95, 0x40, // REPORT_COUNT (64)
0x09, 0x00, // USAGE (Undefined)
0xb1, 0x02, // FEATURE (Data,Var,Abs)
This means, i get 1 byte report-id and another 63 for data usage.
Code: Select all
static uchar textBuffPtr=0;
static uchar textBuffer[63]= { ... }
uchar usbFunctionSetup(uchar data[8])
...
} else if (rq->bRequest == USBRQ_HID_SET_REPORT) {
if (rq->wValue.bytes[0] == 4) {
// set 63 byte custom
state = STATE_WRITE_KEYBUFFER; // prepared to receive data
textBuffPtr = 0;
usbWriteLen = rq->wLength.word; // length of Report
return 0xff;
}
...
My write function looks like this:
Code: Select all
uchar usbFunctionWrite(uchar *data, uchar len)
{
uchar i;
if (state == STATE_WRITE_KEYBUFFER) {
if (usbWriteLen == 1+63) // first chunk to receive
{
data++;
len--;
}
// to be safe (###)
if (len > usbWriteLen) len = usbWriteLen;
for(i=0; i<len; i++) {
textBuffPtr++;
textBuffer[textBuffPtr] = data[i];
usbWriteLen--;
}
// return 0 if more data expected
if (usbWriteLen) return 0;
state = STATE_IDLE;
textBuffPtr = 0;
return 1;
}
Any suggestions? Im using a windows tool set SET_REPORT and it works out, but it only sets the first 7 byte of data and i cant see why.
Thanks in advance...