X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fchronovu-la%2Fapi.c;h=3bf5609544763b13f37d7aff975083eac1cdbc54;hb=ca314e060f653e6a0b5ec0f58914bac4d426217f;hp=d9913adbc619244c8381eedbc83ec011387ae00e;hpb=e66d1892d0dd16ed166fc8f13493f95de0607362;p=libsigrok.git diff --git a/src/hardware/chronovu-la/api.c b/src/hardware/chronovu-la/api.c index d9913adb..3bf56095 100644 --- a/src/hardware/chronovu-la/api.c +++ b/src/hardware/chronovu-la/api.c @@ -20,14 +20,14 @@ #include #include "protocol.h" -static const uint32_t drvopts[] = { - SR_CONF_LOGIC_ANALYZER, -}; - static const uint32_t scanopts[] = { SR_CONF_CONN, }; +static const uint32_t drvopts[] = { + SR_CONF_LOGIC_ANALYZER, +}; + static const uint32_t devopts[] = { SR_CONF_LIMIT_MSEC | SR_CONF_SET, SR_CONF_LIMIT_SAMPLES | SR_CONF_SET | SR_CONF_LIST, @@ -65,7 +65,6 @@ static int add_device(int model, struct libusb_device_descriptor *des, ret = SR_OK; - /* Allocate memory for our private device context. */ devc = g_malloc0(sizeof(struct dev_context)); /* Set some sane defaults. */ @@ -97,7 +96,6 @@ static int add_device(int model, struct libusb_device_descriptor *des, /* We now know the device, set its max. samplerate as default. */ devc->cur_samplerate = devc->prof->max_samplerate; - /* Register the device with libsigrok. */ sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; sdi->vendor = g_strdup("ChronoVu"); @@ -231,7 +229,6 @@ static int dev_open(struct sr_dev_inst *sdi) devc = sdi->priv; - /* Allocate memory for the FTDI context and initialize it. */ if (!(devc->ftdic = ftdi_new())) { sr_err("Failed to initialize libftdi."); return SR_ERR; @@ -240,7 +237,6 @@ static int dev_open(struct sr_dev_inst *sdi) sr_dbg("Opening %s device (%04x:%04x).", devc->prof->modelname, devc->usb_vid, devc->usb_pid); - /* Open the device. */ if ((ret = ftdi_usb_open_desc(devc->ftdic, devc->usb_vid, devc->usb_pid, devc->prof->iproduct, NULL)) < 0) { sr_err("Failed to open FTDI device (%d): %s.", @@ -248,21 +244,18 @@ static int dev_open(struct sr_dev_inst *sdi) goto err_ftdi_free; } - /* Purge RX/TX buffers in the FTDI chip. */ if ((ret = ftdi_usb_purge_buffers(devc->ftdic)) < 0) { sr_err("Failed to purge FTDI buffers (%d): %s.", ret, ftdi_get_error_string(devc->ftdic)); goto err_ftdi_free; } - /* Enable flow control in the FTDI chip. */ if ((ret = ftdi_setflowctrl(devc->ftdic, SIO_RTS_CTS_HS)) < 0) { sr_err("Failed to enable FTDI flow control (%d): %s.", ret, ftdi_get_error_string(devc->ftdic)); goto err_ftdi_free; } - /* Wait 100ms. */ g_usleep(100 * 1000); return SR_OK;