#define VENDOR_MOTECH "Motech"
+/** Driver capabilities generic. */
+static const uint32_t drvopts[] = {
+ /* Device class */
+ SR_CONF_POWER_SUPPLY,
+};
+
/** Driver scanning options. */
static const uint32_t scanopts[] = {
SR_CONF_CONN,
serialcomm = SERIALCOMM;
/* Init serial port. */
- if (!(serial = sr_serial_dev_inst_new(conn, serialcomm)))
- return NULL;
+ serial = sr_serial_dev_inst_new(conn, serialcomm);
if (serial_open(serial, SERIAL_RDWR) != SR_OK)
goto exit_err;
Therefore just print an error message, but do not exit with error. */
sr_err("Failed to query for hardware version: %d %s", errno, strerror(errno));
- sdi = sr_dev_inst_new();
+ sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INACTIVE;
sdi->vendor = g_strdup(VENDOR_MOTECH);
sdi->model = g_strdup(models[modelid].modelstr);
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t));
return SR_OK;
+ case SR_CONF_DEVICE_OPTIONS:
+ if (sdi != NULL)
+ break;
+ *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
+ drvopts, ARRAY_SIZE(drvopts), sizeof(uint32_t));
+ return SR_OK;
default:
if (sdi == NULL)
return SR_ERR_ARG;