* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <config.h>
#include <glib.h>
#include <libusb.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
-#include "libsigrok.h"
+#include <libsigrok/libsigrok.h>
#include "libsigrok-internal.h"
#include "protocol.h"
#define USB_INTERFACE 0
#define USB_CONFIGURATION 1
-#define FX2_FIRMWARE FIRMWARE_DIR "/saleae-logic16-fx2.fw"
+#define FX2_FIRMWARE "saleae-logic16-fx2.fw"
#define MAX_RENUM_DELAY_MS 3000
#define NUM_SIMUL_TRANSFERS 32
ret = FALSE;
while (!ret) {
/* Assume the FW has not been loaded, unless proven wrong. */
- if (libusb_get_device_descriptor(dev, &des) != 0)
- break;
+ libusb_get_device_descriptor(dev, &des);
if (libusb_open(dev, &hdl) != 0)
break;
GSList *l, *devices, *conn_devices;
struct libusb_device_descriptor des;
libusb_device **devlist;
- int ret;
unsigned int i, j;
const char *conn;
char connection_id[64];
continue;
}
- if ((ret = libusb_get_device_descriptor(devlist[i], &des)) != 0) {
- sr_warn("Failed to get device descriptor: %s.",
- libusb_error_name(ret));
- continue;
- }
+ libusb_get_device_descriptor(devlist[i], &des);
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
libusb_get_bus_number(devlist[i]),
libusb_get_device_address(devlist[i]), NULL);
} else {
- if (ezusb_upload_firmware(devlist[i], USB_CONFIGURATION,
- FX2_FIRMWARE) == SR_OK)
+ if (ezusb_upload_firmware(drvc->sr_ctx, devlist[i],
+ USB_CONFIGURATION, FX2_FIRMWARE) == SR_OK)
/* Store when this device's FW was updated. */
devc->fw_updated = g_get_monotonic_time();
else
}
for (i = 0; i < device_count; i++) {
- if ((ret = libusb_get_device_descriptor(devlist[i], &des))) {
- sr_err("Failed to get device descriptor: %s.",
- libusb_error_name(ret));
- continue;
- }
+ libusb_get_device_descriptor(devlist[i], &des);
if (des.idVendor != LOGIC16_VID || des.idProduct != LOGIC16_PID)
continue;
break;
case SR_CONF_CAPTURE_RATIO:
devc->capture_ratio = g_variant_get_uint64(data);
- if (devc->capture_ratio > 100) {
- devc->capture_ratio = 0;
- ret = SR_ERR;
- } else
- ret = SR_OK;
+ ret = (devc->capture_ratio > 100) ? SR_ERR : SR_OK;
break;
case SR_CONF_VOLTAGE_THRESHOLD:
g_variant_get(data, "(dd)", &low, &high);