#include <string.h>
#include <inttypes.h>
#include <libusb.h>
-#include "config.h"
#include "libsigrok.h"
#include "libsigrok-internal.h"
#include "fx2lafw.h"
static int hw_dev_close(struct sr_dev_inst *sdi);
static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
const void *value);
-static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi,
- void *cb_data);
+static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
/**
* Check the USB configuration to determine if this is an fx2lafw device.
* API callbacks
*/
-static int hw_init(void)
+static int hw_init(struct sr_context *sr_ctx)
{
struct drv_context *drvc;
if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) {
sr_err("fx2lafw: driver context malloc failed.");
- return SR_ERR;
+ return SR_ERR_MALLOC;
}
if (libusb_init(NULL) != 0) {
libusb_device **devlist;
int devcnt, num_logic_probes, ret, i, j;
- /* Avoid compiler warnings. */
(void)options;
+
drvc = fdi->priv;
/* This scan always invalidates any previous scans. */
{
struct timeval tv;
- /* Avoid compiler warnings. */
(void)fd;
(void)revents;
(void)cb_data;
const size_t size = get_buffer_size(devc);
devc->transfers = g_try_malloc0(sizeof(*devc->transfers) * num_transfers);
- if (!devc->transfers)
- return SR_ERR;
+ if (!devc->transfers) {
+ sr_err("fx2lafw: USB transfers malloc failed.");
+ return SR_ERR_MALLOC;
+ }
devc->num_transfers = num_transfers;
}
/* TODO: This stops acquisition on ALL devices, ignoring dev_index. */
-static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
-
- /* Avoid compiler warnings. */
(void)cb_data;
abort_acquisition(sdi->priv);