| 181 | |
| 182 | /** @private */ |
| 183 | SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int mode, int status, |
| 184 | const char *vendor, const char *model, const char *version) |
| 185 | { |
| 186 | struct sr_dev_inst *sdi; |
| 187 | if (!(sdi = malloc(sizeof(struct sr_dev_inst)))) { |
| 188 | sr_err("%s,ERROR:failed to alloc memory.", __func__); |
| 189 | return NULL; |
| 190 | } |
| 191 | memset(sdi, 0, sizeof(struct sr_dev_inst)); |
| 192 | |
| 193 | sdi->mode = mode; |
| 194 | sdi->status = status; |
| 195 | sdi->handle = (ds_device_handle)sdi; |
| 196 | |
| 197 | if (vendor != NULL){ |
| 198 | sdi->vendor = g_strdup(vendor); |
| 199 | } |
| 200 | if (version != NULL){ |
| 201 | sdi->version = g_strdup(version); |
| 202 | } |
| 203 | |
| 204 | if (model && *model){ |
| 205 | sdi->name = g_strdup(model); |
| 206 | } |
| 207 | |
| 208 | return sdi; |
| 209 | } |
| 210 | |
| 211 | /** @private */ |
| 212 | SR_PRIV void sr_dev_probes_free(struct sr_dev_inst *sdi) |