X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=blobdiff_plain;f=ftdi%2Fftdi.c;h=defd2787ba262a5c2ec8ab0b92bd7819bc3d3da1;hp=fb2adbfd50ecba4a850c593ffde4bb22339744af;hb=a60be878a392a04dced55c413d449144c5d97171;hpb=cd14efd85a8abe021116e68fac60a68214f7ef10 diff --git a/ftdi/ftdi.c b/ftdi/ftdi.c index fb2adbf..defd278 100644 --- a/ftdi/ftdi.c +++ b/ftdi/ftdi.c @@ -102,6 +102,19 @@ int ftdi_usb_reset(struct ftdi_context *ftdi) { return 0; } +int ftdi_usb_purge_buffers(struct ftdi_context *ftdi) { + if (usb_control_msg(ftdi->usb_dev, 0x40, 0, 1, 0, NULL, 0, ftdi->usb_timeout) != 0) { + ftdi->error_str = "FTDI purge of RX buffer failed"; + return -1; + } + + if (usb_control_msg(ftdi->usb_dev, 0x40, 0, 2, 0, NULL, 0, ftdi->usb_timeout) != 0) { + ftdi->error_str = "FTDI purge of TX buffer failed"; + return -1; + } + + return 0; +} /* ftdi_usb_close return codes 0: all fine