switch source package format to 3.0 quilt
[debian/gnuradio] / gr-usrp2 / src / usrp2_sink_32fc.cc
index f630c964bbb88cc28e3ec2c249f60b6b3546cb02..b1e28a8297ee83468801a8ebd57a43e916d86938 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
 #include <usrp2_sink_32fc.h>
 #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)
 {
-  return usrp2_sink_32fc_sptr(new usrp2_sink_32fc(ifc, mac_addr));
+  return gnuradio::get_initial_sptr(new usrp2_sink_32fc(ifc, mac_addr));
 }
 
 usrp2_sink_32fc::usrp2_sink_32fc(const std::string &ifc, const std::string &mac_addr) 
@@ -57,12 +60,18 @@ 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;
   metadata.start_of_burst = 1;
 
-  bool ok = d_u2->tx_32fc(0,  // FIXME: someday, streams will have channel numbers
+  bool ok = d_u2->tx_32fc(0, // FIXME: someday, streams will have channel numbers
                          in, noutput_items, &metadata);
   if (!ok){
     std::cerr << "usrp2_sink_32fc: tx_32fc failed" << std::endl;