Universal Software Radio Peripheral
Functions
usrp_prims_libusb0.cc File Reference
#include "usrp_primsi.h"
#include "usrp_commands.h"
#include <usb.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <ad9862.h>
#include <assert.h>
#include "md5.h"
Include dependency graph for usrp_prims_libusb0.cc:

Functions

struct usb_device * _get_usb_device (struct usb_dev_handle *udh)
struct usb_device_descriptor _get_usb_device_descriptor (struct usb_device *q)
int _get_usb_string_descriptor (struct usb_dev_handle *udh, int index, unsigned char *data, int length)
int _usb_control_transfer (struct usb_dev_handle *udh, int request_type, int request, int value, int index, unsigned char *data, int length, unsigned int timeout)
void usrp_one_time_init (libusb_context **ctx)
 initialize libusb; Behavior differs depending on libusb version
void usrp_deinit (libusb_context *ctx)
 deinitialize libusb
void usrp_rescan ()
struct usb_device * usrp_find_device (int nth, bool fx2_ok_p, libusb_context *ctx)
 locate Nth (zero based) USRP device in system. Return pointer or 0 if not found.
struct usb_dev_handleusrp_open_interface (struct usb_device *dev, int interface, int altinterface)
bool usrp_close_interface (struct usb_dev_handle *udh)
 close interface.
int write_cmd (struct usb_dev_handle *udh, int request, int value, int index, unsigned char *bytes, int len)

Function Documentation

struct usb_device* _get_usb_device ( struct usb_dev_handle udh) [read]
struct usb_device_descriptor _get_usb_device_descriptor ( struct usb_device *  q) [read]
int _get_usb_string_descriptor ( struct usb_dev_handle udh,
int  index,
unsigned char *  data,
int  length 
)

Referenced by usrp_serial_number().

int _usb_control_transfer ( struct usb_dev_handle udh,
int  request_type,
int  request,
int  value,
int  index,
unsigned char *  data,
int  length,
unsigned int  timeout 
)

Referenced by usrp_get_hash(), and usrp_set_hash().

bool usrp_close_interface ( struct usb_dev_handle udh)

close interface.

void usrp_deinit ( libusb_context *  ctx)

deinitialize libusb

libusb-0.1: No effect

libusb-1.0: Deinitialize context ctx

struct usb_device* usrp_find_device ( int  nth,
bool  fx2_ok_p = false,
libusb_context *  ctx = NULL 
) [read]

locate Nth (zero based) USRP device in system. Return pointer or 0 if not found.

The following kinds of devices are considered USRPs:

unconfigured USRP (no firwmare loaded) configured USRP (firmware loaded) unconfigured Cypress FX2 (only if fx2_ok_p is true)

References usrp_fx2_p(), usrp_one_time_init(), and usrp_usrp_p().

void usrp_one_time_init ( libusb_context **  ctx = NULL)

initialize libusb; Behavior differs depending on libusb version

libusb-0.12

Probe busses and devices. The argument is ignored and defaults to NULL. Safe to call more than once.

libusb-1.0

If an location to a libusb_context is passed in, create and write in the new context. If no argument is provided, initialize libusb with the default (NULL) context.

Generally _not_ safe to call more than once with non-NULL argument since a new context will be created each time.

struct usb_dev_handle* usrp_open_interface ( struct usb_device *  dev,
int  interface,
int  altinterface 
) [read]
void usrp_rescan ( )
int write_cmd ( struct usb_dev_handle udh,
int  request,
int  value,
int  index,
unsigned char *  bytes,
int  len 
)