mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-24 18:02:40 +00:00
tud_hid_generic_get_report_cb and tud_hid_generic_set_report_cb are mandantory
This commit is contained in:
parent
1a0ffcee25
commit
191b73b58c
@ -143,7 +143,16 @@ void usb_hid_task(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t tud_hid_generic_get_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen)
|
||||||
|
{
|
||||||
|
// TODO not Implemented
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void tud_hid_generic_set_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize)
|
||||||
|
{
|
||||||
|
// TODO not Implemented
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// tinyusb callbacks
|
// tinyusb callbacks
|
||||||
|
@ -93,14 +93,20 @@ int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer,
|
|||||||
resplen = 0;
|
resplen = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// negative means error -> tusb could stall and/or response with failed status
|
|
||||||
default: return -1;
|
default:
|
||||||
|
// Set Sense = Invalid Command Operation
|
||||||
|
tud_msc_set_sense(lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00);
|
||||||
|
|
||||||
|
// negative means error -> tinyusb could stall and/or response with failed status
|
||||||
|
resplen = -1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return resplen must not larger than bufsize
|
// return resplen must not larger than bufsize
|
||||||
if ( resplen > bufsize ) resplen = bufsize;
|
if ( resplen > bufsize ) resplen = bufsize;
|
||||||
|
|
||||||
if ( response && resplen )
|
if ( response && (resplen > 0) )
|
||||||
{
|
{
|
||||||
if(in_xfer)
|
if(in_xfer)
|
||||||
{
|
{
|
||||||
|
@ -449,8 +449,8 @@ tusb_error_t hidd_control_request_st(uint8_t rhport, tusb_control_request_t cons
|
|||||||
xferlen = p_hid->get_report_cb(report_id, (hid_report_type_t) report_type, p_hid->report_buf, p_request->wLength);
|
xferlen = p_hid->get_report_cb(report_id, (hid_report_type_t) report_type, p_hid->report_buf, p_request->wLength);
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
|
// For boot Interface only: re-use report_buf -> report has no change
|
||||||
xferlen = p_request->wLength;
|
xferlen = p_request->wLength;
|
||||||
// re-use report_buf -> report has no change
|
|
||||||
}
|
}
|
||||||
|
|
||||||
STASK_ASSERT( xferlen > 0 );
|
STASK_ASSERT( xferlen > 0 );
|
||||||
|
@ -73,9 +73,9 @@
|
|||||||
bool tud_hid_generic_ready(void);
|
bool tud_hid_generic_ready(void);
|
||||||
bool tud_hid_generic_report(uint8_t report_id, void const* report, uint8_t len);
|
bool tud_hid_generic_report(uint8_t report_id, void const* report, uint8_t len);
|
||||||
|
|
||||||
/*------------- Callbacks -------------*/
|
/*------------- Callbacks (Weak is optional) -------------*/
|
||||||
ATTR_WEAK uint16_t tud_hid_generic_get_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen);
|
uint16_t tud_hid_generic_get_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen);
|
||||||
ATTR_WEAK void tud_hid_generic_set_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize);
|
void tud_hid_generic_set_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize);
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// KEYBOARD API
|
// KEYBOARD API
|
||||||
@ -110,7 +110,7 @@ extern const hid_ascii_to_keycode_entry_t HID_ASCII_TO_KEYCODE[128];
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*------------- Callbacks -------------*/
|
/*------------- Callbacks (Weak is optional) -------------*/
|
||||||
|
|
||||||
/** Callback invoked when USB host request \ref HID_REQ_CONTROL_GET_REPORT.
|
/** Callback invoked when USB host request \ref HID_REQ_CONTROL_GET_REPORT.
|
||||||
* \param[in] report_type specify which report (INPUT, OUTPUT, FEATURE) that host requests
|
* \param[in] report_type specify which report (INPUT, OUTPUT, FEATURE) that host requests
|
||||||
@ -172,7 +172,7 @@ static inline bool tud_hid_mouse_button_release(void)
|
|||||||
return tud_hid_mouse_data(0, 0, 0, 0, 0);
|
return tud_hid_mouse_data(0, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*------------- Callbacks -------------*/
|
/*------------- Callbacks (Weak is optional) -------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback function that is invoked when USB host request \ref HID_REQ_CONTROL_GET_REPORT.
|
* Callback function that is invoked when USB host request \ref HID_REQ_CONTROL_GET_REPORT.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user