|
@@ -115,6 +115,49 @@ find_media_node(libmegapixels_camera *camera, const char *media_name, const char
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // Find the flash
|
|
|
+ for (int i = 0; i < topology.num_entities; i++) {
|
|
|
+ if (entities[i].function == MEDIA_ENT_F_FLASH) {
|
|
|
+ for (int j = 0; j < topology.num_links; j++) {
|
|
|
+ if (links[j].sink_id != entities[i].id) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ for (int k = 0; k < topology.num_interfaces; k++) {
|
|
|
+ if (interfaces[k].id != links[j].source_id) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ camera->flash_path = find_path_for_devnode(interfaces[k].devnode);
|
|
|
+ camera->flash_type = LIBMEGAPIXELS_FLASH_V4L;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // Find the lens actuator
|
|
|
+ for (int i = 0; i < topology.num_entities; i++) {
|
|
|
+ if (entities[i].function == MEDIA_ENT_F_LENS) {
|
|
|
+ for (int j = 0; j < topology.num_links; j++) {
|
|
|
+ if (links[j].sink_id != entities[i].id) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ for (int k = 0; k < topology.num_interfaces; k++) {
|
|
|
+ if (interfaces[k].id != links[j].source_id) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ camera->lens_path = find_path_for_devnode(interfaces[k].devnode);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// Find the bridge
|
|
|
for (int i = 0; i < topology.num_entities; i++) {
|
|
|
if (entities[i].function == MEDIA_ENT_F_IO_V4L) {
|
|
@@ -179,7 +222,7 @@ find_media_node(libmegapixels_camera *camera, const char *media_name, const char
|
|
|
int
|
|
|
load_camera(libmegapixels_devconfig *config, config_t *cfg, const char *name, int lint)
|
|
|
{
|
|
|
- const char *sensor_driver, *bridge_driver;
|
|
|
+ const char *sensor_driver, *bridge_driver, *flashpath;
|
|
|
config_setting_t *root = config_lookup(cfg, name);
|
|
|
log_debug("Loading camera '%s'\n", name);
|
|
|
if (!config_setting_lookup_string(root, "SensorDriver", &sensor_driver)) {
|
|
@@ -195,6 +238,11 @@ load_camera(libmegapixels_devconfig *config, config_t *cfg, const char *name, in
|
|
|
camera->sensor_fd = 0;
|
|
|
camera->media_fd = 0;
|
|
|
camera->video_fd = 0;
|
|
|
+ camera->flash_fd = 0;
|
|
|
+ camera->lens_fd = 0;
|
|
|
+ camera->flash_path = NULL;
|
|
|
+ camera->lens_path = NULL;
|
|
|
+ camera->flash_type = LIBMEGAPIXELS_FLASH_SCREEN;
|
|
|
|
|
|
// Don't access hardware in linting mode
|
|
|
if (lint == 0) {
|
|
@@ -216,6 +264,18 @@ load_camera(libmegapixels_devconfig *config, config_t *cfg, const char *name, in
|
|
|
camera->index = config->count;
|
|
|
config->cameras[config->count++] = camera;
|
|
|
|
|
|
+ if (config_setting_lookup_string(root, "FlashPath", &flashpath)) {
|
|
|
+ camera->flash_path = strdup(flashpath);
|
|
|
+ camera->flash_type = LIBMEGAPIXELS_FLASH_LED;
|
|
|
+ }
|
|
|
+ int flashDisplay = 0;
|
|
|
+ if (config_setting_lookup_bool(root, "FlashDisplay", &flashDisplay)) {
|
|
|
+ if (flashDisplay) {
|
|
|
+ camera->flash_path = NULL;
|
|
|
+ camera->flash_type = LIBMEGAPIXELS_FLASH_SCREEN;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
config_setting_t *modes = config_setting_lookup(root, "Modes");
|
|
|
config_setting_t *mode;
|
|
|
|