This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

USB HID, OS X and APP_USBD_HID_USER_EVT_IN_REPORT_DONE bug or unexpected behaviour

Hello,

our application requires to emulate keyboard, e.g. to write strings like "hello world\n" as it might be typed by the keyboard. According to the recommendations in this topic:

devzone.nordicsemi.com/.../writing-words-to-usb-composite-keyboard-in-usbd_hid_composite

we implemented nrf_queue of keyboard codes & modifiers:

app_usbd_hid_kbd_codes_t
app_usbd_hid_kbd_modifier_t


For example to encode char "A", it pushes to the queue the following codes & modifiers:

1) press "Shift"

2) press "A"

3) release "A"

4) release "Shift"

We send 1 code\modifier at once and then wait for APP_USBD_HID_USER_EVT_IN_REPORT_DONE. Right after we receive this event, we send the next code or modifier.

This works perfectly on Windows and Linux. However on Mac OS the behaviour is absolutely different. When we plug the device via USB, we constantly receive APP_USBD_HID_USER_EVT_IN_REPORT_DONE, however no real data being sent through HID key_control\modifier_set_state functions. Once we try to send smth, these events either disappears at all or randomly generated\not generated. We assume it should be a bug or the API is not working as expected.

Additional question: does our type of application should wait for APP_USBD_HID_USER_EVT_IN_REPORT_DONE for both

app_usbd_hid_kbd_key_control
app_usbd_hid_kbd_modifier_state_set


or only for key_control functions?

Related