From cdc4ccc1132d6bc596a727af47d280693a75ca74 Mon Sep 17 00:00:00 2001 From: "sungmin82.ha" Date: Tue, 30 Jul 2013 14:51:26 +0900 Subject: sync with tizen_2.2 Change-Id: I1af1fe54af257c726c33e8f1974a5079f446cfcb Signed-off-by: Sungmin Ha --- AUTHORS | 13 ++ LICENSE | 75 -------- LICENSE.APLv2 | 206 +++++++++++++++++++++ NOTICE | 3 + include/devman_define_node_path.h | 34 +++- include/devman_plugin_intf.h | 151 ---------------- packaging/device-manager-plugin-maru.manifest | 5 + packaging/device-manager-plugin-maru.spec | 9 +- src/device_manager_io.c | 29 ++- src/device_manager_plugin_maru.c | 251 +++++++++++++++++++------- 10 files changed, 469 insertions(+), 307 deletions(-) create mode 100644 AUTHORS delete mode 100755 LICENSE create mode 100644 LICENSE.APLv2 create mode 100644 NOTICE delete mode 100644 include/devman_plugin_intf.h create mode 100644 packaging/device-manager-plugin-maru.manifest diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..978df0f --- /dev/null +++ b/AUTHORS @@ -0,0 +1,13 @@ +YeongKyoon Lee +DaiYoung Kim +SeokYeon Hwang +SangJin Kim +KiTae Kim +JinHyung Jo +SungMin Ha +MunKyu Im +JiHye Kim +GiWoong Kim +SooYoung Ha +HyunGoo Kang + diff --git a/LICENSE b/LICENSE deleted file mode 100755 index 7ccb5b5..0000000 --- a/LICENSE +++ /dev/null @@ -1,75 +0,0 @@ -Flora License - -Version 1.0, May, 2012 - -http://www.tizenopensource.org/license - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -"Tizen Certified Platform" shall mean a software platform that complies with the standards set forth in the Compatibility Definition Document and passes the Compatibility Test Suite as defined from time to time by the Tizen Technical Steering Group and certified by the Tizen Association or its designated agent. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work solely as incorporated into a Tizen Certified Platform, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work solely as incorporated into a Tizen Certified Platform to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof pursuant to the copyright license above, in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - - 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and - - 2. You must cause any modified files to carry prominent notices stating that You changed the files; and - - 3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - - 4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Flora License to your work - -To apply the Flora License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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://www.tizenopensource.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. diff --git a/LICENSE.APLv2 b/LICENSE.APLv2 new file mode 100644 index 0000000..1d4a865 --- /dev/null +++ b/LICENSE.APLv2 @@ -0,0 +1,206 @@ +Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + + + diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..04c1aec --- /dev/null +++ b/NOTICE @@ -0,0 +1,3 @@ +Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved. +Except as noted, this software is licensed under Apache License, Version 2. +Please, see the LICENSE.APLv2 file for Apache License Version 2, terms and conditions. diff --git a/include/devman_define_node_path.h b/include/devman_define_node_path.h index 4df6558..20a7d2b 100644 --- a/include/devman_define_node_path.h +++ b/include/devman_define_node_path.h @@ -1,3 +1,23 @@ +/* + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * JiHye Kim + * YeongKyoon Lee + * + * 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. + */ + #ifndef __DEVMAN_DEFINE_NODE_PATH_H #define __DEVMAN_DEFINE_NODE_PATH_H @@ -9,11 +29,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 +48,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 +65,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 deleted file mode 100644 index 87664e9..0000000 --- a/include/devman_plugin_intf.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * devman - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: DongGi Jang - * - * 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. - * -*/ - - -#ifndef __DEVMAN_PLUGIN_INTF_H__ -#define __DEVMAN_PLUGIN_INTF_H__ - -enum { - STATUS_OFFLINE = 0, - STATUS_ONLINE, -}; - -enum { - STATUS_OFF = 0, - STATUS_ON, -}; - -enum { - PATH_CP = 0, - PATH_AP, -}; - -enum { - BATTERY_NOT_FULLY_CHARGED = 0, - BATTERY_FULLY_CHARGED, -}; - -enum { - BATTERY_UNKNOWN = 0, - BATTERY_GOOD, - BATTERY_OVERHEAT, - BATTERY_DEAD, - BATTERY_OVERVOLTAGE, - BATTERY_UNSPECIFIED, - BATTERY_COLD, - BATTERY_HEALTH_MAX, -}; - -enum { - POWER_STATE_SUSPEND = 0, -}; - -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_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_get_backlight_acl_control) (int index, int *value); - int (*OEM_sys_set_backlight_acl_control) (int index, int value); - - int (*OEM_sys_get_lcd_power) (int index, int *value); - int (*OEM_sys_set_lcd_power) (int index, int value); - - int (*OEM_sys_get_image_enhance_mode) (int *value); - int (*OEM_sys_set_image_enhance_mode) (int value); - int (*OEM_sys_get_image_enhance_scenario) (int *value); - int (*OEM_sys_set_image_enhance_scenario) (int value); - int (*OEM_sys_get_image_enhance_tone) (int *value); - int (*OEM_sys_set_image_enhance_tone) (int value); - int (*OEM_sys_get_image_enhance_outdoor) (int *value); - int (*OEM_sys_set_image_enhance_outdoor) (int value); - - int (*OEM_sys_get_image_enhance_tune) (int *value); - int (*OEM_sys_set_image_enhance_tune) (int value); - int (*OEM_sys_image_enhance_info) (int *value); - - int (*OEM_sys_set_display_frame_rate) (int value); - - int (*OEM_sys_get_uart_path) (int *value); - int (*OEM_sys_set_uart_path) (int value); - - int (*OEM_sys_get_usb_path) (int *value); - int (*OEM_sys_set_usb_path) (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); - int (*OEM_sys_set_haptic_vibetones_enable) (int value); - int (*OEM_sys_set_haptic_vibetones_oneshot) (int value); - - int (*OEM_sys_get_battery_capacity) (int *value); - int (*OEM_sys_get_battery_capacity_raw) (int *value); - int (*OEM_sys_get_battery_charge_full) (int *value); - int (*OEM_sys_get_battery_charge_now) (int *value); - int (*OEM_sys_get_battery_present) (int *value); - int (*OEM_sys_get_battery_health) (int *value); - int (*OEM_sys_get_battery_polling_required) (int *value); - - int (*OEM_sys_get_jack_charger_online) (int *value); - int (*OEM_sys_get_jack_earjack_online) (int *value); - int (*OEM_sys_get_jack_earkey_online) (int *value); - int (*OEM_sys_get_jack_hdmi_online) (int *value); - int (*OEM_sys_get_jack_usb_online) (int *value); - int (*OEM_sys_get_jack_cradle_online) (int *value); - int (*OEM_sys_get_jack_tvout_online) (int *value); - int (*OEM_sys_get_jack_keyboard_online) (int *value); - - int (*OEM_sys_get_leds_torch_max_brightness) (int *value); - int (*OEM_sys_get_leds_torch_brightness) (int *value); - int (*OEM_sys_set_leds_torch_brightness) (int value); - - /* TODO: Change args type */ - int (*OEM_sys_set_power_state) (int value); - - /* TODO: Should determine enum values of wakeup_count nodes */ - int (*OEM_sys_get_power_wakeup_count) (int *value); - int (*OEM_sys_set_power_wakeup_count) (int value); - - int (*OEM_sys_get_memnotify_node) (char *node); - int (*OEM_sys_get_memnotify_victim_task) (int *value); - int (*OEM_sys_set_memnotify_threshold_lv1) (int value); - int (*OEM_sys_set_memnotify_threshold_lv2) (int value); - - int (*OEM_sys_get_process_monitor_node) (char *node); - int (*OEM_sys_set_process_monitor_mp_pnp) (int value); - int (*OEM_sys_set_process_monitor_mp_vip) (int value); - - int (*OEM_sys_get_cpufreq_cpuinfo_max_freq) (int *value); - int (*OEM_sys_get_cpufreq_cpuinfo_min_freq) (int *value); - int (*OEM_sys_get_cpufreq_scaling_max_freq) (int *value); - 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); -} OEM_sys_devman_plugin_interface; - -const OEM_sys_devman_plugin_interface *OEM_sys_get_devman_plugin_interface(); - -#endif /* __DEVMAN_PLUGIN_INTF_H__ */ diff --git a/packaging/device-manager-plugin-maru.manifest b/packaging/device-manager-plugin-maru.manifest new file mode 100644 index 0000000..97e8c31 --- /dev/null +++ b/packaging/device-manager-plugin-maru.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/device-manager-plugin-maru.spec b/packaging/device-manager-plugin-maru.spec index 46341d6..627e6fc 100644 --- a/packaging/device-manager-plugin-maru.spec +++ b/packaging/device-manager-plugin-maru.spec @@ -1,11 +1,11 @@ Name: device-manager-plugin-maru Summary: device-manager-plugin-maru -Version: 0.0.9 +Version: 0.0.15 Release: 1 Group: TO_BE/FILLED_IN License: TO_BE/FILLED_IN Source0: %{name}-%{version}.tar.gz -ExclusiveArch: %{ix86} +Source1001: packaging/device-manager-plugin-maru.manifest Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig BuildRequires: cmake @@ -18,13 +18,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 3ae0420..c6a9d40 100644 --- a/src/device_manager_io.c +++ b/src/device_manager_io.c @@ -1,9 +1,9 @@ /* - * device-manager-plugin-maru + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: DongGi Jang + * Contact: + * JiHye Kim + * YeongKyoon Lee * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,8 @@ * 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 Changed package name for the maru board of emulator @@ -38,6 +38,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)) @@ -92,15 +105,15 @@ static int sys_read_buf(char *file, char *buf) return -ENOENT; } - r = read(fd, buf, BUFF_MAX); + r = read(fd, buf, BUFF_MAX - 1); if ((r >= 0) && (r < BUFF_MAX)) buf[r] = '\0'; else { + close(fd); return -EIO; } close(fd); - return 0; } diff --git a/src/device_manager_plugin_maru.c b/src/device_manager_plugin_maru.c index 7015590..e75964a 100644 --- a/src/device_manager_plugin_maru.c +++ b/src/device_manager_plugin_maru.c @@ -1,12 +1,9 @@ /* - * device-manager-plugin-maru + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Dohyung Hong - * - * Based on slp/pkgs/d/device-manager-plugin-c210/device_manager_plugin-c210.c - * Modified to support the maru board of emulator + * Contact: + * JiHye Kim + * YeongKyoon Lee * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +16,8 @@ * 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 #include @@ -108,6 +105,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 +125,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; @@ -177,6 +236,8 @@ static int OEM_sys_display_info(struct display_info *disp_info) devmgr_log("lcd_name[%s]", disp_info[i].lcd_name); lcd_index = index; + + return 0; } int OEM_sys_get_display_count(int *value) @@ -210,6 +271,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; @@ -247,6 +325,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; @@ -353,45 +453,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) { @@ -465,6 +526,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) { /* @@ -489,6 +555,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", @@ -522,12 +593,53 @@ int OEM_sys_get_battery_polling_required(int *value) return 0; } +int OEM_sys_get_battery_support_insuspend_charging(int *value) +{ + *value = 1; + + 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; } @@ -547,9 +659,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; @@ -561,15 +673,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; } @@ -581,24 +693,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) @@ -615,6 +717,13 @@ int OEM_sys_get_jack_keyboard_online(int *value) return ret; } +int OEM_sys_get_hdmi_support(int *value) +{ + *value = 1; + + return 0; +} + GENERATE_ACCESSORS_INT_R(leds_torch_max_brightness, LEDS_TORCH_MAX_BRIGHTNESS_PATH) GENERATE_ACCESSORS_INT_RW(leds_torch_brightness, LEDS_TORCH_BRIGHTNESS_PATH) @@ -623,6 +732,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; @@ -925,6 +1038,7 @@ EXPORT_API const OEM_sys_devman_plugin_interface *OEM_sys_get_devman_plugin_inte devman_plugin_interface_emul.OEM_sys_get_battery_present = &OEM_sys_get_battery_present; devman_plugin_interface_emul.OEM_sys_get_battery_health = &OEM_sys_get_battery_health; devman_plugin_interface_emul.OEM_sys_get_battery_polling_required = &OEM_sys_get_battery_polling_required; + devman_plugin_interface_emul.OEM_sys_get_battery_support_insuspend_charging = &OEM_sys_get_battery_support_insuspend_charging; devman_plugin_interface_emul.OEM_sys_get_jack_charger_online = &OEM_sys_get_jack_charger_online; devman_plugin_interface_emul.OEM_sys_get_jack_earjack_online = &OEM_sys_get_jack_earjack_online; @@ -935,6 +1049,8 @@ EXPORT_API const OEM_sys_devman_plugin_interface *OEM_sys_get_devman_plugin_inte devman_plugin_interface_emul.OEM_sys_get_jack_tvout_online = &OEM_sys_get_jack_tvout_online; devman_plugin_interface_emul.OEM_sys_get_jack_keyboard_online = &OEM_sys_get_jack_keyboard_online; + devman_plugin_interface_emul.OEM_sys_get_hdmi_support = &OEM_sys_get_hdmi_support; + devman_plugin_interface_emul.OEM_sys_get_leds_torch_max_brightness = &OEM_sys_get_leds_torch_max_brightness; devman_plugin_interface_emul.OEM_sys_get_leds_torch_brightness = &OEM_sys_get_leds_torch_brightness; devman_plugin_interface_emul.OEM_sys_set_leds_torch_brightness = &OEM_sys_set_leds_torch_brightness; @@ -961,6 +1077,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; } -- cgit v1.2.3