+static int handle_timeout(struct sr_dev_inst *sdi)
+{
+ struct dev_context *devc;
+ const struct lcr_info *lcr;
+ struct sr_serial_dev_inst *serial;
+ int64_t now;
+ int ret;
+
+ devc = sdi->priv;
+ lcr = devc->lcr_info;
+
+ if (!lcr->packet_request)
+ return SR_OK;
+
+ now = g_get_monotonic_time();
+ if (devc->req_next_at && now < devc->req_next_at)
+ return SR_OK;
+
+ serial = sdi->conn;
+ ret = lcr->packet_request(serial);
+ if (ret < 0) {
+ sr_err("Failed to request packet: %d.", ret);
+ return ret;
+ }
+
+ if (lcr->req_timeout_ms)
+ devc->req_next_at = now + lcr->req_timeout_ms * 1000;
+
+ return SR_OK;
+}
+