C API support for serial output mode