[SOLVED]usbFunctionSetup to read/write memory
Posted: Sun Aug 09, 2009 12:17 am
I have been trying to read the contents of a specific memory location on an active device using only usbFunctionSetup.
The address is specified by wIndex in usb_control_msg on a simple endpoint 0 in request (based on custom-class example).
All I want is a single uchar value returned in the buffer.
All I get returned in my buffer is zero, even when I know the value is not. I'm sure this must be possible as the CDC-IO example has something like this via telnet.
It is most likely my mis-understaning of usbMsgPtr as my knowledge of C-style casting is a little vague..
Would someone please tell me if or how I could make this work, I'd also like to be able to set values if that's possible.
Thanks in advance.
The address is specified by wIndex in usb_control_msg on a simple endpoint 0 in request (based on custom-class example).
All I want is a single uchar value returned in the buffer.
Code: Select all
usbMsgLen_t usbFunctionSetup(uchar data[8])
{
usbRequest_t *rq = (void *)data;
switch(rq->bRequest)
{
case GET_ADDRESS_VALUE:
usbMsgPtr = (uchar *)((unsigned int)rq->wIndex.word);
return 1;
}
return 0;
}
All I get returned in my buffer is zero, even when I know the value is not. I'm sure this must be possible as the CDC-IO example has something like this via telnet.
It is most likely my mis-understaning of usbMsgPtr as my knowledge of C-style casting is a little vague..
Would someone please tell me if or how I could make this work, I'd also like to be able to set values if that's possible.
Thanks in advance.