libusbgx-0.3.0
|
Data Structures | |
struct | usbg_gadget_attrs |
USB gadget device attributes. More... | |
struct | usbg_gadget_strs |
USB gadget device strings. More... | |
struct | usbg_gadget_os_descs |
USB gadget Microsoft OS Descriptors. More... | |
struct | usbg_config_attrs |
USB configuration attributes. More... | |
struct | usbg_config_strs |
USB configuration strings. More... | |
struct | usbg_function_os_desc |
USB OS Descriptor function attributes. More... | |
Macros | |
#define | DEFAULT_UDC NULL |
#define | LANG_US_ENG 0x0409 |
#define | DEFAULT_CONFIG_LABEL "config" |
#define | GUID_BIN_LENGTH 16 |
#define | GUID_CHAR_LENGTH 36 /* 32 bytes + 4 dashes */ |
#define | USBG_MAX_STR_LENGTH 256 |
#define | USBG_MAX_NAME_LENGTH 40 |
#define | USBG_MAX_DEV_LENGTH (USBG_MAX_NAME_LENGTH - 4) |
#define | USBG_TO_UNION(UNAME, FIELD, WHAT) ((union UNAME){ .FIELD = WHAT, }) |
#define | USBG_RM_RECURSE 1 |
Additional option for usbg_rm_* functions. | |
#define | usbg_for_each_gadget(g, s) |
#define | usbg_for_each_function(f, g) |
#define | usbg_for_each_config(c, g) |
#define | usbg_for_each_binding(b, c) |
#define | usbg_for_each_udc(u, s) |
Typedefs | |
typedef struct usbg_state | usbg_state |
State of the gadget devices in the system. | |
typedef struct usbg_gadget | usbg_gadget |
USB gadget device. | |
typedef struct usbg_config | usbg_config |
USB configuration. | |
typedef struct usbg_function | usbg_function |
USB function. | |
typedef struct usbg_binding | usbg_binding |
USB function to config binding. | |
typedef struct usbg_udc | usbg_udc |
USB device controller. | |
Enumerations | |
enum | usbg_gadget_attr { USBG_GADGET_ATTR_MIN = 0 , USBG_BCD_USB = USBG_GADGET_ATTR_MIN , USBG_B_DEVICE_CLASS , USBG_B_DEVICE_SUB_CLASS , USBG_B_DEVICE_PROTOCOL , USBG_B_MAX_PACKET_SIZE_0 , USBG_ID_VENDOR , USBG_ID_PRODUCT , USBG_BCD_DEVICE , USBG_GADGET_ATTR_MAX } |
Gadget attributes which can be set using usbg_set_gadget_attr() function. | |
enum | usbg_gadget_str { USBG_GADGET_STR_MIN = 0 , USBG_STR_MANUFACTURER = USBG_GADGET_STR_MIN , USBG_STR_PRODUCT , USBG_STR_SERIAL_NUMBER , USBG_GADGET_STR_MAX } |
enum | usbg_gadget_os_desc_strs { USBG_GADGET_OS_DESC_MIN = 0 , OS_DESC_USE = USBG_GADGET_OS_DESC_MIN , OS_DESC_B_VENDOR_CODE , OS_DESC_QW_SIGN , USBG_GADGET_OS_DESC_MAX } |
Microsoft OS Descriptors strings. | |
enum | usbg_function_type { USBG_FUNCTION_TYPE_MIN = 0 , USBG_F_SERIAL = USBG_FUNCTION_TYPE_MIN , USBG_F_ACM , USBG_F_OBEX , USBG_F_ECM , USBG_F_SUBSET , USBG_F_NCM , USBG_F_EEM , USBG_F_RNDIS , USBG_F_PHONET , USBG_F_FFS , USBG_F_MASS_STORAGE , USBG_F_MIDI , USBG_F_LOOPBACK , USBG_F_HID , USBG_F_UAC2 , USBG_F_UVC , USBG_F_PRINTER , USBG_F_9PFS , USBG_FUNCTION_TYPE_MAX } |
Supported USB function types. | |
enum | usbg_error { USBG_SUCCESS = 0 , USBG_ERROR_NO_MEM = -1 , USBG_ERROR_NO_ACCESS = -2 , USBG_ERROR_INVALID_PARAM = -3 , USBG_ERROR_NOT_FOUND = -4 , USBG_ERROR_IO = -5 , USBG_ERROR_EXIST = -6 , USBG_ERROR_NO_DEV = -7 , USBG_ERROR_BUSY = -8 , USBG_ERROR_NOT_SUPPORTED = -9 , USBG_ERROR_PATH_TOO_LONG = -10 , USBG_ERROR_INVALID_FORMAT = -11 , USBG_ERROR_MISSING_TAG = -12 , USBG_ERROR_INVALID_TYPE = -13 , USBG_ERROR_INVALID_VALUE = -14 , USBG_ERROR_NOT_EMPTY = -15 , USBG_ERROR_OTHER_ERROR = -99 } |
Errors which could be returned by library functions. | |
Functions | |
const char * | usbg_error_name (usbg_error e) |
Get the error name as a constant string. | |
const char * | usbg_strerror (usbg_error e) |
Get the short description of error. | |
int | usbg_init (const char *configfs_path, usbg_state **state) |
Initialize the libusbgx library state. | |
void | usbg_cleanup (usbg_state *s) |
Clean up the libusbgx library state. | |
const char * | usbg_get_configfs_path (usbg_state *s) |
Get ConfigFS path. | |
int | usbg_get_configfs_path_s (usbg_state *s, char *buf, int len) |
Get ConfigFS path into user buffer. | |
usbg_gadget * | usbg_get_gadget (usbg_state *s, const char *name) |
Get a gadget device by name. | |
usbg_function * | usbg_get_function (usbg_gadget *g, usbg_function_type type, const char *instance) |
Get a function by name. | |
usbg_config * | usbg_get_config (usbg_gadget *g, int id, const char *label) |
Get a configuration by name. | |
usbg_udc * | usbg_get_udc (usbg_state *s, const char *name) |
Get a udc by name. | |
int | usbg_rm_binding (usbg_binding *b) |
Remove binding between configuration and function. | |
int | usbg_rm_config (usbg_config *c, int opts) |
Remove configuration. | |
int | usbg_rm_function (usbg_function *f, int opts) |
Remove existing USB function. | |
int | usbg_rm_gadget (usbg_gadget *g, int opts) |
Remove existing USB gadget. | |
int | usbg_rm_config_strs (usbg_config *c, int lang) |
Remove configuration strings for given language. | |
int | usbg_rm_gadget_strs (usbg_gadget *g, int lang) |
Remove gadget strings for given language. | |
int | usbg_create_gadget_vid_pid (usbg_state *s, const char *name, uint16_t idVendor, uint16_t idProduct, usbg_gadget **g) |
Create a new USB gadget device. | |
int | usbg_create_gadget (usbg_state *s, const char *name, const struct usbg_gadget_attrs *g_attrs, const struct usbg_gadget_strs *g_strs, usbg_gadget **g) |
Create a new USB gadget device and set given attributes and strings. | |
const char * | usbg_get_gadget_attr_str (usbg_gadget_attr attr) |
Get string representing selected gadget attribute. | |
int | usbg_lookup_gadget_attr (const char *name) |
Lookup attr code based on its name. | |
int | usbg_lookup_gadget_str (const char *name) |
Lookup str code based on its name. | |
const char * | usbg_get_gadget_str_name (usbg_gadget_str str) |
Get name of selected gadget string. | |
const char * | usbg_get_gadget_os_desc_name (usbg_gadget_os_desc_strs str) |
Get name of selected OS Descriptor string. | |
int | usbg_set_gadget_attr (usbg_gadget *g, usbg_gadget_attr attr, int val) |
Set selected attribute to value. | |
int | usbg_get_gadget_attr (usbg_gadget *g, usbg_gadget_attr attr) |
Get value of selected attribute. | |
int | usbg_set_gadget_attrs (usbg_gadget *g, const struct usbg_gadget_attrs *g_attrs) |
Set the USB gadget attributes. | |
int | usbg_get_gadget_attrs (usbg_gadget *g, struct usbg_gadget_attrs *g_attrs) |
Get the USB gadget strings. | |
const char * | usbg_get_gadget_name (usbg_gadget *g) |
Get gadget name. | |
int | usbg_get_gadget_name_s (usbg_gadget *g, char *buf, int len) |
Get gadget name into user buffer. | |
int | usbg_set_gadget_vendor_id (usbg_gadget *g, uint16_t idVendor) |
Set the USB gadget vendor id. | |
int | usbg_set_gadget_product_id (usbg_gadget *g, uint16_t idProduct) |
Set the USB gadget product id. | |
int | usbg_set_gadget_device_class (usbg_gadget *g, uint8_t bDeviceClass) |
Set the USB gadget device class code. | |
int | usbg_set_gadget_device_protocol (usbg_gadget *g, uint8_t bDeviceProtocol) |
Set the USB gadget protocol code. | |
int | usbg_set_gadget_device_subclass (usbg_gadget *g, uint8_t bDeviceSubClass) |
Set the USB gadget device subclass code. | |
int | usbg_set_gadget_device_max_packet (usbg_gadget *g, uint8_t bMaxPacketSize0) |
Set the maximum packet size for a gadget. | |
int | usbg_set_gadget_device_bcd_device (usbg_gadget *g, uint16_t bcdDevice) |
Set the gadget device BCD release number. | |
int | usbg_set_gadget_device_bcd_usb (usbg_gadget *g, uint16_t bcdUSB) |
Set the gadget device BCD USB version. | |
int | usbg_get_gadget_strs (usbg_gadget *g, int lang, struct usbg_gadget_strs *g_strs) |
Get the USB gadget strings. | |
int | usbg_get_gadget_strs_langs (usbg_gadget *g, int **langs) |
Get the array of languages available in this gadget. | |
int | usbg_set_gadget_str (usbg_gadget *g, usbg_gadget_str str, int lang, const char *val) |
Set selected string. | |
int | usbg_set_gadget_strs (usbg_gadget *g, int lang, const struct usbg_gadget_strs *g_strs) |
Set the USB gadget strings. | |
int | usbg_set_gadget_serial_number (usbg_gadget *g, int lang, const char *ser) |
Set the serial number for a gadget. | |
int | usbg_set_gadget_manufacturer (usbg_gadget *g, int lang, const char *mnf) |
Set the manufacturer name for a gadget. | |
int | usbg_set_gadget_product (usbg_gadget *g, int lang, const char *prd) |
Set the product name for a gadget. | |
int | usbg_get_gadget_os_descs (usbg_gadget *g, struct usbg_gadget_os_descs *g_os_descs) |
Get the USB gadget OS Descriptor. | |
int | usbg_set_gadget_os_descs (usbg_gadget *g, const struct usbg_gadget_os_descs *g_os_descs) |
Set the USB gadget OS Descriptor. | |
int | usbg_create_function (usbg_gadget *g, usbg_function_type type, const char *instance, void *f_attrs, usbg_function **f) |
Create a new USB gadget function and set its attributes. | |
const char * | usbg_get_function_instance (usbg_function *f) |
Get function instance name. | |
int | usbg_get_function_instance_s (usbg_function *f, char *buf, int len) |
Get function instance name into user buffer. | |
const char * | usbg_get_function_type_str (usbg_function_type type) |
Get function type as a string. | |
int | usbg_lookup_function_type (const char *name) |
Lookup function type suitable for given name. | |
void | usbg_cleanup_function_attrs (usbg_function *f, void *f_attrs) |
Cleanup content of function attributes. | |
usbg_function_type | usbg_get_function_type (usbg_function *f) |
Get type of given function. | |
int | usbg_get_function_attrs (usbg_function *f, void *f_attrs) |
Get attributes of given function. | |
int | usbg_set_function_attrs (usbg_function *f, void *f_attrs) |
Set attributes of given function. | |
int | usbg_get_interf_os_desc (usbg_function *f, const char *iname, struct usbg_function_os_desc *f_os_desc) |
Get OS Descriptor compatibility of given function. | |
int | usbg_set_interf_os_desc (usbg_function *f, const char *iname, const struct usbg_function_os_desc *f_os_desc) |
Set OS Descriptor compatibility of given function. | |
int | usbg_create_config (usbg_gadget *g, int id, const char *label, const struct usbg_config_attrs *c_attrs, const struct usbg_config_strs *c_strs, usbg_config **c) |
Create a new USB gadget configuration. | |
const char * | usbg_get_config_label (usbg_config *c) |
Get config label. | |
int | usbg_get_config_label_s (usbg_config *c, char *buf, int len) |
Get config label into user buffer. | |
int | usbg_get_config_id (usbg_config *c) |
Get config id. | |
int | usbg_set_config_attrs (usbg_config *c, const struct usbg_config_attrs *c_attrs) |
Set the USB configuration attributes. | |
int | usbg_get_config_attrs (usbg_config *c, struct usbg_config_attrs *c_attrs) |
Get the USB configuration strings. | |
int | usbg_set_config_max_power (usbg_config *c, int bMaxPower) |
Set the configuration maximum power. | |
int | usbg_set_config_bm_attrs (usbg_config *c, int bmAttributes) |
Set the configuration bitmap attributes. | |
int | usbg_get_config_strs (usbg_config *c, int lang, struct usbg_config_strs *c_strs) |
Get the USB configuration strings. | |
int | usbg_get_config_strs_langs (usbg_config *c, int **langs) |
Get the array of languages available in this config. | |
int | usbg_set_config_strs (usbg_config *c, int lang, const struct usbg_config_strs *c_strs) |
Set the USB configuration strings. | |
int | usbg_set_config_string (usbg_config *c, int lang, const char *string) |
Set the configuration string. | |
int | usbg_add_config_function (usbg_config *c, const char *name, usbg_function *f) |
Add a function to a configuration. | |
usbg_function * | usbg_get_binding_target (usbg_binding *b) |
Get target function of given binding. | |
const char * | usbg_get_binding_name (usbg_binding *b) |
Get binding name. | |
int | usbg_get_binding_name_s (usbg_binding *b, char *buf, int len) |
Get binding name into user buffer. | |
usbg_config * | usbg_get_os_desc_binding (usbg_gadget *g) |
Get configuration selected for OS Descriptors. | |
int | usbg_set_os_desc_config (usbg_gadget *g, usbg_config *c) |
Set configuration for OS Descriptors. | |
int | usbg_enable_gadget (usbg_gadget *g, usbg_udc *udc) |
Enable a USB gadget device. | |
int | usbg_disable_gadget (usbg_gadget *g) |
Disable a USB gadget device. | |
const char * | usbg_get_udc_name (usbg_udc *u) |
Get name of udc. | |
int | usbg_get_udc_name_s (usbg_udc *u, char *buf, int len) |
Get udc name into user buffer. | |
usbg_udc * | usbg_get_gadget_udc (usbg_gadget *g) |
Get udc to which gadget is bound. | |
usbg_gadget * | usbg_get_udc_gadget (usbg_udc *u) |
Get gadget which is attached to this UDC. | |
usbg_gadget * | usbg_get_first_gadget (usbg_state *s) |
Get first gadget in gadget list. | |
usbg_function * | usbg_get_first_function (usbg_gadget *g) |
Get first function in function list. | |
usbg_config * | usbg_get_first_config (usbg_gadget *g) |
Get first config in config list. | |
usbg_binding * | usbg_get_first_binding (usbg_config *c) |
Get first binding in binding list. | |
usbg_udc * | usbg_get_first_udc (usbg_state *s) |
Get first udc in udc list. | |
usbg_gadget * | usbg_get_next_gadget (usbg_gadget *g) |
Get the next gadget on a list. | |
usbg_function * | usbg_get_next_function (usbg_function *f) |
Get the next function on a list. | |
usbg_config * | usbg_get_next_config (usbg_config *c) |
Get the next config on a list. | |
usbg_binding * | usbg_get_next_binding (usbg_binding *b) |
Get the next binding on a list. | |
usbg_udc * | usbg_get_next_udc (usbg_udc *u) |
Get the next udc on a list. | |
int | usbg_export_function (usbg_function *f, FILE *stream) |
Exports usb function to file. | |
int | usbg_export_config (usbg_config *c, FILE *stream) |
Exports configuration to file. | |
int | usbg_export_gadget (usbg_gadget *g, FILE *stream) |
Exports whole gadget to file. | |
int | usbg_import_function (usbg_gadget *g, FILE *stream, const char *instance, usbg_function **f) |
Imports usb function from file and adds it to given gadget. | |
int | usbg_import_config (usbg_gadget *g, FILE *stream, int id, usbg_config **c) |
Imports usb configuration from file and adds it to given gadget. | |
int | usbg_import_gadget (usbg_state *s, FILE *stream, const char *name, usbg_gadget **g) |
Imports usb gadget from file. | |
const char * | usbg_get_func_import_error_text (usbg_gadget *g) |
Get text of error which occurred during last function import. | |
int | usbg_get_func_import_error_line (usbg_gadget *g) |
Get line number where function import error occurred. | |
const char * | usbg_get_config_import_error_text (usbg_gadget *g) |
Get text of error which occurred during last config import. | |
int | usbg_get_config_import_error_line (usbg_gadget *g) |
Get line number where config import error occurred. | |
const char * | usbg_get_gadget_import_error_text (usbg_state *s) |
Get text of error which occurred during last gadget import. | |
int | usbg_get_gadget_import_error_line (usbg_state *s) |
Get line number where gadget import error occurred. | |
Public API for USB gadget-configfs library
struct usbg_gadget_attrs |
struct usbg_gadget_strs |
USB gadget device strings.
Data Fields | ||
---|---|---|
char * | manufacturer | |
char * | product | |
char * | serial |
struct usbg_gadget_os_descs |
USB gadget Microsoft OS Descriptors.
Data Fields | ||
---|---|---|
uint8_t | b_vendor_code | |
char * | qw_sign | |
bool | use |
struct usbg_config_attrs |
USB configuration attributes.
Data Fields | ||
---|---|---|
uint8_t | bmAttributes | |
uint8_t | bMaxPower |
struct usbg_config_strs |
USB configuration strings.
Data Fields | ||
---|---|---|
char * | configuration |
struct usbg_function_os_desc |
USB OS Descriptor function attributes.
Data Fields | ||
---|---|---|
char * | compatible_id | |
char * | sub_compatible_id |
#define usbg_for_each_binding | ( | b, | |
c | |||
) |
Iterates over each binding
#define usbg_for_each_config | ( | c, | |
g | |||
) |
Iterates over each config
#define usbg_for_each_function | ( | f, | |
g | |||
) |
Iterates over each function
#define usbg_for_each_gadget | ( | g, | |
s | |||
) |
Iterates over each gadget
#define usbg_for_each_udc | ( | u, | |
s | |||
) |
Iterates over each udc
#define USBG_RM_RECURSE 1 |
Additional option for usbg_rm_* functions.
This option allows to remove all content of gadget/config/function recursively.
|
extern |
Add a function to a configuration.
c | Pointer to config |
name | Name of configuration function binding |
f | Pointer to function |
|
extern |
Clean up the libusbgx library state.
s | Pointer to state |
|
extern |
Cleanup content of function attributes.
f_attrs | function attributes which should be cleaned up. |
|
extern |
Create a new USB gadget configuration.
g | Pointer to gadget |
id | Identify of configuration |
label | configuration label, if NULL, default is used |
c_attrs | Configuration attributes to be set |
c_strs | Configuration strings to be set |
c | Pointer to be filled with pointer to configuration |
|
extern |
Create a new USB gadget function and set its attributes.
g | Pointer to gadget |
type | Type of function |
instance | Function instance name |
f_attrs | Function specific attributes to be set. If NULL setting is omitted. |
f | Pointer to be filled with pointer to function |
|
extern |
Create a new USB gadget device and set given attributes and strings.
s | Pointer to state |
name | Name of the gadget |
g_attrs | Gadget attributes to be set. If NULL setting is omitted. |
g_strs | Gadget strings to be set. If NULL setting is omitted. |
g | Pointer to be filled with pointer to gadget |
|
extern |
Create a new USB gadget device.
s | Pointer to state |
name | Name of the gadget |
idVendor | Gadget vendor ID |
idProduct | Gadget product ID |
g | Pointer to be filled with pointer to gadget |
|
extern |
Disable a USB gadget device.
g | Pointer to gadget |
|
extern |
Enable a USB gadget device.
g | Pointer to gadget |
udc | where gadget should be assigned. If NULL, default one (first) is used. |
|
extern |
Get the error name as a constant string.
e | error code |
|
extern |
Exports configuration to file.
c | Pointer to configuration to be exported |
stream | where configuration should be saved |
|
extern |
Exports usb function to file.
f | Pointer to function to be exported |
stream | where function should be saved |
|
extern |
Exports whole gadget to file.
g | Pointer to gadget to be exported |
stream | where gadget should be saved |
|
extern |
Get binding name.
b | Pointer to binding |
|
extern |
Get binding name into user buffer.
[in] | b | Pointer to binding |
[out] | buf | Place where binding name should be stored |
[in] | len | Size of buffer |
|
extern |
Get target function of given binding.
b | Binding between configuration and function |
|
extern |
Get a configuration by name.
g | Pointer to gadget |
id | Identify of configuration |
label | Configuration label. If not NULL this function will return valid value only if configuration with given id exist and has this label. If NULL this function will return config with given id (if such exist) and ignore this param. |
|
extern |
Get the USB configuration strings.
c | Pointer to configuration |
c_attrs | Structure to be filled |
|
extern |
Get config id.
c | Pointer to config |
|
extern |
Get line number where config import error occurred.
g | gadget where config import error occurred |
|
extern |
Get text of error which occurred during last config import.
g | gadget where config import error occurred |
|
extern |
Get config label.
c | Pointer to config |
|
extern |
Get config label into user buffer.
[in] | c | Pointer to config |
[out] | buf | Place where label should be stored |
[in] | len | Size of buffer |
|
extern |
Get the USB configuration strings.
c | Pointer to configuration |
lang | Language of strings |
c_strs | Structure to be filled |
|
extern |
Get the array of languages available in this config.
c | Pointer to configuration |
langs | array of available language codes |
|
extern |
Get ConfigFS path.
s | Pointer to state |
|
extern |
Get ConfigFS path into user buffer.
[in] | s | Pointer to state |
[out] | buf | Place where path should be stored |
[in] | len | Size of buffer |
|
extern |
Get first binding in binding list.
c | Pointer to configuration |
|
extern |
Get first config in config list.
g | Pointer of gadget |
|
extern |
Get first function in function list.
g | Pointer of gadget |
|
extern |
Get first gadget in gadget list.
s | State of library |
|
extern |
Get first udc in udc list.
s | State of library |
|
extern |
Get line number where function import error occurred.
g | gadget where function import error occurred |
|
extern |
Get text of error which occurred during last function import.
g | gadget where function import error occurred |
|
extern |
Get a function by name.
g | Pointer to gadget |
type | Function type |
instance | Instance of function |
|
extern |
Get attributes of given function.
f | Pointer to function |
f_attrs | Union to be filled |
|
extern |
Get function instance name.
f | Pointer to function |
|
extern |
Get function instance name into user buffer.
[in] | f | Pointer to function |
[out] | buf | Place where instance name should be stored |
[in] | len | Size of buffer |
|
extern |
Get type of given function.
f | Pointer to function |
|
extern |
Get function type as a string.
type | Function type |
|
extern |
Get a gadget device by name.
s | Pointer to state |
name | Name of the gadget device |
|
extern |
Get value of selected attribute.
g | Pointer to gadget |
attr | Code of selected attribute |
|
extern |
Get string representing selected gadget attribute.
attr | code of selected attribute |
|
extern |
Get the USB gadget strings.
g | Pointer to gadget |
g_attrs | Structure to be filled |
|
extern |
Get line number where gadget import error occurred.
s | where gadget import error occurred |
|
extern |
Get text of error which occurred during last gadget import.
s | where gadget import error occurred |
|
extern |
Get gadget name.
g | Pointer to gadget |
|
extern |
Get gadget name into user buffer.
[in] | g | Pointer to state |
[out] | buf | Place where name should be stored |
[in] | len | Size of buffer |
|
extern |
Get name of selected OS Descriptor string.
str | OS Descriptor string code |
|
extern |
Get the USB gadget OS Descriptor.
g | Pointer to gadget |
g_os_descs | Structure to be filled |
|
extern |
Get name of selected gadget string.
str | Gadget string code |
|
extern |
Get the USB gadget strings.
g | Pointer to gadget |
lang | Language of strings |
g_strs | Structure to be filled |
|
extern |
Get the array of languages available in this gadget.
g | Pointer to gadget |
langs | array of available language codes |
|
extern |
Get udc to which gadget is bound.
g | Pointer to gadget |
|
extern |
Get OS Descriptor compatibility of given function.
f | Pointer to function |
iname | Interface name |
f_os_desc | OS Descriptor compatibility to be filled |
|
extern |
Get the next binding on a list.
b | Pointer to current binding |
|
extern |
Get the next config on a list.
c | Pointer to current config |
|
extern |
Get the next function on a list.
f | Pointer to current function |
|
extern |
Get the next gadget on a list.
g | Pointer to current gadget |
Get the next udc on a list.
u | Pointer to current udc |
usbg_config * usbg_get_os_desc_binding | ( | usbg_gadget * | g | ) |
Get configuration selected for OS Descriptors.
g | Pointer to gadget |
|
extern |
Get a udc by name.
s | Pointer to state |
name | Name of the udc |
|
extern |
Get gadget which is attached to this UDC.
u | Pointer to udc |
|
extern |
Get name of udc.
u | Pointer to udc |
|
extern |
Get udc name into user buffer.
[in] | u | Pointer to udc |
[out] | buf | Place where udc name should be stored |
[in] | len | Size of buffer |
|
extern |
Imports usb configuration from file and adds it to given gadget.
g | Gadget where configuration should be placed |
stream | from which configuration should be imported |
id | which should be used for new configuration |
c | place for pointer to imported configuration if NULL this param will be ignored. |
|
extern |
Imports usb function from file and adds it to given gadget.
g | Gadget where function should be placed |
stream | from which function should be imported |
instance | name which should be used for new function |
f | place for pointer to imported function if NULL this param will be ignored. |
|
extern |
Imports usb gadget from file.
s | current state of library |
stream | from which gadget should be imported |
name | which should be used for new gadget |
g | place for pointer to imported gadget if NULL this param will be ignored. |
|
extern |
Initialize the libusbgx library state.
configfs_path | Path to the mounted configfs filesystem |
state | Pointer to be filled with pointer to usbg_state |
|
extern |
Lookup function type suitable for given name.
name | Name of function |
|
extern |
Lookup attr code based on its name.
name | of attribute |
|
extern |
Lookup str code based on its name.
name | of string |
|
extern |
Remove binding between configuration and function.
This function frees also the memory allocated for binding
b | Binding to be removed |
|
extern |
Remove configuration.
This function frees also the memory allocated for configuration
c | Configuration to be removed |
opts | Additional options for configuration removal. |
|
extern |
Remove configuration strings for given language.
c | Pointer to configuration |
lang | Language of strings which should be deleted |
|
extern |
Remove existing USB function.
This function frees also the memory allocated for function
f | Function to be removed |
opts | Additional options for configuration removal. |
|
extern |
Remove existing USB gadget.
This function frees also the memory allocated for gadget
g | Gadget to be removed |
opts | Additional options for configuration removal. |
|
extern |
Remove gadget strings for given language.
g | Pointer to gadget |
lang | Language of strings which should be deleted |
|
extern |
Set the USB configuration attributes.
c | Pointer to configuration |
c_attrs | Configuration attributes |
|
extern |
Set the configuration bitmap attributes.
c | Pointer to config |
bmAttributes | Configuration characteristics |
|
extern |
Set the configuration maximum power.
c | Pointer to config |
bMaxPower | Maximum power (in 2 mA units) |
|
extern |
Set the configuration string.
c | Pointer to config |
lang | USB language ID |
string | Configuration description |
|
extern |
Set the USB configuration strings.
c | Pointer to configuration |
lang | USB language ID |
c_strs | Configuration strings |
|
extern |
Set attributes of given function.
f | Pointer to function |
f_attrs | Attributes to be set |
|
extern |
Set selected attribute to value.
g | Pointer to gadget |
attr | Code of selected attribute |
val | value to be set |
|
extern |
Set the USB gadget attributes.
g | Pointer to gadget |
g_attrs | Gadget attributes |
|
extern |
Set the gadget device BCD release number.
g | Pointer to gadget |
bcdDevice | BCD release number |
|
extern |
Set the gadget device BCD USB version.
g | Pointer to gadget |
bcdUSB | BCD USB version |
|
extern |
Set the USB gadget device class code.
g | Pointer to gadget |
bDeviceClass | USB device class code |
|
extern |
Set the maximum packet size for a gadget.
g | Pointer to gadget |
bMaxPacketSize0 | Maximum packet size |
|
extern |
Set the USB gadget protocol code.
g | Pointer to gadget |
bDeviceProtocol | USB protocol code |
|
extern |
Set the USB gadget device subclass code.
g | Pointer to gadget |
bDeviceSubClass | USB device subclass code |
|
extern |
Set the manufacturer name for a gadget.
g | Pointer to gadget |
lang | USB language ID |
mnf | Manufacturer |
|
extern |
Set the USB gadget OS Descriptor.
g | Pointer to gadget |
g_os_descs | Structure to be filled |
|
extern |
Set the product name for a gadget.
g | Pointer to gadget |
lang | USB language ID |
prd | Product |
|
extern |
Set the USB gadget product id.
g | Pointer to gadget |
idProduct | USB device product id |
|
extern |
Set the serial number for a gadget.
g | Pointer to gadget |
lang | USB language ID |
ser | Serial number |
|
extern |
Set selected string.
g | Pointer to gadget |
str | Code of selected string |
val | value to be set |
|
extern |
Set the USB gadget strings.
g | Pointer to gadget |
lang | USB language ID |
g_strs | Gadget attributes |
|
extern |
Set the USB gadget vendor id.
g | Pointer to gadget |
idVendor | USB device vendor id |
|
extern |
Set OS Descriptor compatibility of given function.
f | Pointer to function |
iname | Interface name |
f_os_desc | OS Descriptor compatibility to be set |
|
extern |
Set configuration for OS Descriptors.
g | Pointer to gadget |
c | Pointer to config |
|
extern |
Get the short description of error.
e | error code |