Last active
June 20, 2016 17:25
-
-
Save invisiblek/263e87a805b5f1f6ef330e304d27355e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/camera/CameraWrapper.cpp b/camera/CameraWrapper.cpp | |
index 56e45a8..f600a70 100644 | |
--- a/camera/CameraWrapper.cpp | |
+++ b/camera/CameraWrapper.cpp | |
@@ -33,6 +33,7 @@ | |
#include <hardware/camera.h> | |
#include <camera/Camera.h> | |
#include <camera/CameraParameters.h> | |
+#include <dirent.h> | |
#include <dlfcn.h> | |
#define BACK_CAMERA_ID 0 | |
@@ -53,6 +54,7 @@ static int camera_get_number_of_cameras(void); | |
static int camera_get_camera_info(int camera_id, struct camera_info *info); | |
static int camera_send_command(struct camera_device * device, int32_t cmd, | |
int32_t arg1, int32_t arg2); | |
+static void nuke_logs(); | |
static struct hw_module_methods_t camera_module_methods = { | |
.open = camera_device_open | |
@@ -543,6 +545,8 @@ static int camera_device_close(hw_device_t *device) | |
if (wrapper_dev->base.ops) | |
free(wrapper_dev->base.ops); | |
free(wrapper_dev); | |
+ | |
+ nuke_logs(); | |
done: | |
#ifdef HEAPTRACKER | |
heaptracker_free_leaked_memory(); | |
@@ -685,3 +689,24 @@ static int camera_get_camera_info(int camera_id, struct camera_info *info) | |
return 0; | |
return gVendorModule->get_camera_info(camera_id, info); | |
} | |
+ | |
+static void nuke_logs() { | |
+ // The camera hal unecessarily creates a metric fuckton of log files | |
+ // at /data/RS_*.log | |
+ // Kill them with fireeee | |
+ | |
+ DIR *f = opendir("/data/"); | |
+ struct dirent *next_file; | |
+ char filepath[256]; | |
+ | |
+ while ( (next_file = readdir(f)) != NULL ) | |
+ { | |
+ // build the path for each file in the folder | |
+ if (strncmp(next_file->d_name, "RS_", 3)) { | |
+ sprintf(filepath, "%s/%s", "/data/", next_file->d_name); | |
+ remove(filepath); | |
+ } | |
+ } | |
+ closedir(f); | |
+} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment