@@ -46,12 +46,13 @@ typedef struct
46
46
uint8_t ep_out ; // optional Out endpoint
47
47
uint8_t itf_protocol ; // Boot mouse or keyboard
48
48
49
- uint8_t protocol_mode ; // Boot (0) or Report protocol (1)
50
- uint8_t idle_rate ; // up to application to handle idle rate
51
49
uint16_t report_desc_len ;
50
+ CFG_TUSB_MEM_ALIGN uint8_t protocol_mode ; // Boot (0) or Report protocol (1)
51
+ CFG_TUSB_MEM_ALIGN uint8_t idle_rate ; // up to application to handle idle rate
52
52
53
53
CFG_TUSB_MEM_ALIGN uint8_t epin_buf [CFG_TUD_HID_EP_BUFSIZE ];
54
54
CFG_TUSB_MEM_ALIGN uint8_t epout_buf [CFG_TUD_HID_EP_BUFSIZE ];
55
+ CFG_TUSB_MEM_ALIGN uint8_t ctrl_buf [CFG_TUD_HID_EP_BUFSIZE ];
55
56
56
57
// TODO save hid descriptor since host can specifically request this after enumeration
57
58
// Note: HID descriptor may be not available from application after enumeration
@@ -295,7 +296,7 @@ bool hidd_control_xfer_cb (uint8_t rhport, uint8_t stage, tusb_control_request_t
295
296
uint8_t const report_type = tu_u16_high (request -> wValue );
296
297
uint8_t const report_id = tu_u16_low (request -> wValue );
297
298
298
- uint8_t * report_buf = p_hid -> epin_buf ;
299
+ uint8_t * report_buf = p_hid -> ctrl_buf ;
299
300
uint16_t req_len = tu_min16 (request -> wLength , CFG_TUD_HID_EP_BUFSIZE );
300
301
301
302
uint16_t xferlen = 0 ;
@@ -312,22 +313,22 @@ bool hidd_control_xfer_cb (uint8_t rhport, uint8_t stage, tusb_control_request_t
312
313
xferlen += tud_hid_get_report_cb (hid_itf , report_id , (hid_report_type_t ) report_type , report_buf , req_len );
313
314
TU_ASSERT ( xferlen > 0 );
314
315
315
- tud_control_xfer (rhport , request , p_hid -> epin_buf , xferlen );
316
+ tud_control_xfer (rhport , request , p_hid -> ctrl_buf , xferlen );
316
317
}
317
318
break ;
318
319
319
320
case HID_REQ_CONTROL_SET_REPORT :
320
321
if ( stage == CONTROL_STAGE_SETUP )
321
322
{
322
- TU_VERIFY (request -> wLength <= sizeof (p_hid -> epout_buf ));
323
- tud_control_xfer (rhport , request , p_hid -> epout_buf , request -> wLength );
323
+ TU_VERIFY (request -> wLength <= sizeof (p_hid -> ctrl_buf ));
324
+ tud_control_xfer (rhport , request , p_hid -> ctrl_buf , request -> wLength );
324
325
}
325
326
else if ( stage == CONTROL_STAGE_ACK )
326
327
{
327
328
uint8_t const report_type = tu_u16_high (request -> wValue );
328
329
uint8_t const report_id = tu_u16_low (request -> wValue );
329
330
330
- uint8_t const * report_buf = p_hid -> epout_buf ;
331
+ uint8_t const * report_buf = p_hid -> ctrl_buf ;
331
332
uint16_t report_len = tu_min16 (request -> wLength , CFG_TUD_HID_EP_BUFSIZE );
332
333
333
334
// If host request a specific Report ID, extract report ID in buffer before invoking callback
0 commit comments