sr: fx2lafw: Cosmetics.

This commit is contained in:
Uwe Hermann 2012-04-10 22:32:31 +02:00
parent 13bf7eccbb
commit 44dfd483db
2 changed files with 17 additions and 16 deletions

View File

@ -25,13 +25,13 @@
SR_PRIV int command_get_fw_version(libusb_device_handle *devhdl,
struct version_info *vi)
{
const int ret = libusb_control_transfer (devhdl,
LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN,
CMD_GET_FW_VERSION, 0x0000, 0x0000,
(unsigned char*)vi, sizeof(struct version_info),
100);
int ret;
if(ret < 0) {
ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
LIBUSB_ENDPOINT_IN, CMD_GET_FW_VERSION, 0x0000, 0x0000,
(unsigned char *)vi, sizeof(struct version_info), 100);
if (ret < 0) {
sr_err("fx2lafw: Unable to get version info: %d.", ret);
return SR_ERR;
}
@ -46,10 +46,10 @@ SR_PRIV int command_start_acquisition(libusb_device_handle *devhdl,
int delay = 0, ret;
/* Compute the sample rate. */
if((SR_MHZ(48) % samplerate) == 0) {
if ((SR_MHZ(48) % samplerate) == 0) {
cmd.flags = CMD_START_FLAGS_CLK_48MHZ;
delay = SR_MHZ(48) / samplerate - 1;
} else if((SR_MHZ(30) % samplerate) == 0) {
} else if ((SR_MHZ(30) % samplerate) == 0) {
cmd.flags = CMD_START_FLAGS_CLK_30MHZ;
delay = SR_MHZ(30) / samplerate - 1;
}

View File

@ -223,17 +223,18 @@ static int fx2lafw_dev_open(int dev_index)
break;
}
if((ret = command_get_fw_version(ctx->usb->devhdl, &vi)) != SR_OK) {
ret = command_get_fw_version(ctx->usb->devhdl, &vi);
if (ret != SR_OK) {
sr_err("fx2lafw: Failed to retrieve "
"firmware version information");
"firmware version information.");
break;
}
if(vi.major != FX2LAFW_VERSION_MAJOR ||
vi.minor != FX2LAFW_VERSION_MINOR) {
if (vi.major != FX2LAFW_VERSION_MAJOR ||
vi.minor != FX2LAFW_VERSION_MINOR) {
sr_err("fx2lafw: Expected firmware version %d.%02d "
"got %d.%02d", FX2LAFW_VERSION_MAJOR,
FX2LAFW_VERSION_MINOR, vi.major, vi.minor);
"got %d.%02d.", FX2LAFW_VERSION_MAJOR,
FX2LAFW_VERSION_MINOR, vi.major, vi.minor);
break;
}
@ -421,8 +422,8 @@ static int hw_dev_open(int dev_index)
ctx = sdi->priv;
/*
* if the firmware was recently uploaded, wait up to MAX_RENUM_DELAY ms
* for the FX2 to renumerate
* If the firmware was recently uploaded, wait up to MAX_RENUM_DELAY ms
* for the FX2 to renumerate.
*/
ret = 0;
if (GTV_TO_MSEC(ctx->fw_updated) > 0) {