Device Management¶
-
int
libmk_detect_devices
(LibMK_Model **model_list)¶ Search for devices and put the found models in an array.
Perform a search for devices using libusb and store all the found supported devices in an allocated array of LibMK_Model.
- Return
The number of found devices, or a LibMK_Result error code.
- Parameters
model_list
: Pointer to an array of LibMK_Model enums. Required memory for storage is allocated by the function and must be freed by the caller.
-
LibMK_Device *
libmk_open_device
(libusb_device *device)¶ Internal function. Loads the details of a device.
Loads the details of a USB device into a
LibMK_Device struct instance. The details are used by libmk_detect_devices to determine whether a device is supported.- Return
pointer to LibMK_Device instance if successful, NULL otherwise
- Parameters
device
: libusb device descriptor to load details for
-
LibMK_Device *
libmk_create_device
(LibMK_Model model, libusb_device *device, char *iManufacturer, char *iProduct, int bVendor, int bDevice)¶ Internal function. Allocate and fill LibMK_Device struct.
-
void
libmk_free_device
(LibMK_Device *device)¶ Internal function. Free memory of allocated LibMK_Device.
-
LibMK_Device *
libmk_append_device
(LibMK_Device *first, LibMK_Device *device)¶ Internal function. Build linked list with LibMK_Device.
-
LibMK_Model
libmk_ident_model
(char *product)¶ Identify a model based on its USB descriptor product string.