cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_PCD_EP_Transmit could not transmit on IN EP 0x81 for custom HID

BSchm.0
Associate II

Hello USB HID gurus !

How I can send on IN endpoint 0x81 for HID Custom Descriptor with HAL ?

I use USBD_CUSTOM_HID_SendReport

and endpoint is 0x81 until 

#define EP_ADDR_MSK              0xFU

I can see my report data on USB Bus Analyzer at OUT EP 0x1 and not on IN EP 0x81

function call is with ep_addr = 0x81 but with mask we get 0x1

But application is listening at /dev/hidraw1 at IN EP 0x81

see line 20

/**
  * @brief  Send an amount of data
  * @param  hpcd PCD handle
  * @param  ep_addr endpoint address
  * @param  pBuf pointer to the transmission buffer
  * @param  len amount of data to be sent
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_PCD_EP_Transmit(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len)
{
  PCD_EPTypeDef *ep;
 
  ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK];
 
  /*setup and start the Xfer */
  ep->xfer_buff = pBuf;
  ep->xfer_len = len;
  ep->xfer_count = 0U;
  ep->is_in = 1U;
  ep->num = ep_addr & EP_ADDR_MSK;
 
  if (hpcd->Init.dma_enable == 1U)
  {
    ep->dma_addr = (uint32_t)pBuf;
  }
 
  if ((ep_addr & EP_ADDR_MSK) == 0U)
  {
    (void)USB_EP0StartXfer(hpcd->Instance, ep, (uint8_t)hpcd->Init.dma_enable);
  }
  else
  {
    (void)USB_EPStartXfer(hpcd->Instance, ep, (uint8_t)hpcd->Init.dma_enable);
  }
 
  return HAL_OK;
}

Changing mask to 0xFF enumeration fails; descriptor exchange should run on OUT EP 0x1 and not on 0x81

Any one using HID custom with success on /dev/hidraw1 in linux ?

0 REPLIES 0