rc=generic_read_port_passthrough(core,port,src,length,priv_data);
- PrintDebug(core->vm_info, core, " done ... read 0x");
-
- for (i = 0; i < rc; i++) {
- PrintDebug(core->vm_info, core, "%x", ((uint8_t *)src)[i]);
+ if (rc<0) {
+ PrintError(core->vm_info, core, "FAILED\n");
+ return rc;
+ } else {
+ PrintDebug(core->vm_info, core, " done ... read 0x");
+
+ for (i = 0; i < rc; i++) {
+ PrintDebug(core->vm_info, core, "%x", ((uint8_t *)src)[i]);
+ }
+
+ PrintDebug(core->vm_info, core, "\n");
}
-
- PrintDebug(core->vm_info, core, "\n");
-
+
return rc;
}
memset(state, 0, sizeof(struct generic_internal));
strncpy(state->name,dev_id,MAX_NAME);
+ state->name[MAX_NAME-1] = 0;
if (!forward) {
state->forward_type=GENERIC_PHYSICAL;
uint16_t start = atox(v3_cfg_val(port_cfg, "start"));
uint16_t end = atox(v3_cfg_val(port_cfg, "end"));
char * mode_str = v3_cfg_val(port_cfg, "mode");
+ if (!mode_str) {
+ PrintError(vm, VCORE_NONE, "generic (%s): error getting port mode\n", state->name);
+ return -1;
+ }
generic_mode_t mode = GENERIC_IGNORE;
if (strcasecmp(mode_str, "print_and_ignore") == 0) {
mode = GENERIC_PRINT_AND_IGNORE;