MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / sr_dev_inst_new

Function sr_dev_inst_new

libsigrok4DSL/dsdevice.c:183–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181
182/** @private */
183SR_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 */
212SR_PRIV void sr_dev_probes_free(struct sr_dev_inst *sdi)

Callers 7

sr_new_virtual_deviceFunction · 0.85
scanFunction · 0.85
scanFunction · 0.85
hw_scanFunction · 0.85
initFunction · 0.85
initFunction · 0.85
initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected