#[unsafe(no_mangle)]pub unsafe extern "C" fn pamoja_serial_port_open(
path: *const c_char,
settings: PamojaSerialSettings,
out_port: *mut *mut PamojaSerialPort,
) -> PamojaStatusExpand description
Opens the kernel’s serial device raw, at a speed and a character format. Whatever the device received before it was opened is dropped.
§Arguments
path- the device file:/dev/serial0for a Raspberry Pi’s own UART,/dev/ttyUSB0or/dev/ttyACM0for a USB adapter.settings- the speed, one of the standard rates from 1200 to 921600, and the format.out_port- receives the port, or null when opening fails.
§Returns
PamojaStatus::Ok with the port in out_port; PamojaStatus::Unsupported on any
platform but Linux; PamojaStatus::InvalidArgument for a null or non-UTF-8 argument or
settings the port does not have; or PamojaStatus::Io when the device cannot be opened
or set up, with a last error message that names it.
§Safety
path must be a null-terminated string or null, and out_port a writable pointer or null.