From 39da7d7fa2833ba840e1db95e2860038e3ceee25 Mon Sep 17 00:00:00 2001 From: Tony Layher Date: Sun, 16 Nov 2014 03:27:31 -0500 Subject: [PATCH] msm8974-common: Fixup CameraWrapper for L -Also clean up code and get rid of warnings. Clean up from Arne Coucheron works on other samsung wrappers. -Requires device tree to include a CameraParametersExtra.h for the specific device. Change-Id: Icab1b9ec17710861f735a05dcdd87dac932c63c2 --- BoardConfigCommon.mk | 1 - camera/Android.mk | 5 ++++- camera/CameraWrapper.cpp | 46 +++++++++++++++++++++++----------------- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk index 5849636..2f28fbc 100644 --- a/BoardConfigCommon.mk +++ b/BoardConfigCommon.mk @@ -32,7 +32,6 @@ BOARD_HAVE_BLUETOOTH := true # Camera TARGET_PROVIDES_CAMERA_HAL := true USE_DEVICE_SPECIFIC_CAMERA := true -COMMON_GLOBAL_CFLAGS += -DSAMSUNG_CAMERA_HARDWARE # Charger BOARD_BATTERY_DEVICE_NAME := "battery" diff --git a/camera/Android.mk b/camera/Android.mk index 7441b83..b351f2a 100644 --- a/camera/Android.mk +++ b/camera/Android.mk @@ -9,8 +9,11 @@ LOCAL_SRC_FILES := \ LOCAL_SHARED_LIBRARIES := \ libhardware liblog libcamera_client libutils +LOCAL_C_INCLUDES := \ + system/media/camera/include + LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw -LOCAL_MODULE := camera.msm8974 +LOCAL_MODULE := camera.$(TARGET_BOARD_PLATFORM) LOCAL_MODULE_TAGS := optional include $(BUILD_SHARED_LIBRARY) diff --git a/camera/CameraWrapper.cpp b/camera/CameraWrapper.cpp index c0e41d0..a4486f9 100644 --- a/camera/CameraWrapper.cpp +++ b/camera/CameraWrapper.cpp @@ -48,23 +48,27 @@ static int camera_send_command(struct camera_device * device, int32_t cmd, int32_t arg1, int32_t arg2); static struct hw_module_methods_t camera_module_methods = { - open: camera_device_open + .open = camera_device_open }; camera_module_t HAL_MODULE_INFO_SYM = { - common: { + .common = { tag: HARDWARE_MODULE_TAG, - version_major: 1, - version_minor: 0, - id: CAMERA_HARDWARE_MODULE_ID, - name: "MSM8974 Camera Wrapper", - author: "The CyanogenMod Project", - methods: &camera_module_methods, - dso: NULL, /* remove compilation warnings */ - reserved: {0}, /* remove compilation warnings */ + .module_api_version = CAMERA_MODULE_API_VERSION_1_0, + .hal_api_version = HARDWARE_HAL_API_VERSION, + .id = CAMERA_HARDWARE_MODULE_ID, + .name = "MSM8974 Camera Wrapper", + .author = "The CyanogenMod Project", + .methods = &camera_module_methods, + .dso = NULL, /* remove compilation warnings */ + .reserved = {0}, /* remove compilation warnings */ }, - get_number_of_cameras: camera_get_number_of_cameras, - get_camera_info: camera_get_camera_info, + .get_number_of_cameras = camera_get_number_of_cameras, + .get_camera_info = camera_get_camera_info, + .set_callbacks = NULL, /* remove compilation warnings */ + .get_vendor_tag_ops = NULL, /* remove compilation warnings */ + .open_legacy = NULL, /* remove compilation warnings */ + .reserved = {0}, /* remove compilation warnings */ }; typedef struct wrapper_camera_device { @@ -98,7 +102,8 @@ static int check_vendor_module() #define KEY_VIDEO_HFR_VALUES "video-hfr-values" -static char * camera_fixup_getparams(int id, const char * settings) +static char *camera_fixup_getparams(int __attribute__((unused)) id, + const char *settings) { android::CameraParameters params; params.unflatten(android::String8(settings)); @@ -145,10 +150,10 @@ char * camera_fixup_setparams(struct camera_device * device, const char * settin bool isVideo = recordingHint && !strcmp(recordingHint, "true"); if (isVideo) { - params.set("dis", "disable"); - params.set(android::CameraParameters::KEY_ZSL, "off"); + params.set(android::CameraParameters::KEY_DIS, android::CameraParameters::DIS_DISABLE); + params.set(android::CameraParameters::KEY_ZSL, android::CameraParameters::ZSL_OFF); } else { - params.set(android::CameraParameters::KEY_ZSL, "on"); + params.set(android::CameraParameters::KEY_ZSL, android::CameraParameters::ZSL_ON); } android::String8 strParams = params.flatten(); @@ -528,12 +533,15 @@ int camera_device_open(const hw_module_t* module, const char* name, memset(camera_device, 0, sizeof(*camera_device)); camera_device->id = cameraid; - rv = gVendorModule->common.methods->open((const hw_module_t*)gVendorModule, name, (hw_device_t**)&(camera_device->vendor)); + rv = gVendorModule->common.methods->open( + (const hw_module_t*)gVendorModule, name, + (hw_device_t**)&(camera_device->vendor)); if (rv) { ALOGE("vendor camera open fail"); goto fail; } - ALOGI("%s: got vendor camera device 0x%08X", __FUNCTION__, (uintptr_t)(camera_device->vendor)); + ALOGI("%s: got vendor camera device 0x%08X", + __FUNCTION__, (uintptr_t)(camera_device->vendor)); camera_ops = (camera_device_ops_t*)malloc(sizeof(*camera_ops)); if(!camera_ops) @@ -546,7 +554,7 @@ int camera_device_open(const hw_module_t* module, const char* name, memset(camera_ops, 0, sizeof(*camera_ops)); camera_device->base.common.tag = HARDWARE_DEVICE_TAG; - camera_device->base.common.version = 0; + camera_device->base.common.version = CAMERA_DEVICE_API_VERSION_1_0; camera_device->base.common.module = (hw_module_t *)(module); camera_device->base.common.close = camera_device_close; camera_device->base.ops = camera_ops;