2017-09-11 12:16 PM
Hi there,
I am using STM32CubeMX to develop a USB HID touchscreen with the STM32F103C8T6 MCU.
In the HID descriptor, I must report the following feature to support multi-touch:
0x85, REPORTID_MAX_COUNT, // REPORT_ID (Feature)
0x09, 0x05, // USAGE(Contact Count Maximum)
0x95, 0x01, // REPORT_COUNT (1)
0x25, 0x02, // LOGICAL_MAXIMUM (2)
0xb1, 0x02, // FEATURE (Data,Var,Abs)
Which function should I use to do a USB control request as feature request?
#stm32-hid-usb #usb-hid-getfeature-setfeature #stm32f103c8t6 #usb-hid #stm32cubemx(hal)Solved! Go to Solution.
2017-09-12 10:08 PM
Ah, I misunderstood your question.
I think if the 'Feture report' were sent via contol pipe as described in HID1_11 document, following function would be used.
- USBD_CtlSendData (USBD_HandleTypeDef *pdev, uint8_t *pbuf, uint16_t len)
And it need to be added as class specific request in USBD_CUSTOM_HID_Setup() function like below.
I hope this works for you .
2017-09-12 12:12 AM
Hello,
You can generate a CustomHID project from CubeMX and modify the existing report descriptor(CUSTOM_HID_ReportDesc_FS[]) in 'usbd_custom_hid_if.c'. Than the report descriptor will be transmitted during the enumeration process automatically.
2017-09-12 05:18 AM
Thanks for replying John.
I am able to create a report descriptor and transmit it but the point is that I don't know how to send feature report over usb (which function to use).
For this part of the descriptor:
0x85, REPORTID_MAX_COUNT, // REPORT_ID (Feature)
0x09, 0x05, // USAGE(Contact Count Maximum)
0x95, 0x01, // REPORT_COUNT (1)
0x25, 0x02, // LOGICAL_MAXIMUM (2)
0xb1, 0x02, // FEATURE (Data,Var,Abs)
I must transmit the following structure:
static
const
uint8_t
hid_feature_report[] = {0x02
,//
report id0x05
//
number of contact points};
My question is: Which function should I use to respond to GET_REPORT(feature) requests?
In the HID1_pdf documentation, it is written that:
Only Input reports are sent via the Interrupt In pipe. Feature and
Output reports must be initiated by the host via the Control pipe or an optional Interrupt Out pipe.2017-09-12 10:08 PM
Ah, I misunderstood your question.
I think if the 'Feture report' were sent via contol pipe as described in HID1_11 document, following function would be used.
- USBD_CtlSendData (USBD_HandleTypeDef *pdev, uint8_t *pbuf, uint16_t len)
And it need to be added as class specific request in USBD_CUSTOM_HID_Setup() function like below.
I hope this works for you .
2017-09-18 05:43 PM
Yes I've finally found out. I should have told you.
What you wrote is exactly what I've done and it worked like a charm.
Thanks for your help though!