This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

What to do if no data avilable for "usbd_hid_getinreport"

In mdk4.20, the usb device hid class has 3 functions:

extern void usbd_hid_init (void);
extern void usbd_hid_getinreport (U8 *buf);
extern void usbd_hid_setoutreport (U8 *buf);

Problem is usbd_hid_getinreport is called continously, thus I must send back some bytes to host, what to do if there is no data avilable (e.g. key press) for the host?

Thanks.

Parents
  • If I send zero, use the BusHound can see it continous sending 0x00 to host, and host gets lots of 0x00, my host app need to think 0x00 as dummy byte, but what if I really want to send 0x00.

    Not sure if I must send a dummy byte in this case?

    In my last project, I use USB_WriteEP(0x81, buf, 0), set the buffer length to 0, then no data is sent, but now I am using the USB_CM3.lib in MDK 4.20, can not use WriteEP! Is there solution to this?

Reply
  • If I send zero, use the BusHound can see it continous sending 0x00 to host, and host gets lots of 0x00, my host app need to think 0x00 as dummy byte, but what if I really want to send 0x00.

    Not sure if I must send a dummy byte in this case?

    In my last project, I use USB_WriteEP(0x81, buf, 0), set the buffer length to 0, then no data is sent, but now I am using the USB_CM3.lib in MDK 4.20, can not use WriteEP! Is there solution to this?

Children