3 * Copyright 2003 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
27 #include <fusb_generic.h>
31 static const int USB_TIMEOUT = 1000; // in milliseconds
34 fusb_devhandle_generic::fusb_devhandle_generic (usb_dev_handle *udh)
35 : fusb_devhandle (udh)
40 fusb_devhandle_generic::~fusb_devhandle_generic ()
46 fusb_devhandle_generic::make_ephandle (int endpoint, bool input_p,
47 int block_size, int nblocks)
49 return new fusb_ephandle_generic (this, endpoint, input_p,
53 // ----------------------------------------------------------------
55 fusb_ephandle_generic::fusb_ephandle_generic (fusb_devhandle_generic *dh,
56 int endpoint, bool input_p,
57 int block_size, int nblocks)
58 : fusb_ephandle (endpoint, input_p, block_size, nblocks),
64 fusb_ephandle_generic::~fusb_ephandle_generic ()
70 fusb_ephandle_generic::start ()
77 fusb_ephandle_generic::stop ()
84 fusb_ephandle_generic::write (const void *buffer, int nbytes)
86 if (!d_started) // doesn't matter here, but keeps semantics constant
92 return usb_bulk_write (d_devhandle->get_usb_dev_handle (),
93 d_endpoint, (char *) buffer, nbytes, USB_TIMEOUT);
97 fusb_ephandle_generic::read (void *buffer, int nbytes)
99 if (!d_started) // doesn't matter here, but keeps semantics constant
105 return usb_bulk_read (d_devhandle->get_usb_dev_handle (),
106 d_endpoint|USB_ENDPOINT_IN, (char *) buffer, nbytes,