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/

Parents
  • Hi edvin,

    Thank you for your response.

    with my product already, it can be realized with a driver's unnecessary with a microcomputer manufactured by another vendor.

    The Host OS standard driver will be installed automatically.

    Although the explanation may not be sufficient, it can be realized by describing the descriptor.
    Interface descriptor->bInterfaceClass 0x03(HID)
    Interface descriptor->bInterfaceSubClass 0 (none)
    ReportDescriptor->Usage Page 0x06, 0x00, 0xff, (Vendor Defined)
    ReportDescriptor->Usage Page0x09, 0x01, (Vendor Defined)

    I am assuming an application that creates a host PC application and uses nrf 52840 as a gateway.
    The host PC application communicates with hidapi.dll simply using 1OUT endpoint and 1IN endpoint.


    Best regards,

    junichiro

  • Hello Edvin,

    thanks,

    but , Your understanding is wrong, whether my explanation was missing.

    I'd like use USB-device Peripheral on nrf52840 as a Generic HID class, not over BLE.

    The one that is closest to what I want to achieve in the sample code that is currently published is the project below but it is not the correct answer.

    nRF5_SDK_15.2.0_9412b96\examples\peripheral\usbd_hid_generic

    Best regards,

    junichiro

Reply Children
  • junichiro okabe said:

    The one that is closest to what I want to achieve in the sample code that is currently published is the project below but it is not the correct answer.

    nRF5_SDK_15.2.0_9412b96\examples\peripheral\usbd_hid_generic

     

    "Not the correct answer"? Can you please specify what you mean?

    What exactly is it that you are going to make?

     BR,

    Edvin

  • 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