X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Ffx2lafw%2Ffx2lafw.c;h=88641163520b54adbabdca5b685f8afe5e1098f8;hb=17b6c75a899bb5fb2b8b841b60e3e9fb52ca3e30;hp=b0bd0e6067b6cb06db6924b3ef2eab9ac94a1ba9;hpb=2e526f4a6a96bca01c81620ff820aa39e356977f;p=libsigrok.git diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index b0bd0e60..88641163 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -29,7 +29,9 @@ #include "command.h" static struct fx2lafw_profile supported_fx2[] = { - /* USBee AX */ + /* CWAV USBee AX + * EE Electronics ESLA201A + */ { 0x08a9, 0x0014, "CWAV", "USBee AX", NULL, 8 }, { 0, 0, 0, 0, 0, 0 } }; @@ -78,6 +80,7 @@ static struct sr_samplerates fx2lafw_samplerates = { static GSList *dev_insts = NULL; static libusb_context *usb_context = NULL; +static int hw_dev_config_set(int dev_index, int hwcap, void *value); static int hw_dev_acquisition_stop(int dev_index, void *session_dev_id); /** @@ -116,18 +119,13 @@ static gboolean check_conf_profile(libusb_device *dev) break; intf_dsc = &(conf_dsc->interface[0].altsetting[0]); - if (intf_dsc->bNumEndpoints != 3) - /* Need exactly 3 end points. */ + if (intf_dsc->bNumEndpoints != 2) + /* Need exactly 2 end points. */ break; if ((intf_dsc->endpoint[0].bEndpointAddress & 0x8f) != - (1 | LIBUSB_ENDPOINT_OUT)) - /* The first endpoint should be 1 (outbound). */ - break; - - if ((intf_dsc->endpoint[1].bEndpointAddress & 0x8f) != - (2 | LIBUSB_ENDPOINT_IN)) - /* The second endpoint should be 2 (inbound). */ + (2 | LIBUSB_ENDPOINT_IN)) // 0x82 + /* The first endpoint should be 2 (inbound). */ break; /* TODO: Check the debug channel... */ @@ -369,6 +367,13 @@ static int hw_dev_open(int dev_index) return SR_ERR; } + if (ctx->cur_samplerate == 0) { + /* Samplerate hasn't been set; default to the slowest one. */ + if (hw_dev_config_set(dev_index, SR_HWCAP_SAMPLERATE, + &fx2lafw_supported_samplerates[0]) == SR_ERR) + return SR_ERR; + } + return SR_OK; } @@ -617,10 +622,6 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data) return SR_ERR_MALLOC; } - if ((err = command_start_acquisition (ctx->usb->devhdl)) != SR_OK) { - return err; - } - /* Start with 2K transfer, subsequently increased to 4K. */ size = 2048; for (i = 0; i < NUM_SIMUL_TRANSFERS; i++) { @@ -657,6 +658,11 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data) g_free(header); g_free(packet); + if ((err = command_start_acquisition (ctx->usb->devhdl, + ctx->cur_samplerate)) != SR_OK) { + return err; + } + return SR_OK; }