]> sigrok.org Git - libsigrok.git/commitdiff
sysclk-lwla: Fix a regression with (at least) the LWLA1034.
authorUwe Hermann <redacted>
Sun, 24 Dec 2017 14:42:27 +0000 (15:42 +0100)
committerUwe Hermann <redacted>
Mon, 25 Dec 2017 11:48:58 +0000 (12:48 +0100)
This regression was introduced in f1ba6b4b2c9a8ecf90bb31efb218752aa7e49d1a.

Due to how the sysclk-lwla driver does up to 3 open/close operations in
one dev_open() API callback we cannot rely on the sr_dev_open() and
sr_dev_close() wrappers setting the sdi->status variable in this case.

Tested on LWLA1034.

src/hardware/sysclk-lwla/api.c

index c6be15edbb952500fe882a618009907bf49437c4..085f46c7bc7cefab8d8fc0f2a9e107da1fcd17e8 100644 (file)
@@ -259,6 +259,8 @@ static int dev_open(struct sr_dev_inst *sdi)
                /* This delay appears to be necessary for reliable operation. */
                g_usleep(30 * 1000);
 
                /* This delay appears to be necessary for reliable operation. */
                g_usleep(30 * 1000);
 
+               sdi->status = SR_ST_ACTIVE;
+
                devc->active_fpga_config = FPGA_NOCONF;
                devc->short_transfer_quirk = FALSE;
                devc->state = STATE_IDLE;
                devc->active_fpga_config = FPGA_NOCONF;
                devc->short_transfer_quirk = FALSE;
                devc->state = STATE_IDLE;
@@ -271,6 +273,7 @@ static int dev_open(struct sr_dev_inst *sdi)
                        break;
 
                /* Rinse and repeat. */
                        break;
 
                /* Rinse and repeat. */
+               sdi->status = SR_ST_INACTIVE;
                sr_usb_close(usb);
        }
 
                sr_usb_close(usb);
        }
 
@@ -306,7 +309,7 @@ static int dev_close(struct sr_dev_inst *sdi)
 
        sr_usb_close(usb);
 
 
        sr_usb_close(usb);
 
-       return SR_OK;
+       return ret;
 }
 
 /* Check whether the device options contain a specific key.
 }
 
 /* Check whether the device options contain a specific key.