CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
Plugin command channel

Receive a command string pushed to the plugin by the host. More...

Functions

int host_cmd_consume (char *out, size_t out_size)
 Copy the pending command string into out, clearing it.

Detailed Description

Receive a command string pushed to the plugin by the host.

When the host forwards a command (e.g. via the PLUGIN CMD <id> <args> serial subcommand) it fires the optional plugin_on_cmd export with the command length. The plugin pulls the bytes into its own buffer with host_cmd_consume, mirroring host_ui_consume_input_text.

Function Documentation

◆ host_cmd_consume()

int host_cmd_consume ( char * out,
size_t out_size )

Copy the pending command string into out, clearing it.

Parameters
outCaller buffer in plugin linear memory.
out_sizeSize of out; the result is always null-terminated.
Returns
Number of bytes copied, or a negative HOST_ERR_* code.

Definition at line 12 of file host_api_cmd.cpp.

References cdc::plugin_manager::PluginManager::consumeCmd(), and cdc::plugin_manager::PluginManager::instance().

Referenced by cdc::plugin_manager::w_host_cmd_consume().