+static gchar *hpib_get_revision(struct sr_scpi_dev_inst *scpi)
+{
+ int ret;
+ gboolean matches;
+ char *response;
+ GRegex *version_regex;
+
+ ret = sr_scpi_get_string(scpi, "ROM?", &response);
+ if (ret != SR_OK && !response)
+ return NULL;
+
+ /* Example version string: "B01 B01" */
+ version_regex = g_regex_new("[A-Z][0-9]{2} [A-Z][0-9]{2}", 0, 0, NULL);
+ matches = g_regex_match(version_regex, response, 0, NULL);
+ g_regex_unref(version_regex);
+
+ if (!matches) {
+ /* Not a valid version string. Ignore it. */
+ g_free(response);
+ response = NULL;
+ } else {
+ /* Replace space with dot. */
+ response[3] = '.';
+ }
+
+ return response;
+}
+
+/*
+ * This function assumes the response is in the form "HP<model_number>"
+ *
+ * HP made many GPIB (then called HP-IB) instruments before the SCPI command
+ * set was introduced into the standard. We haven't seen any non-HP instruments
+ * which respond to the "ID?" query, so assume all are HP for now.
+ */
+static int hpib_get_hw_id(struct sr_scpi_dev_inst *scpi,
+ struct sr_scpi_hw_info **scpi_response)