X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fbeaglelogic%2Fprotocol.c;h=0fc6f123942c3dce6d6f4bb17571a9745a652c94;hb=6c1a76d1263403f908ac31271a4fd01792488545;hp=2787b9bac9ef56f7c043ab2974a085d45fc63819;hpb=9b2b3ef93e9821ffc9edc1c8bdd929c0143939dd;p=libsigrok.git diff --git a/src/hardware/beaglelogic/protocol.c b/src/hardware/beaglelogic/protocol.c index 2787b9ba..0fc6f123 100644 --- a/src/hardware/beaglelogic/protocol.c +++ b/src/hardware/beaglelogic/protocol.c @@ -1,7 +1,7 @@ /* * This file is part of the libsigrok project. * - * Copyright (C) 2014 Kumar Abhishek + * Copyright (C) 2014-17 Kumar Abhishek * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -99,7 +99,7 @@ SR_PRIV int beaglelogic_native_receive_data(int fd, int revents, void *cb_data) if ((devc->offset += packetsize) >= devc->buffersize) { /* One shot capture, we abort and settle with less than * the required number of samples */ - if (devc->triggerflags) + if (devc->triggerflags == BL_TRIGGERFLAGS_CONTINUOUS) devc->offset = 0; else packetsize = 0; @@ -181,7 +181,7 @@ SR_PRIV int beaglelogic_tcp_receive_data(int fd, int revents, void *cb_data) if ((devc->offset += packetsize) >= devc->buffersize) { /* One shot capture, we abort and settle with less than * the required number of samples */ - if (devc->triggerflags) + if (devc->triggerflags == BL_TRIGGERFLAGS_CONTINUOUS) devc->offset = 0; else packetsize = 0; @@ -194,6 +194,10 @@ SR_PRIV int beaglelogic_tcp_receive_data(int fd, int revents, void *cb_data) /* Send EOA Packet, stop polling */ std_session_send_df_end(sdi); devc->beaglelogic->stop(devc); + + /* Drain the receive buffer */ + beaglelogic_tcp_drain(devc); + sr_session_source_remove_pollfd(sdi->session, &devc->pollfd); }