Skip to main content

pamoja_can_bus_open

Function pamoja_can_bus_open 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_can_bus_open( interface: *const c_char, out_bus: *mut *mut PamojaCanBus, ) -> PamojaStatus
Expand description

Opens a kernel CAN interface through SocketCAN, as one node on its bus.

§Arguments

  • interface - the interface, such as can0 or vcan0, as UTF-8.
  • out_bus - receives the node.

§Returns

PamojaStatus::Ok; PamojaStatus::Unsupported anywhere but Linux; PamojaStatus::Io when the interface does not exist or cannot be bound; or PamojaStatus::InvalidArgument for a null argument. The reason is in the last error message.

§Safety

interface must be a NUL-terminated string or null, and out_bus a writable pointer or null.