|
|
|
@ -2,6 +2,7 @@ |
|
|
|
|
#include "utils/array.h" |
|
|
|
|
#include "usb/usb.h" |
|
|
|
|
#include <dlfcn.h> |
|
|
|
|
#include <string.h> |
|
|
|
|
|
|
|
|
|
struct DEVICE |
|
|
|
|
{ |
|
|
|
@ -39,7 +40,21 @@ device_t* device_register(void* driver, void* handle) |
|
|
|
|
char* device_get_image(device_t* device) |
|
|
|
|
{ |
|
|
|
|
char* (*getimage_fn)(void*) = dlsym(device->driver, "driver_get_image"); |
|
|
|
|
return getimage_fn(device->handle); |
|
|
|
|
char* image = getimage_fn(device->handle); |
|
|
|
|
size_t image_len = strlen(image); |
|
|
|
|
|
|
|
|
|
// TODO : Change PATH so that 'build' becomes executable directory
|
|
|
|
|
char* path = "build/drivers/assets/"; |
|
|
|
|
size_t path_len = strlen(path); |
|
|
|
|
|
|
|
|
|
char* tr = malloc(image_len + path_len + 1); |
|
|
|
|
memcpy(tr, path, path_len); |
|
|
|
|
memcpy(tr + path_len, image, image_len); |
|
|
|
|
*(tr + path_len + image_len) = 0; |
|
|
|
|
|
|
|
|
|
printf("path= %s\n", tr); |
|
|
|
|
|
|
|
|
|
return tr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
char* device_get_name(device_t* device) |
|
|
|
|