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,11 +25,11 @@
SR_PRIV int command_get_fw_version(libusb_device_handle *devhdl, SR_PRIV int command_get_fw_version(libusb_device_handle *devhdl,
struct version_info *vi) struct version_info *vi)
{ {
const int ret = libusb_control_transfer (devhdl, int ret;
LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN,
CMD_GET_FW_VERSION, 0x0000, 0x0000, ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
(unsigned char*)vi, sizeof(struct version_info), LIBUSB_ENDPOINT_IN, CMD_GET_FW_VERSION, 0x0000, 0x0000,
100); (unsigned char *)vi, sizeof(struct version_info), 100);
if (ret < 0) { if (ret < 0) {
sr_err("fx2lafw: Unable to get version info: %d.", ret); sr_err("fx2lafw: Unable to get version info: %d.", ret);

View File

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