Temporary workaround (until VRT) to stop submitting short packets to libusrp2 tx_raw().
authorjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>
Thu, 16 Jul 2009 17:44:03 +0000 (17:44 +0000)
committerjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>
Thu, 16 Jul 2009 17:44:03 +0000 (17:44 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11449 221aa14e-8319-0410-a670-987f0aec2ac5

gr-usrp2/src/usrp2_sink_16sc.cc
gr-usrp2/src/usrp2_sink_32fc.cc

index 96e6b174c7aa2c9468a6d4b0a41aaa81ba5caa33..1e7c54dcdb16d8c0cb62f0281c39af9303b0c3bf 100644 (file)
@@ -29,6 +29,9 @@
 #include <gr_io_signature.h>
 #include <iostream>
 
+// FIXME hack until VRT replaces libusrp2
+#define U2_MIN_SAMPLES 9
+
 usrp2_sink_16sc_sptr
 usrp2_make_sink_16sc(const std::string &ifc, const std::string &mac_addr) 
   throw (std::runtime_error)
@@ -57,6 +60,12 @@ usrp2_sink_16sc::work(int noutput_items,
 {
   std::complex<int16_t> *in = (std::complex<int16_t> *)input_items[0];
 
+  // FIXME: Current libusrp2 can't handle short packets.
+  // Returning 0 assumes there will be more samples
+  // the next round...
+  if (noutput_items < U2_MIN_SAMPLES)
+    return 0;
+
   usrp2::tx_metadata metadata;
   metadata.timestamp = -1;
   metadata.send_now = 1;
index 6cfff0d758d289fded02b08b46b88d8e3da8677d..b1e28a8297ee83468801a8ebd57a43e916d86938 100644 (file)
@@ -29,6 +29,9 @@
 #include <gr_io_signature.h>
 #include <iostream>
 
+// FIXME hack until VRT replaces libusrp2
+#define U2_MIN_SAMPLES 9
+
 usrp2_sink_32fc_sptr
 usrp2_make_sink_32fc(const std::string &ifc, const std::string &mac_addr) 
   throw (std::runtime_error)
@@ -57,6 +60,12 @@ usrp2_sink_32fc::work(int noutput_items,
 {
   gr_complex *in = (gr_complex *)input_items[0];
 
+  // FIXME: Current libusrp2 can't handle short packets.
+  // Returning 0 assumes there will be more samples
+  // the next round...
+  if (noutput_items < U2_MIN_SAMPLES)
+    return 0;
+
   usrp2::tx_metadata metadata;
   metadata.timestamp = -1;
   metadata.send_now = 1;