diff options
author | jihye1128.kim <jihye1128.kim@samsung.com> | 2013-04-18 11:53:25 +0900 |
---|---|---|
committer | jihye1128.kim <jihye1128.kim@samsung.com> | 2013-04-18 11:53:25 +0900 |
commit | 276af9812b4926978ad0da6d17c0f532860ddf86 (patch) | |
tree | e18020b7a109dab2bbf63dad64de17f2237f0aa9 | |
parent | a661649a5e080b354aa0e1b62e6fa592ad101842 (diff) | |
parent | cc5e516c638be6a48a76218e1c092f67e60f16f0 (diff) | |
download | device-manager-plugin-emul-276af9812b4926978ad0da6d17c0f532860ddf86.tar.gz device-manager-plugin-emul-276af9812b4926978ad0da6d17c0f532860ddf86.tar.bz2 device-manager-plugin-emul-276af9812b4926978ad0da6d17c0f532860ddf86.zip |
Merge branch 'master' into tizen_2.1
Conflicts:
include/devman_define_node_path.h
include/devman_plugin_intf.h
packaging/device-manager-plugin-maru.spec
src/device_manager_io.c
src/device_manager_plugin_maru.c
-rw-r--r-- | AUTHORS | 13 | ||||
-rw-r--r--[-rwxr-xr-x] | LICENSE.Flora (renamed from LICENSE) | 2 | ||||
-rw-r--r-- | NOTICE | 3 | ||||
-rw-r--r-- | include/devman_define_node_path.h | 30 | ||||
-rw-r--r-- | include/devman_plugin_intf.h | 52 | ||||
-rw-r--r-- | packaging/device-manager-plugin-maru.spec | 8 | ||||
-rw-r--r-- | src/device_manager_io.c | 45 | ||||
-rw-r--r-- | src/device_manager_plugin_maru.c | 252 |
8 files changed, 281 insertions, 124 deletions
@@ -0,0 +1,13 @@ +YeongKyoon Lee <yeongkyoon.lee@samsung.com> +DaiYoung Kim <daiyoung777.kim@samsung.com> +SeokYeon Hwang <syeon.hwang@samsung.com> +SangJin Kim <sangjin3.kim@samsung.com> +KiTae Kim <kt920.kim@samsung.com> +JinHyung Jo <jinhyung.jo@samsung.com> +SungMin Ha <sungmin82.ha@samsung.com> +MunKyu Im <munkyu.im@samsung.com> +JiHye Kim <jihye1128.kim@samsung.com> +GiWoong Kim <giwoong.kim@samsung.com> +SooYoung Ha <yoosah.ha@samsnung.com> +HyunGoo Kang <hyungoo1.kang@samsung.com> + diff --git a/LICENSE b/LICENSE.Flora index 7ccb5b5..ac633bc 100755..100644 --- a/LICENSE +++ b/LICENSE.Flora @@ -2,7 +2,7 @@ Flora License Version 1.0, May, 2012 -http://www.tizenopensource.org/license +http://www.floralicense.org/license/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION @@ -0,0 +1,3 @@ +Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved. +Except as noted, this software is licensed under Flora License, Version 1. +Please, see the LICENSE.Flora file for Flora License Version 1, terms and conditions. diff --git a/include/devman_define_node_path.h b/include/devman_define_node_path.h index 4df6558..57142d9 100644 --- a/include/devman_define_node_path.h +++ b/include/devman_define_node_path.h @@ -1,3 +1,19 @@ +/* +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Licensed under the Flora License, Version 1.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + #ifndef __DEVMAN_DEFINE_NODE_PATH_H #define __DEVMAN_DEFINE_NODE_PATH_H @@ -9,11 +25,18 @@ #define LCD_PATH "/sys/class/lcd/" #define LCD_ACL_CONTROL_PATH LCD_PATH"%s/acl_control" #define LCD_POWER_PATH LCD_PATH"%s/lcd_power" +#define IMAGE_ENHANCE_PATH "/sys/class/extension/mdnie/%s" +#define IMAGE_ENHANCE_PATH_INFO "/sys/class/extension/mdnie" //#define DISPLAY_FRAME_RATE_PATH "/sys/devices/platform/maru-display/devfreq/maru-display/max_freq" -#define UART_PATH "/sys/devices/platform/uart-select/path" -#define USB_PATH "/sys/devices/platform/usb-switch/path" +//#define UART_PATH "/sys/devices/platform/uart-select/path" +//#define USB_PATH "/sys/devices/platform/usb-switch/path" + +#define UART_PATH "/sys/devices/virtual/sec/switch/uart_sel" +#define USB_PATH "/sys/devices/virtual/sec/switch/usb_sel" +#define UART_PATH_TRATS "/sys/devices/platform/uart-select/path" +#define USB_PATH_TRATS "/sys/devices/platform/usb-select/path" #define HAPTIC_VIBETONES_LEVEL_PATH "/sys/class/haptic/vibetones/level" #define HAPTIC_VIBETONES_LEVEL_MAX_PATH "/sys/class/haptic/vibetones/level_max" @@ -21,6 +44,7 @@ #define HAPTIC_VIBETONES_ONESHOT_PATH "/sys/class/haptic/vibetones/oneshot" #define BATTERY_CAPACITY_PATH "/sys/class/power_supply/battery/capacity" +#define BATTERY_CAPACITY_RAW_PATH "/sys/class/power_supply/battery/capacity_raw" #define BATTERY_CHARGE_FULL_PATH "/sys/class/power_supply/battery/charge_full" #define BATTERY_CHARGE_NOW_PATH "/sys/class/power_supply/battery/charge_now" #define BATTERY_PRESENT_PATH "/sys/class/power_supply/battery/present" @@ -37,6 +61,8 @@ #define LEDS_TORCH_MAX_BRIGHTNESS_PATH "/sys/class/leds/leds-torch/max_brightness" #define LEDS_TORCH_BRIGHTNESS_PATH "/sys/class/leds/leds-torch/brightness" +//#define LEDS_TORCH_MAX_BRIGHTNESS_PATH "/sys/class/camera/flash/max_brightness" +//#define LEDS_TORCH_BRIGHTNESS_PATH "/sys/class/camera/flash/rear_flash" #define POWER_STATE_PATH "/sys/power/state" #define POWER_WAKEUP_COUNT_PATH "/sys/power/wakeup_count" diff --git a/include/devman_plugin_intf.h b/include/devman_plugin_intf.h index bc0f03e..f973719 100644 --- a/include/devman_plugin_intf.h +++ b/include/devman_plugin_intf.h @@ -1,22 +1,17 @@ /* - * devman - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: DongGi Jang <dg0402.jang@samsung.com> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Licensed under the Flora License, Version 1.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. */ @@ -56,17 +51,26 @@ enum { enum { POWER_STATE_SUSPEND = 0, + POWER_STATE_PRE_SUSPEND, + POWER_STATE_POST_RESUME, }; +enum { + LUX_DECREMENT, + LUX_NOCHANGE, + LUX_INCREMENT, +}; + + typedef struct { int (*OEM_sys_get_display_count) (int *value); - int (*OEM_sys_get_backlight_min_brightness) (int index, int *value); + int (*OEM_sys_get_backlight_min_brightness) (int index, int *value); int (*OEM_sys_get_backlight_max_brightness) (int index, int *value); int (*OEM_sys_get_backlight_brightness) (int index, int *value, int power_saving); int (*OEM_sys_set_backlight_brightness) (int index, int value, int power_saving); - int (*OEM_sys_set_backlight_dimming) (int index, int value); + int (*OEM_sys_set_backlight_dimming) (int index, int value); int (*OEM_sys_get_backlight_acl_control) (int index, int *value); int (*OEM_sys_set_backlight_acl_control) (int index, int value); @@ -95,6 +99,12 @@ typedef struct { int (*OEM_sys_get_usb_path) (int *value); int (*OEM_sys_set_usb_path) (int value); + int (*OEM_sys_get_haptic_motor_level_max) (int *value); + int (*OEM_sys_get_haptic_motor_level) (int *value); + int (*OEM_sys_set_haptic_motor_level) (int value); + int (*OEM_sys_set_haptic_motor_enable) (int value); + int (*OEM_sys_set_haptic_motor_oneshot) (int value); + int (*OEM_sys_get_haptic_vibetones_level_max) (int *value); int (*OEM_sys_get_haptic_vibetones_level) (int *value); int (*OEM_sys_set_haptic_vibetones_level) (int value); @@ -147,6 +157,8 @@ typedef struct { int (*OEM_sys_set_cpufreq_scaling_max_freq) (int value); int (*OEM_sys_get_cpufreq_scaling_min_freq) (int *value); int (*OEM_sys_set_cpufreq_scaling_min_freq) (int value); + + int (*OEM_sys_get_backlight_brightness_by_lux) (int lux, int status); } OEM_sys_devman_plugin_interface; const OEM_sys_devman_plugin_interface *OEM_sys_get_devman_plugin_interface(); diff --git a/packaging/device-manager-plugin-maru.spec b/packaging/device-manager-plugin-maru.spec index 42d20e2..a0ea737 100644 --- a/packaging/device-manager-plugin-maru.spec +++ b/packaging/device-manager-plugin-maru.spec @@ -1,6 +1,6 @@ Name: device-manager-plugin-maru Summary: device-manager-plugin-maru -Version: 0.0.13 +Version: 0.0.14 Release: 1 Group: TO_BE/FILLED_IN License: TO_BE/FILLED_IN @@ -9,7 +9,6 @@ Source1001: packaging/device-manager-plugin-maru.manifest Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig BuildRequires: cmake -BuildRequires: pkgconfig(devman_plugin) %description device-manager-plugin-maru. @@ -18,13 +17,12 @@ device-manager-plugin-maru. %setup -q %build -export LDFLAGS+="-Wl,--rpath=%{_prefix}/lib -Wl,--as-needed" -cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} +export LDFLAGS+="-Wl,--rpath=%{_libdir} -Wl,--as-needed" +%cmake . make %install -rm -rf %{buildroot} %make_install %post diff --git a/src/device_manager_io.c b/src/device_manager_io.c index 8b1d658..9c619ef 100644 --- a/src/device_manager_io.c +++ b/src/device_manager_io.c @@ -1,24 +1,20 @@ /* - * device-manager-plugin-maru - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: DongGi Jang <dg0402.jang@samsung.com> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Licensed under the Flora License, Version 1.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. */ + /* * 2012-03-05 Dohyung Hong <don.hong@samsung.com> Changed package name for the maru board of emulator */ @@ -38,6 +34,19 @@ #define SUCCESS 0 #define FAIL 1 +int sys_check_node(char *path) +{ + int fd = -1; + + fd = open(path, O_RDONLY); + + if (fd == -1) + return -1; + + close(fd); + return 0; +} + int sys_get_node(char *path, char *node) { if (0 >= snprintf(node, strlen(path) + 1, "%s", path)) diff --git a/src/device_manager_plugin_maru.c b/src/device_manager_plugin_maru.c index 9f84998..a5f8d74 100644 --- a/src/device_manager_plugin_maru.c +++ b/src/device_manager_plugin_maru.c @@ -1,27 +1,20 @@ /* - * device-manager-plugin-maru - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Dohyung Hong <don.hong@samsung.com> - * - * Based on slp/pkgs/d/device-manager-plugin-c210/device_manager_plugin-c210.c - * Modified to support the maru board of emulator - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Licensed under the Flora License, Version 1.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. */ + #include <string.h> #include <sys/types.h> #include <stdio.h> @@ -108,6 +101,12 @@ enum display_type DISP_MAX }; +enum lux_status { + decrement, + no_change, + increment, +}; + struct display_info { enum display_type etype; /* FIXME:!! Main LCD or Sub LCD node */ @@ -122,6 +121,62 @@ struct display_info int lcd_index; struct display_info disp_info[DISP_MAX]; +int OEM_sys_get_backlight_brightness_by_lux(unsigned int lux, enum lux_status status) +{ + static int brightness = -1; + + if (status == no_change) { + if (brightness == -1) + status = increment; + else + return brightness; + } + if (status == decrement) { + switch (lux) { + case 10000 ... 0xffffffff: + brightness = 100; + break; + case 1000 ... 9999: + brightness = 80; + break; + case 75 ... 999: + brightness = 60; + break; + case 7 ... 74: + brightness = 40; + break; + case 0 ... 6: + brightness = 1; + break; + default: + return -1; + } + } else if (status == increment) { + switch (lux) { + case 15001 ... 0xffffffff: + brightness = 100; + break; + case 1501 ... 15000: + brightness = 80; + break; + case 151 ... 1500: + brightness = 60; + break; + case 16 ... 150: + brightness = 40; + break; + case 0 ... 15: + brightness = 1; + break; + default: + return -1; + } + } else + return -1; + + return brightness; +} + static int OEM_sys_display_info(struct display_info *disp_info) { struct dirent *dent; @@ -212,6 +267,23 @@ int OEM_sys_get_backlight_max_brightness(int index, int *value) return ret; } +int OEM_sys_get_backlight_min_brightness(int index, int *value) +{ + int ret = -1; + char path[MAX_NAME+1]; + + if (index >= DISP_MAX) { + devmgr_log("supports %d display node", DISP_MAX); + return ret; + } + + snprintf(path, MAX_NAME, BACKLIGHT_MIN_BRIGHTNESS_PATH, disp_info[index].bl_name); + ret = sys_get_int(path, value); + devmgr_log("path[%s]value[%d]", path, *value); + + return ret; +} + int OEM_sys_get_backlight_brightness(int index, int *value, int power_saving) { int ret = -1; @@ -249,6 +321,28 @@ int OEM_sys_get_backlight_brightness(int index, int *value, int power_saving) return ret; } +int OEM_sys_set_backlight_dimming(int index, int value) +{ + /* + int ret = -1; + char path[MAX_NAME+1]; + + if (index >= DISP_MAX) { + devmgr_log("supports %d display node", DISP_MAX); + return ret; + } + + snprintf(path, MAX_NAME, BACKLIGHT_DIMMING_PATH, disp_info[index].lcd_name); + devmgr_log("path[%s]value[%d]", path, value); + ret = sys_set_int(path, value); + return ret; + */ + + // TODO : value is only 1 + return OEM_sys_set_backlight_brightness(index, 1, 0/*power_saving*/); + +} + int OEM_sys_set_backlight_brightness(int index, int value, int power_saving) { int ret = -1; @@ -355,45 +449,6 @@ int OEM_sys_set_lcd_power(int index, int value) return ret; } -int OEM_sys_get_backlight_min_brightness(int index, int *value) -{ - int ret = -1; - char path[MAX_NAME+1]; - - if (index >= DISP_MAX) { - devmgr_log("supports %d display node", DISP_MAX); - return ret; - } - - snprintf(path, MAX_NAME, BACKLIGHT_MIN_BRIGHTNESS_PATH, disp_info[index].bl_name); - ret = sys_get_int(path, value); - devmgr_log("path[%s]value[%d]", path, *value); - - return ret; -} - -int OEM_sys_set_backlight_dimming(int index, int value) -{ - /* - int ret = -1; - char path[MAX_NAME+1]; - - if (index >= DISP_MAX) { - devmgr_log("supports %d display node", DISP_MAX); - return ret; - } - - snprintf(path, MAX_NAME, BACKLIGHT_DIMMING_PATH, disp_info[index].lcd_name); - devmgr_log("path[%s]value[%d]", path, value); - ret = sys_set_int(path, value); - return ret; - */ - - // TODO : value is only 1 - return OEM_sys_set_backlight_brightness(index, 1, 0/*power_saving*/); - -} - /* image_enhance */ int OEM_sys_get_image_enhance_save(void *image_enhance) { @@ -467,6 +522,11 @@ int OEM_sys_set_image_enhance_tune(int value) return ret; } +int OEM_sys_image_enhance_info(int *value) +{ + return 0; +} + int OEM_sys_set_display_frame_rate(int value) { /* @@ -491,6 +551,11 @@ GENERATE_ACCESSORS_INT_R(battery_charge_full, BATTERY_CHARGE_FULL_PATH) GENERATE_ACCESSORS_INT_R(battery_charge_now, BATTERY_CHARGE_NOW_PATH) GENERATE_ACCESSORS_INT_R(battery_present, BATTERY_PRESENT_PATH) +int OEM_sys_get_battery_capacity_raw(int *value) +{ + return 0; +} + static char *health_text[] = { "Unknown", "Good", "Overheat", "Dead", "Over voltage", "Unspecified failure", "Cold", @@ -531,12 +596,46 @@ int OEM_sys_get_battery_support_insuspend_charging(int *value) return 0; } +static char uart_node_path[MAX_NAME]; +static char usb_node_path[MAX_NAME]; + +/* find uart/usb node path */ +static int OEM_sys_muic_node_path_info() +{ + int err = -1; + + err = sys_check_node(UART_PATH); + if (!err) + sys_get_node(UART_PATH, uart_node_path); + else { + err = sys_check_node(UART_PATH_TRATS); + if (err) { + devmgr_log("uart path node not found"); + return -1; + } + sys_get_node(UART_PATH_TRATS, uart_node_path); + } + + err = sys_check_node(USB_PATH); + if (!err) + sys_get_node(USB_PATH, usb_node_path); + else { + err = sys_check_node(USB_PATH_TRATS); + if (err) { + devmgr_log("usb path node not found"); + return -1; + } + sys_get_node(USB_PATH_TRATS, usb_node_path); + } + return 0; +} + int OEM_sys_get_uart_path(int *value) { char buf[BUFF_MAX] = {0}; int ret = 0; - ret = sys_get_str(UART_PATH, buf); + ret = sys_get_str(uart_node_path, buf); if (ret != 0) { return -1; } @@ -556,9 +655,9 @@ int OEM_sys_set_uart_path(int value) { switch (value) { case PATH_CP: - return sys_set_str(UART_PATH, "CP"); + return sys_set_str(uart_node_path, "CP"); case PATH_AP: - return sys_set_str(UART_PATH, "AP"); + return sys_set_str(uart_node_path, "AP"); } return -1; @@ -570,15 +669,15 @@ int OEM_sys_get_usb_path(int *value) char buf[BUFF_MAX] = {0}; int ret = 0; - ret = sys_get_str(USB_PATH, buf); + ret = sys_get_str(usb_node_path, buf); if (ret != 0) { return -1; } - if (strncmp(buf, "AP", 2) == 0) { + if (strncmp(buf, "PDA", 3) == 0) { *value = PATH_AP; return 0; - } else if (strncmp(buf, "CP", 2) == 0) { + } else if (strncmp(buf, "MODEM", 5) == 0) { *value = PATH_CP; return 0; } @@ -590,24 +689,14 @@ int OEM_sys_set_usb_path(int value) { switch (value) { case PATH_CP: - return sys_set_str(USB_PATH, "CP"); + return sys_set_str(usb_node_path, "MODEM"); case PATH_AP: - return sys_set_str(USB_PATH, "AP"); + return sys_set_str(usb_node_path, "PDA"); } return -1; } -int OEM_sys_get_battery_capacity_raw(int *value) -{ - return 0; -} - -int OEM_sys_image_enhance_info(int *value) -{ - return 0; -} - GENERATE_ACCESSORS_INT_R(jack_charger_online, JACK_CHARGER_ONLINE_PATH) GENERATE_ACCESSORS_INT_R(jack_earjack_online, JACK_EARJACK_ONLINE_PATH) GENERATE_ACCESSORS_INT_R(jack_earkey_online, JACK_EARKEY_ONLINE_PATH) @@ -639,6 +728,10 @@ int OEM_sys_set_power_state(int value) switch (value) { case POWER_STATE_SUSPEND: return sys_set_str(POWER_STATE_PATH, "mem"); + case POWER_STATE_PRE_SUSPEND: + return sys_set_str(POWER_STATE_PATH, "pre_suspend"); + case POWER_STATE_POST_RESUME: + return sys_set_str(POWER_STATE_PATH, "post_resume"); } return -1; @@ -980,6 +1073,9 @@ EXPORT_API const OEM_sys_devman_plugin_interface *OEM_sys_get_devman_plugin_inte devman_plugin_interface_emul.OEM_sys_get_cpufreq_scaling_min_freq = &OEM_sys_get_cpufreq_scaling_min_freq; devman_plugin_interface_emul.OEM_sys_set_cpufreq_scaling_min_freq = &OEM_sys_set_cpufreq_scaling_min_freq; + devman_plugin_interface_emul.OEM_sys_get_backlight_brightness_by_lux = &OEM_sys_get_backlight_brightness_by_lux; OEM_sys_display_info(disp_info); + OEM_sys_muic_node_path_info(); + return &devman_plugin_interface_emul; } |