Support about USB HID Receive Data from PC in nRF52840

Now, I use USB for transfer and receive data with PC. But when I use the example zephyr/samples/subsys/usb/hid : https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/usb/hid. It only have transfer data from chip to PC and not to receive. I try to many ways but it don't work. I don't read anything. 

Now, I use NCS v 2.3.0 for code and VS Code for my project.

Please so help me. 

Parents
  •   Hello, I have a trouble and I need your help. Now, I have to get FEATURE Report from host ( PC ) to nRF52 chip. I use get_report and set_report. But it don't work. Please help me. 

    Now, my code is:

    static int get_report(const struct device *dev, struct usb_setup_packet *setup, int32_t *len_to_set,
                  uint8_t **data)
    {
        printk("Get_Report\n");
        return -ENOTSUP;
    }

    static int set_report(const struct device *dev, struct usb_setup_packet *setup, int32_t *len,
                  uint8_t **data)
    {
        printk("Set_Report\n");
        return -ENOTSUP;
    }
    static const struct hid_ops ops = {
        .int_in_ready = int_in_ready_cb,
        .on_idle = on_idle_cb,
        .protocol_change = protocol_cb,
        .int_out_ready = int_out_ready_cb,
        .get_report = get_report,
        .set_report = set_report,
    };
    This is my prj.conf:
    CONFIG_USB_DEVICE_STACK=y
    CONFIG_USB_DEVICE_HID=y
    CONFIG_USB_DEVICE_PRODUCT="Zephyr HID sample"
    CONFIG_USB_DEVICE_PID=0x0006
    CONFIG_USB_HID_BOOT_PROTOCOL=y
    CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n

    CONFIG_LOG=y
    CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
    CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y

    CONFIG_USB_DEVICE_SOF=y
    CONFIG_USB_HID_REPORTS=1

    CONFIG_ENABLE_HID_INT_OUT_EP=y
Reply
  •   Hello, I have a trouble and I need your help. Now, I have to get FEATURE Report from host ( PC ) to nRF52 chip. I use get_report and set_report. But it don't work. Please help me. 

    Now, my code is:

    static int get_report(const struct device *dev, struct usb_setup_packet *setup, int32_t *len_to_set,
                  uint8_t **data)
    {
        printk("Get_Report\n");
        return -ENOTSUP;
    }

    static int set_report(const struct device *dev, struct usb_setup_packet *setup, int32_t *len,
                  uint8_t **data)
    {
        printk("Set_Report\n");
        return -ENOTSUP;
    }
    static const struct hid_ops ops = {
        .int_in_ready = int_in_ready_cb,
        .on_idle = on_idle_cb,
        .protocol_change = protocol_cb,
        .int_out_ready = int_out_ready_cb,
        .get_report = get_report,
        .set_report = set_report,
    };
    This is my prj.conf:
    CONFIG_USB_DEVICE_STACK=y
    CONFIG_USB_DEVICE_HID=y
    CONFIG_USB_DEVICE_PRODUCT="Zephyr HID sample"
    CONFIG_USB_DEVICE_PID=0x0006
    CONFIG_USB_HID_BOOT_PROTOCOL=y
    CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n

    CONFIG_LOG=y
    CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
    CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y

    CONFIG_USB_DEVICE_SOF=y
    CONFIG_USB_HID_REPORTS=1

    CONFIG_ENABLE_HID_INT_OUT_EP=y
Children
Related