| 
    libusbg-0.1.0
   
    
   
   | 
  
  
  
 
Data Structures | |
| struct | state | 
| State of the gadget devices in the system.  More... | |
| struct | gadget | 
| USB gadget device attributes.  More... | |
| struct | config | 
| USB gadget configuration attributes.  More... | |
| struct | serial_attrs | 
| Attributes for Serial, ACM, and OBEX USB functions.  More... | |
| struct | net_attrs | 
| Attributes for ECM, ECM subset, NCM, EEM, and RNDIS USB functions.  More... | |
| struct | phonet_attrs | 
| Attributes for the phonet USB function.  More... | |
| union | attrs | 
| Attributes for a given function type.  More... | |
| struct | function | 
| USB gadget function attributes.  More... | |
| struct | binding | 
| Describes a binding between a USB gadget configuration and a USB gadget function.  More... | |
Defines | |
| #define | DEFAULT_UDC NULL | 
| #define | LANG_US_ENG 0x0409 | 
| #define | usbg_for_each_gadget(g, s) TAILQ_FOREACH(g, &s->gadgets, gnode) | 
| #define | usbg_for_each_function(f, g) TAILQ_FOREACH(f, &g->functions, fnode) | 
| #define | usbg_for_each_config(c, g) TAILQ_FOREACH(c, &g->configs, cnode) | 
| #define | usbg_for_each_binding(b, c) TAILQ_FOREACH(b, &c->bindings, bnode) | 
Enumerations | |
| enum | function_type {  F_SERIAL, F_ACM, F_OBEX, F_ECM, F_SUBSET, F_NCM, F_EEM, F_RNDIS, F_PHONET }  | 
| Supported USB function types.  | |
Functions | |
| struct state * | usbg_init (char *configfs_path) | 
| Initialize the libusbg library state.   | |
| void | usbg_cleanup (struct state *s) | 
| Clean up the libusbg library state.   | |
| struct gadget * | usbg_get_gadget (struct state *s, const char *name) | 
| Get a gadget device by name.   | |
| struct function * | usbg_get_function (struct gadget *g, const char *name) | 
| Get a function by name.   | |
| struct config * | usbg_get_config (struct gadget *g, const char *name) | 
| Get a configuration by name.   | |
| struct gadget * | usbg_create_gadget (struct state *s, char *name, int vendor, int product) | 
| Create a new USB gadget device.   | |
| void | usbg_set_gadget_device_class (struct gadget *g, int dclass) | 
| Set the USB gadget device class code.   | |
| void | usbg_set_gadget_device_protocol (struct gadget *g, int dproto) | 
| Set the USB gadget protocol code.   | |
| void | usbg_set_gadget_device_subclass (struct gadget *g, int dsubclass) | 
| Set the USB gadget device subclass code.   | |
| void | usbg_set_gadget_device_max_packet (struct gadget *g, int maxpacket) | 
| Set the maximum packet size for a gadget.   | |
| void | usbg_set_gadget_device_bcd_device (struct gadget *g, int bcddevice) | 
| Set the gadget device BCD release number.   | |
| void | usbg_set_gadget_device_bcd_usb (struct gadget *g, int bcdusb) | 
| Set the gadget device BCD USB version.   | |
| void | usbg_set_gadget_serial_number (struct gadget *g, int lang, char *ser) | 
| Set the serial number for a gadget.   | |
| void | usbg_set_gadget_manufacturer (struct gadget *g, int lang, char *mnf) | 
| Set the manufacturer name for a gadget.   | |
| void | usbg_set_gadget_product (struct gadget *g, int lang, char *prd) | 
| Set the product name for a gadget.   | |
| struct function * | usbg_create_function (struct gadget *g, enum function_type type, char *instance) | 
| Create a new USB gadget function.   | |
| struct config * | usbg_create_config (struct gadget *g, char *name) | 
| Create a new USB gadget configuration.   | |
| void | usbg_set_config_max_power (struct config *c, int maxpower) | 
| Set the configuration maximum power.   | |
| void | usbg_set_config_bm_attrs (struct config *c, int bmattrs) | 
| Set the configuration bitmap attributes.   | |
| void | usbg_set_config_string (struct config *c, int lang, char *string) | 
| Set the configuration string.   | |
| int | usbg_add_config_function (struct config *c, char *name, struct function *f) | 
| Add a function to a configuration.   | |
| int | usbg_get_udcs (struct dirent ***udc_list) | 
| Get a list of UDC devices on the system.   | |
| void | usbg_enable_gadget (struct gadget *g, char *udc) | 
| Enable a USB gadget device.   | |
| void | usbg_disable_gadget (struct gadget *g) | 
| Disable a USB gadget device.   | |
| void | usbg_set_net_dev_addr (struct function *f, struct ether_addr *addr) | 
| Set USB function network device address.   | |
| void | usbg_set_net_host_addr (struct function *f, struct ether_addr *addr) | 
| Set USB function network host address.   | |
| void | usbg_set_net_qmult (struct function *f, int qmult) | 
| Set USB function network qmult.   | |
Variables | |
| const char * | function_names [] | 
| Name strings for supported USB function types.   | |
Public API for USB gadget-configfs library
| struct state | 
State of the gadget devices in the system.
Public Member Functions | |
| TAILQ_HEAD (ghead, gadget) gadgets | |
Data Fields | |
| char | path [256] | 
| struct gadget | 
USB gadget device attributes.
Public Member Functions | |
| TAILQ_ENTRY (gadget) gnode | |
| TAILQ_HEAD (chead, config) configs | |
| TAILQ_HEAD (fhead, function) functions | |
Data Fields | |
| char | name [40] | 
| char | path [256] | 
| char | udc [256] | 
| int | dclass | 
| int | dsubclass | 
| int | dproto | 
| int | maxpacket | 
| int | bcddevice | 
| int | bcdusb | 
| int | product | 
| int | vendor | 
| char | str_ser [256] | 
| char | str_mnf [256] | 
| char | str_prd [256] | 
| struct state * | parent | 
| struct config | 
USB gadget configuration attributes.
Public Member Functions | |
| TAILQ_ENTRY (config) cnode | |
| TAILQ_HEAD (bhead, binding) bindings | |
Data Fields | |
| struct gadget * | parent | 
| char | name [40] | 
| char | path [256] | 
| int | maxpower | 
| int | bmattrs | 
| char | str_cfg [256] | 
| struct net_attrs | 
| union attrs | 
Attributes for a given function type.
| Data Fields | ||
|---|---|---|
| struct net_attrs | net | |
| struct phonet_attrs | phonet | |
| struct serial_attrs | serial | |
| struct function | 
USB gadget function attributes.
Public Member Functions | |
| TAILQ_ENTRY (function) fnode | |
Data Fields | |
| struct gadget * | parent | 
| char | name [40] | 
| char | path [256] | 
| enum function_type | type | 
| union attrs | attr | 
| struct binding | 
Describes a binding between a USB gadget configuration and a USB gadget function.
Public Member Functions | |
| TAILQ_ENTRY (binding) bnode | |
Data Fields | |
| struct config * | parent | 
| struct function * | target | 
| char | name [40] | 
| char | path [256] | 
| #define usbg_for_each_binding | ( | b, | |
| c | |||
| ) | TAILQ_FOREACH(b, &c->bindings, bnode) | 
Iterates over each binding
| #define usbg_for_each_config | ( | c, | |
| g | |||
| ) | TAILQ_FOREACH(c, &g->configs, cnode) | 
Iterates over each config
| #define usbg_for_each_function | ( | f, | |
| g | |||
| ) | TAILQ_FOREACH(f, &g->functions, fnode) | 
Iterates over each function
| #define usbg_for_each_gadget | ( | g, | |
| s | |||
| ) | TAILQ_FOREACH(g, &s->gadgets, gnode) | 
Iterates over each gadget
| int usbg_add_config_function | ( | struct config * | c, | 
| char * | name, | ||
| struct function * | f | ||
| ) | 
Add a function to a configuration.
| c | Pointer to config | 
| name | Name of configuration function binding | 
| f | Pointer to function | 
| void usbg_cleanup | ( | struct state * | s | ) | 
Clean up the libusbg library state.
| s | Pointer to state | 
| struct config* usbg_create_config | ( | struct gadget * | g, | 
| char * | name | ||
| ) |  [read] | 
        
Create a new USB gadget configuration.
| g | Pointer to gadget | 
| name | Name of configuration | 
| struct function* usbg_create_function | ( | struct gadget * | g, | 
| enum function_type | type, | ||
| char * | instance | ||
| ) |  [read] | 
        
Create a new USB gadget function.
| g | Pointer to gadget | 
| type | Type of function | 
| instance | Function instance name | 
| struct gadget* usbg_create_gadget | ( | struct state * | s, | 
| char * | name, | ||
| int | vendor, | ||
| int | product | ||
| ) |  [read] | 
        
Create a new USB gadget device.
| s | Pointer to state | 
| name | Name of the gadget | 
| vendor | Gadget vendor ID | 
| product | Gadget product ID | 
| void usbg_disable_gadget | ( | struct gadget * | g | ) | 
Disable a USB gadget device.
| g | Pointer to gadget | 
| void usbg_enable_gadget | ( | struct gadget * | g, | 
| char * | udc | ||
| ) | 
Enable a USB gadget device.
| g | Pointer to gadget | 
| udc | Name of UDC to enable gadget | 
| struct config* usbg_get_config | ( | struct gadget * | g, | 
| const char * | name | ||
| ) |  [read] | 
        
Get a configuration by name.
| g | Pointer to gadget | 
| name | Name of the configuration | 
| struct function* usbg_get_function | ( | struct gadget * | g, | 
| const char * | name | ||
| ) |  [read] | 
        
Get a function by name.
| g | Pointer to gadget | 
| name | Name of the function | 
| struct gadget* usbg_get_gadget | ( | struct state * | s, | 
| const char * | name | ||
| ) |  [read] | 
        
Get a gadget device by name.
| s | Pointer to state | 
| name | Name of the gadget device | 
| int usbg_get_udcs | ( | struct dirent *** | udc_list | ) | 
Get a list of UDC devices on the system.
| udc_list | Pointer to pointer to dirent pointer | 
Initialize the libusbg library state.
| configfs_path | Path to the mounted configfs filesystem | 
| void usbg_set_config_bm_attrs | ( | struct config * | c, | 
| int | bmattrs | ||
| ) | 
Set the configuration bitmap attributes.
| c | Pointer to config | 
| bmattrs | Configuration characteristics | 
| void usbg_set_config_max_power | ( | struct config * | c, | 
| int | maxpower | ||
| ) | 
Set the configuration maximum power.
| c | Pointer to config | 
| maxpower | Maximum power (in 2 mA units) | 
| void usbg_set_config_string | ( | struct config * | c, | 
| int | lang, | ||
| char * | string | ||
| ) | 
Set the configuration string.
| c | Pointer to config | 
| lang | USB language ID | 
| string | Configuration description | 
| void usbg_set_gadget_device_bcd_device | ( | struct gadget * | g, | 
| int | bcddevice | ||
| ) | 
Set the gadget device BCD release number.
| g | Pointer to gadget | 
| bcddevice | BCD release number | 
| void usbg_set_gadget_device_bcd_usb | ( | struct gadget * | g, | 
| int | bcdusb | ||
| ) | 
Set the gadget device BCD USB version.
| g | Pointer to gadget | 
| bcdusb | BCD USB version | 
| void usbg_set_gadget_device_class | ( | struct gadget * | g, | 
| int | dclass | ||
| ) | 
Set the USB gadget device class code.
| g | Pointer to gadget | 
| dclass | USB device class code | 
| void usbg_set_gadget_device_max_packet | ( | struct gadget * | g, | 
| int | maxpacket | ||
| ) | 
Set the maximum packet size for a gadget.
| g | Pointer to gadget | 
| maxpacket | Maximum packet size | 
| void usbg_set_gadget_device_protocol | ( | struct gadget * | g, | 
| int | dproto | ||
| ) | 
Set the USB gadget protocol code.
| g | Pointer to gadget | 
| dprotocol | USB protocol code | 
| void usbg_set_gadget_device_subclass | ( | struct gadget * | g, | 
| int | dsubclass | ||
| ) | 
Set the USB gadget device subclass code.
| g | Pointer to gadget | 
| dsubclass | USB device subclass code | 
| void usbg_set_gadget_manufacturer | ( | struct gadget * | g, | 
| int | lang, | ||
| char * | mnf | ||
| ) | 
Set the manufacturer name for a gadget.
| g | Pointer to gadget | 
| lang | USB language ID | 
| mnf | Manufacturer | 
| void usbg_set_gadget_product | ( | struct gadget * | g, | 
| int | lang, | ||
| char * | prd | ||
| ) | 
Set the product name for a gadget.
| g | Pointer to gadget | 
| lang | USB language ID | 
| prd | Product | 
| void usbg_set_gadget_serial_number | ( | struct gadget * | g, | 
| int | lang, | ||
| char * | ser | ||
| ) | 
Set the serial number for a gadget.
| g | Pointer to gadget | 
| lang | USB language ID | 
| ser | Serial number | 
| void usbg_set_net_dev_addr | ( | struct function * | f, | 
| struct ether_addr * | addr | ||
| ) | 
Set USB function network device address.
| f | Pointer to function | 
| addr | Pointer to Ethernet address | 
| void usbg_set_net_host_addr | ( | struct function * | f, | 
| struct ether_addr * | addr | ||
| ) | 
Set USB function network host address.
| f | Pointer to function | 
| addr | Pointer to Ethernet address | 
| void usbg_set_net_qmult | ( | struct function * | f, | 
| int | qmult | ||
| ) | 
Set USB function network qmult.
| f | Pointer to function | 
| qmult | Queue length multiplier | 
{
        "gser",
        "acm",
        "obex",
        "ecm",
        "geth",
        "ncm",
        "eem",
        "rndis",
        "phonet",
}
Name strings for supported USB function types.
 1.7.6.1