cancel
Showing results for 
Search instead for 
Did you mean: 

[USB/STR710] Class control

cgrun
Associate II
Posted on September 19, 2005 at 08:42

[USB/STR710] Class control

6 REPLIES 6
cgrun
Associate II
Posted on September 08, 2005 at 12:39

Hello,

i tried to use the usb library. concerning the enumeration of the device all is ok. But for my peripherial, i need to add some non standard request to the control endpoint.

i see that it's managed by

RESULT MOUSE_Data_Setup(BYTE RequestNo)

i can see that later in the code my CLASS request are here : if i put a printf in ''if (Type_Recipient == (CLASS_REQUEST | INTERFACE_RECIPIENT))...''.

the pInfo struct permit me to get wValue, wIndex, and Wlength of the request but :

a) How can i get the follonwing data of my request ?

b) How can i respond to this request (i need to send back datas. the program is made to send just only text structure using function pointer, but my data doesn't have the size in first byte...

did you have any other example (other than HID mouse) on usb concerning STR7, any other documentation on the USB library (other than the user manual ver 1.0 of the usb library) ?

Chris.

nopti_albe
Associate II
Posted on September 13, 2005 at 11:18

search some more, there is a recent link on this forum for bulk transfers. You cannot simply put data back using that code. You have to keep in mind in a variable that you need to send data and send it later. I have not used USB very much, but i'm sure the bulk example will help you.

cgrun
Associate II
Posted on September 13, 2005 at 11:33

I have ever red the usb bulk example, but the problem is that it's on the endpoint0 that is managed by the library itself.

My need ( get data from a class request / respond to a class request ) is not managed by the library, so if want to access directly it will make that the library will not work ( because the library manage all communication on this endpoint to permit enumeration etc...

This is permit to do that (a specific call in usb_prop.c has been created to do that), but the documentation doesn't explain how to that, and the example just show just the litje that is usefull for HID and BULK.

So i hope that somebody of ST that know this library can respond...

scanlon
Associate II
Posted on September 13, 2005 at 11:51

see the STR71x USB lib document. It describes callback function non-standared (not impemented in standard lib) requests pg12/16.

2.4.3 Device property

The USB core will dispatch the control to user program whenever it is necessary. User handling procedures are given in an array of Device_Property. The structure has the type of DEVICE_PROP:

typedef struct _DEVICE_PROP {

void (*Init)(void);

void (*Reset)(void);

void (*Process_Status_IN)(void);

void (*Process_Status_OUT)(void);

RESULT (*Class_Data_Setup)(BYTE RequestNo);

RESULT (*Class_NoData_Setup)(BYTE RequestNo);

BYTE* (*GetDeviceDescriptor)(WORD Length);

BYTE* (*GetConfigDescriptor)(WORD Length);

BYTE* (*GetStringDescriptor)(WORD Length);

WORD MaxPacketSize;

} DEVICE_PROP;

Application developer must implement a structure having the DEVICE_PROP type in order to manage non standard requests and application specific controls. This structure is available in the application template file “usb_prop.c�

cgrun
Associate II
Posted on September 13, 2005 at 12:23

Exactly,

in RESULT (*Class_Data_Setup)(BYTE RequestNo);

and the pInfo struct i can get the right wValue, wIndex, and Wlength for my specific request

a) but the PC send additionnal data and how can i get this datas ?

b) and in aother request how can i respond to the request because the libs is made to send strings with size in first byte ?

Your remark is right but my problem is to have an example of this function that handle my request. My request has the same behaviour that the standard optionnal request 06/07 Get_Descritor/Set_Descriptor.

Chris

cgrun
Associate II
Posted on September 19, 2005 at 08:42

Does any Moderator can answer to this topics ?

Sincerely

Chris.