discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] patch to get rid of the nastymissing samples usb bug


From: Martin Dvh
Subject: [Discuss-gnuradio] patch to get rid of the nastymissing samples usb bug on windows
Date: Tue, 06 Sep 2005 23:01:52 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5b) Gecko/20030823

Hi all,
At What-the-Hack Stephane and I finally got the usrp driver almost completely 
working on windows.

We knew there still was a bug in our new code because the test_counting.py 
example told us that we still were missing some samples.
It still worked for things like fm-reception (if you miss a few samples you 
still get an audible signal)
But it bothered me because the driver is useless this way for analog-TV and 
digital reception (One of the other things I am working on)

So today I took the time to find and kill this bug once and for all.

Of course it was just a tiny mistake, but aren't they allways.

This makes gnuradio one step closer to being primetime windows ready.

See atachment for the patch and below for changelog.

Greetings,
Martin Dvh

2005-09-06  Martin Dudok van Heel <nldudok1 at olifantasia.com>

        * host/lib/fusb_win32.{cc}: Solved missing samples bug in usb code.
        (Which you could see by running test_counting.py example)

Index: host/lib/fusb_win32.cc
===================================================================
RCS file: /cvsroot/opensdr/usrp/host/lib/fusb_win32.cc,v
retrieving revision 1.2
diff -u -b -B -r1.2 fusb_win32.cc
--- host/lib/fusb_win32.cc      29 Jul 2005 21:14:09 -0000      1.2
+++ host/lib/fusb_win32.cc      6 Sep 2005 20:37:54 -0000
@@ -155,9 +155,9 @@
     return -1;
 
   int bytes_to_write = nbytes;
+  int a=0;
 
   if (d_output_short != 0) {
-       int a;
 
        buf = &d_buffer[d_curr*d_block_size +
                                                d_block_size - d_output_short];
@@ -191,7 +191,7 @@
       }
   }
 
-  memcpy(buf, buffer, bytes_to_write);
+  memcpy(buf, (void *) &(((char*)buffer)[a]), bytes_to_write);
 
   d_output_short = d_block_size - bytes_to_write;
   if (d_output_short == 0)
@@ -214,8 +214,8 @@
 
   int bytes_to_read = nbytes;
 
+  int a=0;
   if (d_input_leftover != 0) {
-       int a;
 
        buf = &d_buffer[d_curr*d_block_size +
                                                d_block_size - 
d_input_leftover];
@@ -244,7 +244,7 @@
        fprintf(stderr, "%s: usb_reap_async: %s\n",
                        __FUNCTION__, usb_strerror());
 
-  memcpy(buffer, buf, bytes_to_read);
+  memcpy((void *) &(((char*)buffer)[a]), buf, bytes_to_read);
 
   d_input_leftover = d_block_size - bytes_to_read;
   if (d_input_leftover == 0)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]