I made more deep test and I get something working changing like this.
I use one input interrupt endpoint and i use control transaction on endpoint 0 for output.
This is same procedure used in keil example in all hid generic.
I attach following file mouse.c descriptor.h and descriptor.c and usb_framework.c
In file usb_framework.c routine
/**************************************************************************//*!
*
* @name USB_Control_Service
*
* @brief Called upon a completed endpoint 0 (USB 1.1 Chapter 9) transfer
*
* @param event: from Service callback function
*
* @return None
*
*****************************************************************************/
void USB_Control_Service
I think there is a problem
This routine in control output transaction is called 2 times
First time finally is called (at line 415)
/* expecting host to send data (OUT TRANSACTION)*/
(void)usb_device_recv_data(event->handle,
USB_CONTROL_ENDPOINT,(usb_fw_ptr->ext_req_to_host+USB_SETUP_PKT_SIZE),
(uint32_t)(size));
Second time finally is called this routine
data=(usb_fw_ptr->ext_req_to_host+USB_SETUP_PKT_SIZE); // add by Enore
error = usb_fw_ptr->request_notify_callback(
(usb_setup_struct_t*) usb_fw_ptr->ext_req_to_host,
&data,&size,usb_fw_ptr->request_notify_param);
I get callback workin only with my modification
This is working only if I set a breakpoint in mouse.c at this point
case USB_HID_SET_REPORT_REQUEST:
// *data = &g_mouse.rpt_buf[0]; // aggiunta da Enore
for (index = 0; index < MOUSE_BUFF_SIZE; index++)
{ /* copy the report sent by the host */
output_buf[index] = *(*data + index);
}
break; // <-----------------------breakpoint here
I see that output buffer is same as that sent from pc application
If application is running without breakpoint transaction is not working (meaning output buffer doent change)
I cannot understand why