Revision d18fc6f0

b/host/lib/transport/libusb1_zero_copy.cpp
1 1
//
2
// Copyright 2010-2011 Ettus Research LLC
2
// Copyright 2010-2012 Ettus Research LLC
3 3
//
4 4
// This program is free software: you can redistribute it and/or modify
5 5
// it under the terms of the GNU General Public License as published by
......
177 177
        _handle->claim_interface(recv_interface);
178 178
        _handle->claim_interface(send_interface);
179 179

  
180
        //flush the buffers out of the recv endpoint
181
        //limit the flushing to at most one second
182
        for (size_t i = 0; i < 100; i++)
183
        {
184
            unsigned char buff[512];
185
            int transfered = 0;
186
            const int status = libusb_bulk_transfer(
187
                _handle->get(), // dev_handle
188
                (recv_endpoint & 0x7f) | 0x80, // endpoint
189
                static_cast<unsigned char *>(buff),
190
                sizeof(buff),
191
                &transfered, //bytes xfered
192
                10 //timeout ms
193
            );
194
            if (status == LIBUSB_ERROR_TIMEOUT) break;
195
        }
196

  
180 197
        //allocate libusb transfer structs and managed receive buffers
181 198
        for (size_t i = 0; i < get_num_recv_frames(); i++){
182 199

  

Also available in: Unified diff