I use this function to send data from my USB device to host PC on BULK IN endpoint:
usb_status_t USB_DeviceSendRequest(usb_device_handle handle, uint8_t endpointAddress, uint8_t *buffer, uint32_t length)
Host PC app reads data using libusb. The app can be suddenly switched off with data send request pending. When the app is launched again, it sends command to my USB device to cancel any pending requests (the app doesn't want to receive any old data, as they are invalid). So, my USB device calls:
usb_status_t USB_DeviceCancel(usb_device_handle handle, uint8_t endpointAddress)
on that BULK IN endpoint. It returns success.
However, when I start to send data on my BULK IN endpoint again, I can see that my app receives also old data from that cancelled request. I assume there is something wrong with USB_DeviceCancel.
How to use USB_DeviceCancel to correctly handle my scenario?