demo/python/mmap.py: Fix buffer wraparound bug.
authorIan Abbott <abbotti@mev.co.uk>
Thu, 10 May 2012 12:49:57 +0000 (13:49 +0100)
committerIan Abbott <abbotti@mev.co.uk>
Thu, 10 May 2012 12:49:57 +0000 (13:49 +0100)
Fix bug reported by Ross Williamson where the code does not deal with
buffer wraparound within a chunk of data.

demo/python/mmap.py

index 65f9f82948dea2024ce9c674e2fbe07eacd13ea3..07652ba5ae4b8ec878b510de53bdad13ba81a0a7 100755 (executable)
@@ -185,6 +185,8 @@ while flag:
        map.seek(back%size)
        for i in range(back,front,2):
                DATA.fromstring(map.read(2))
+               if map.tell() == size:
+                       map.seek(0)
        DATA.tofile(of) # append data to log file
 ##     time.sleep(.01)
        ret = c.comedi_mark_buffer_read(dev, subdevice, front-back)