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

USB custom (Vendor-Defined) HID device

Hi,

Is there a usb hidapi sample code for nrf52840 somewhere?

I know that there is a sample code of usbd_cdc_acm.
Using the HIDAPI library link below , It will be beneficial if the device is recognized as Vendor-Defined HID devices.
 It is no longer need a device driver.
 In addition, It is  not have to deal with changing port numbers.


http://www.signal11.us/oss/hidapi/

  • The sample provided is a code that runs as a mouse.

    My expectation is to send and receive 64 bytes per packet of UART like simple  communication with a PC.

    However, I found that there is source code  shown below that are helpful in the project provided.
    It seems to be realized by changing this.

    nRF5_SDK_15.2.0_9412b96\components\libraries\usbd\class\hid\generic\app_usbd_hid_generic.c

    thanks.

    BR,

    junichiro

  • The generic (vendor defined) HID class is an efficient method of creating bidirectional data pipes. It uses the HID drivers already built into the OS of pretty much any style of PC, I don't know about tablets and phones. It's nice because you don't need an INF or anything like for use on a Windows PC and accessing the device by a PC application is pretty straightforward. The HID report specifies what the data pipes look like, but it should not be confused with the more specific keyboard, mouse, joystick, etc.

    I think the confusion here is whether the OP is talking about

    • making a hardware generic-USB-HID-peripheral connected to the nRF (nRF is USB host), or
    • whether the nRF is part of a BLE thing that looks like a generic HID USB device over the air to a PC or whatever.

    I'm working on the latter but am only at the learning phase of BLE. In either case it assumes that

    • the nRF USB host can talk to a generic vendor defined HID device that's not a keyboard, etc., or
    • whether the BLE spec and implementation supports a generic vendor defined HID device from the BLE peripheral through to a PC's OS (for example). A lot of elements need to align in this case.
Related