6 #include "errorstack.hh"
7 #include "radiointerface.hh"
39 bool hid_send_recv(
const unsigned char *data,
unsigned nbytes,
47 static QList<USBDeviceDescriptor>
detect(uint16_t vid, uint16_t pid);
51 int write_read(
const unsigned char *data,
unsigned length,
60 libusb_device_handle *
_dev;
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition: errorstack.hh:41
Specialization to address a HI device uniquely.
Definition: hid_libusb.hh:18
Descriptor(const USBDeviceInfo &info, uint8_t bus, uint8_t device)
Constructor from interface info, bus number and device address.
Definition: hid_libusb.cc:11
Implements the HID radio interface using libusb.
Definition: hid_libusb.hh:12
int write_read(const unsigned char *data, unsigned length, unsigned char *reply, unsigned rlength, const ErrorStack &err=ErrorStack())
Internal used implementation of send_recv().
Definition: hid_libusb.cc:219
libusb_context * _ctx
libusb context.
Definition: hid_libusb.hh:58
unsigned char _receive_buf[42]
Receive buffer.
Definition: hid_libusb.hh:64
ErrorStack _cbError
Internal used error stack for the static callback function.
Definition: hid_libusb.hh:68
libusb_device_handle * _dev
libusb device.
Definition: hid_libusb.hh:60
HIDevice(const USBDeviceDescriptor &descr, const ErrorStack &err=ErrorStack(), QObject *parent=nullptr)
Connects to the device with given vendor and product ID.
Definition: hid_libusb.cc:21
bool hid_send_recv(const unsigned char *data, unsigned nbytes, unsigned char *rdata, unsigned rlength, const ErrorStack &err=ErrorStack())
Send command/data to the device and store response in rdata.
Definition: hid_libusb.cc:177
static void read_callback(struct libusb_transfer *t)
Callback for response data.
Definition: hid_libusb.cc:282
struct libusb_transfer * _transfer
libusb async transfer descriptor.
Definition: hid_libusb.hh:62
bool isOpen() const
Returns true if the connection is established.
Definition: hid_libusb.cc:150
void close()
Close connection to device.
Definition: hid_libusb.cc:155
virtual ~HIDevice()
Destructor.
Definition: hid_libusb.cc:104
volatile int _nbytes_received
Receive result.
Definition: hid_libusb.hh:66
static QList< USBDeviceDescriptor > detect(uint16_t vid, uint16_t pid)
Finds all HID interfaces with the specified VID/PID combination.
Definition: hid_libusb.cc:109
Base class for all radio interface descriptors representing a unique interface to a connected radio.
Definition: usbdevice.hh:197
const QVariant & device() const
Returns the device information identifying the interface uniquely.
Definition: usbdevice.cc:276
Generic information about a possible radio interface.
Definition: usbdevice.hh:121