]> sigrok.org Git - libsigrok.git/blobdiff - session_driver.c
HACKING: "Adding a new hardware driver" chapter.
[libsigrok.git] / session_driver.c
index 9f87c8e058f5f040ec87c4c26b3dda98eddad2a7..e73411d521fa0fe74118e4c5df7753367410eec7 100644 (file)
@@ -27,7 +27,9 @@
 #include "libsigrok-internal.h"
 
 /* size of payloads sent across the session bus */
+/** @cond PRIVATE */
 #define CHUNKSIZE (512 * 1024)
+/** @endcond */
 
 struct session_vdev {
        char *sessionfile;
@@ -98,6 +100,7 @@ static int receive_data(int fd, int revents, void *cb_data)
        if (!got_data) {
                packet.type = SR_DF_END;
                sr_session_send(cb_data, &packet);
+               sr_session_source_remove(-1);
        }
 
        return TRUE;
@@ -121,8 +124,6 @@ static int hw_cleanup(void)
        g_slist_free(dev_insts);
        dev_insts = NULL;
 
-       sr_session_source_remove(-1);
-
        return SR_OK;
 }
 
@@ -270,6 +271,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
        return SR_OK;
 }
 
+/** @private */
 SR_PRIV struct sr_dev_driver session_driver = {
        .name = "session",
        .longname = "Session-emulating driver",