Revision 687e118e

b/host/include/uhd/transport/CMakeLists.txt
27 27
    udp_zero_copy.hpp
28 28
    usb_control.hpp
29 29
    usb_zero_copy.hpp
30
    usb_device_handle.hpp
30 31
    vrt_if_packet.hpp
31 32
    zero_copy.hpp
32 33
    DESTINATION ${INCLUDE_DIR}/uhd/transport
b/host/include/uhd/transport/usb_control.hpp
18 18
#ifndef INCLUDED_UHD_TRANSPORT_USB_CONTROL_HPP
19 19
#define INCLUDED_UHD_TRANSPORT_USB_CONTROL_HPP
20 20

  
21
#include <uhd/config.hpp>
22
#include <uhd/types/usb_descriptor.hpp>
23
#include <boost/utility.hpp>
24
#include <boost/shared_ptr.hpp>
25
#include <vector>
21
#include "usb_device_handle.hpp"
26 22

  
27 23
namespace uhd { namespace transport {
28 24

  
......
35 31
     * This transport is for sending and receiving control information from
36 32
     * the host to device using the Default Control Pipe.
37 33
     *
38
     * \param descriptor a descriptor that identifies a USB device
34
     * \param handle a device handle that uniquely identifies a USB device
39 35
     */
40
    static sptr make(usb_descriptor_t descriptor);
36
    static sptr make(usb_device_handle::sptr handle);
41 37

  
42 38
    /*!
43 39
     * Submit a USB device request:
......
62 58
                          boost::uint16_t index, 
63 59
                          unsigned char *buff,
64 60
                          boost::uint16_t length) = 0; 
65

  
66
    /*!
67
     * Get a vector of USB device descriptors 
68
     *
69
     * \return a vector of usb_descriptors
70
     */
71
    static usb_descriptors_t get_device_list();
72 61
};
73 62

  
74 63
}} //namespace
b/host/include/uhd/transport/usb_device_handle.hpp
1
//
2
// Copyright 2010 Ettus Research LLC
3
//
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
//
17

  
18
#ifndef INCLUDED_UHD_TRANSPORT_USB_DEVICE_HANDLE_HPP
19
#define INCLUDED_UHD_TRANSPORT_USB_DEVICE_HANDLE_HPP
20

  
21
#include <uhd/config.hpp>
22
#include <boost/utility.hpp>
23
#include <boost/shared_ptr.hpp>
24
#include <boost/cstdint.hpp>
25
#include <vector>
26

  
27
namespace uhd { namespace transport {
28

  
29
/*!
30
 * Device handle class that represents a USB device
31
 * Used for identifying devices on the USB bus and selecting which device is
32
 * used when creating a  USB transport. A minimal subset of USB descriptor
33
 * fields are used. Fields can be found in the USB 2.0 specification Table
34
 * 9-8 (Standard Device Descriptor). In addition to fields of the device
35
 * descriptor, the interface returns the device's USB device address.
36
 *
37
 * Note: The USB 2.0 Standard Device Descriptor contains an index rather then
38
 *       a true descriptor serial number string. This interface returns the
39
 *       actual string descriptor.
40
 */
41
class UHD_API usb_device_handle : boost::noncopyable {
42
public:
43
    typedef boost::shared_ptr<usb_device_handle> sptr;
44

  
45
    /*!
46
     * Return the device's serial number 
47
     * \return a string describing the device's serial number
48
     */
49
    virtual UHD_API std::string get_serial() const = 0;
50

  
51
    /*!
52
     * Return the device's Vendor ID (usually assigned by the USB-IF)
53
     * \return a Vendor ID
54
     */
55
    virtual UHD_API boost::uint16_t get_vendor_id() const = 0;
56

  
57
    /*!
58
     * Return the device's Product ID (usually assigned by manufacturer)
59
     * \return a Product ID
60
     */
61
    virtual UHD_API boost::uint16_t get_product_id() const = 0;
62

  
63
    /*!
64
     * Return the device's USB address
65
     * \return a Product ID
66
     */
67
    virtual UHD_API boost::uint16_t get_device_addr() const = 0;
68

  
69
    /*!
70
     * Return a vector of USB devices on this host 
71
     * \return a vector of USB device handles
72
     */
73
    static UHD_API std::vector<usb_device_handle::sptr> get_device_list();
74

  
75
}; //namespace usb
76

  
77
}} //namespace
78

  
79
#endif /* INCLUDED_UHD_TRANSPORT_USB_DEVICE_HANDLE_HPP */
b/host/include/uhd/transport/usb_zero_copy.hpp
18 18
#ifndef INCLUDED_UHD_TRANSPORT_USB_ZERO_COPY_HPP
19 19
#define INCLUDED_UHD_TRANSPORT_USB_ZERO_COPY_HPP
20 20

  
21
#include <uhd/config.hpp>
22
#include <uhd/types/usb_descriptor.hpp>
21
#include "usb_device_handle.hpp"
23 22
#include <uhd/transport/zero_copy.hpp>
24
#include <boost/shared_ptr.hpp>
25 23

  
26 24
namespace uhd { namespace transport {
27 25

  
......
46 44
     * The primary usage for this transport is data transactions.
47 45
     * The underlying implementation may be platform specific.
48 46
     *
49
     * \param descriptor a USB descriptor identifying the device
47
     * \param handle a device handle that uniquely identifying the device
50 48
     * \param rx_endpoint an integer specifiying an IN endpoint number 
51 49
     * \param tx_endpoint an integer specifiying an OUT endpoint number
52 50
     * \param buff_size total number of bytes of buffer space to allocate 
53 51
     * \param block_size number of bytes allocated for each I/O transaction 
54 52
     */
55
    static sptr make(usb_descriptor_t descriptor,
53
    static sptr make(usb_device_handle::sptr handle,
56 54
                     unsigned int rx_endpoint,
57 55
                     unsigned int tx_endpoint,
58 56
		     size_t buff_size = 0, 
b/host/include/uhd/types/CMakeLists.txt
29 29
    stream_cmd.hpp
30 30
    time_spec.hpp
31 31
    tune_result.hpp
32
    usb_descriptor.hpp
33 32
    DESTINATION ${INCLUDE_DIR}/uhd/types
34 33
)
/dev/null
1
//
2
// Copyright 2010 Ettus Research LLC
3
//
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
//
17

  
18
#ifndef INCLUDED_UHD_TYPES_USB_DESCRIPTOR_HPP
19
#define INCLUDED_UHD_TYPES_USB_DESCRIPTOR_HPP
20

  
21
#include <uhd/config.hpp>
22
#include <boost/cstdint.hpp>
23
#include <vector>
24
#include <string>
25

  
26
namespace uhd{
27

  
28
    /*!
29
     * The USB descriptor struct holds identity information for a USB device
30
     */
31
    struct UHD_API usb_descriptor_t{
32
        std::string serial;
33
        boost::uint16_t vendor_id;
34
        boost::uint16_t product_id;
35
        boost::uint16_t device_addr;
36

  
37
        /*!
38
         * Create a pretty print string for this USB descriptor struct.
39
         * \return the printable string
40
         */
41
        std::string to_pp_string(void) const;
42
    };
43

  
44
    //handy typde for a vector of usb descriptors
45
    typedef std::vector<usb_descriptor_t> usb_descriptors_t;
46

  
47
} //namespace uhd
48

  
49
#endif /* INCLUDED_UHD_TYPES_USB_DESCRIPTOR_HPP */

Also available in: Unified diff