Create new Library to control OAL APIs submit/trunk/20130226.073610
authorjy910.yun <jy910.yun@samsung.com>
Tue, 26 Feb 2013 07:06:47 +0000 (16:06 +0900)
committerjy910.yun <jy910.yun@samsung.com>
Tue, 26 Feb 2013 07:07:44 +0000 (16:07 +0900)
separate some code about OAL from devman
This module is a Library to control OAL APIs only used by system f/w

Change-Id: I8ea27904950f402922d4df315c02881c70fb65ac

23 files changed:
CMakeLists.txt [new file with mode: 0644]
LICENSE [new file with mode: 0644]
device-node.pc.in [new file with mode: 0644]
device-node.sh [new file with mode: 0755]
devices/CMakeLists.txt [new file with mode: 0644]
devices/cpu.c [new file with mode: 0644]
devices/display.c [new file with mode: 0644]
devices/extcon.c [new file with mode: 0644]
devices/led.c [new file with mode: 0644]
devices/memory.c [new file with mode: 0644]
devices/power.c [new file with mode: 0644]
devices/process.c [new file with mode: 0644]
devices/vibrator.c [new file with mode: 0644]
devman_plugin.pc.in [new file with mode: 0644]
include/device-internal.h [new file with mode: 0644]
include/device-node.h [new file with mode: 0644]
include/devman_plugin_intf.h [new file with mode: 0644]
packaging/libdevice-node.manifest [new file with mode: 0644]
packaging/libdevice-node.spec [new file with mode: 0644]
smack_device_labeling [new file with mode: 0755]
src/device-node.c [new file with mode: 0644]
src/device-plugin.c [new file with mode: 0644]
udev/rules.d/95-permissions-slp.rules [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..6aca950
--- /dev/null
@@ -0,0 +1,53 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(device-node C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "${PREFIX}/bin")
+SET(LIBDIR "${PREFIX}/lib")
+SET(INCLUDEDIR "${PREFIX}/include/${PROJECT_NAME}")
+SET(VERSION 0.1)
+
+SET(INC_DIR include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${INC_DIR})
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(rpkgs REQUIRED dlog vconf)
+
+FOREACH(flag ${rpkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(SRCS
+       src/device-node.c
+       src/device-plugin.c)
+
+SET(HEADERS
+       include/device-node.h
+       include/devman_plugin_intf.h)
+
+INCLUDE(devices/CMakeLists.txt)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS} ${TARGET_SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${rpkgs_LDFLAGS} "-ldl")
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION})
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT RuntimeLibraries)
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
+
+# will be deprecated
+CONFIGURE_FILE(devman_plugin.pc.in devman_plugin.pc @ONLY)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/devman_plugin.pc DESTINATION lib/pkgconfig)
+
+FOREACH(hfile ${HEADERS})
+       INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} DESTINATION include/${PROJECT_NAME})
+ENDFOREACH(hfile)
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION share/license RENAME ${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/smack_device_labeling DESTINATION /etc/rc.d/init.d)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/udev/ DESTINATION lib/udev)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/device-node.sh DESTINATION /etc/rc.d/init.d)
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..4d3b53c
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,204 @@
+Copyright (c) 2000 - 2012 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 (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+
+   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/device-node.pc.in b/device-node.pc.in
new file mode 100644 (file)
index 0000000..cab9007
--- /dev/null
@@ -0,0 +1,11 @@
+# Package Information for pkg-config
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: device node library
+Description: Library to control OAL apis for system f/w
+Version: @VERSION@
+Libs: -L${libdir} -ldevice-node
+Cflags: -I${includedir}
diff --git a/device-node.sh b/device-node.sh
new file mode 100755 (executable)
index 0000000..74d324b
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+do_start () {
+       # If setting for device is needed, do here
+}
+
+## for setting default brightness
+set_display () {
+       BL_BRT=
+       for file in /sys/class/backlight/*; do
+       #       echo $file
+               if [ -e $file ]; then
+                       BL_BRT=$file/brightness
+                       break
+               fi
+       done
+       /bin/echo `/usr/bin/vconftool get db/setting/Brightness | /usr/bin/awk '{print $4}'` > $BL_BRT
+       /bin/echo 0 > /sys/class/leds/leds-torch/brightness
+}
+
+case "$1" in
+       start)
+               do_start
+               ;;
+       display)
+               set_display
+               ;;
+       *)
+               echo "Usage: $0 start | display"
+               exit 1
+
+esac
+
+exit 0
+
diff --git a/devices/CMakeLists.txt b/devices/CMakeLists.txt
new file mode 100644 (file)
index 0000000..967849e
--- /dev/null
@@ -0,0 +1,10 @@
+SET(TARGET_SRCS
+       devices/cpu.c
+       devices/display.c
+       devices/extcon.c
+       devices/led.c
+       devices/memory.c
+       devices/power.c
+       devices/process.c
+       devices/vibrator.c
+)
diff --git a/devices/cpu.c b/devices/cpu.c
new file mode 100644 (file)
index 0000000..fb710d1
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * device-node
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+
+#include <stdio.h>
+#include "device-internal.h"
+
+static int cpu_get_prop(int prop, int *val)
+{
+       switch (prop) {
+       case PROP_CPU_CPUINFO_MAX_FREQ:
+               return PLUGIN_GET(cpufreq_cpuinfo_max_freq)(val);
+       case PROP_CPU_CPUINFO_MIN_FREQ:
+               return PLUGIN_GET(cpufreq_cpuinfo_min_freq)(val);
+       case PROP_CPU_SCALING_MAX_FREQ:
+               return PLUGIN_GET(cpufreq_scaling_max_freq)(val);
+       case PROP_CPU_SCALING_MIN_FREQ:
+               return PLUGIN_GET(cpufreq_scaling_min_freq)(val);
+       }
+
+       return -1;
+}
+
+static int cpu_set_prop(int prop, int val)
+{
+       switch (prop) {
+       case PROP_CPU_SCALING_MAX_FREQ:
+               return PLUGIN_SET(cpufreq_scaling_max_freq)(val);
+       case PROP_CPU_SCALING_MIN_FREQ:
+               return PLUGIN_SET(cpufreq_scaling_min_freq)(val);
+       }
+
+       return -1;
+}
+
+static const struct device cpu = {
+       .name     = "cpu",
+       .set_prop = cpu_set_prop,
+       .get_prop = cpu_get_prop,
+       .type     = DEVICE_TYPE_CPU,
+};
+
+static void __CONSTRUCTOR__ module_init(void)
+{
+       add_device(&(cpu.type));
+}
+
+static void __DESTRUCTOR__ module_fini(void)
+{
+       remove_device(&(cpu.type));
+}
diff --git a/devices/display.c b/devices/display.c
new file mode 100644 (file)
index 0000000..f4355ff
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * device-node
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+
+#include <stdio.h>
+#include <vconf.h>
+#include "device-internal.h"
+
+#define PROPERTY_MASK                  0x0F
+#define PROPERTY_PROP(val)             ((val) & PROPERTY_MASK)
+#define PROPERTY_INDEX(val)            ((val) >> 4)
+
+static int display_get_prop(int __prop, int *val)
+{
+       int prop = PROPERTY_PROP(__prop);
+       int index = PROPERTY_INDEX(__prop);
+       int ps_stat;
+       int ps_disp_stat;
+       int disp_cnt;
+       int r;
+
+       r = PLUGIN_GET(display_count)(&disp_cnt);
+       if (r < 0) {
+               DEVERR("Get display count failed");
+               return -1;
+       }
+
+       if (index >= disp_cnt) {
+               DEVERR("Invalid Argument: index(%d) > max(%d)", index, disp_cnt);
+               return -1;
+       }
+
+       switch (prop) {
+       case PROP_DISPLAY_DISPLAY_COUNT:
+               *val = disp_cnt;
+               return 0;
+       case PROP_DISPLAY_BRIGHTNESS:
+               /* check power saving */
+               vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_SYSMODE_STATUS, &ps_stat);
+               if (ps_stat == 1)
+                       vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_DISPLAY, &ps_disp_stat);
+               if (ps_disp_stat != 1)
+                       ps_disp_stat = 0;
+               return PLUGIN_GET(backlight_brightness)(index, val, ps_disp_stat);
+       case PROP_DISPLAY_ACL_CONTROL:
+               return PLUGIN_GET(backlight_acl_control)(index, val);
+       case PROP_DISPLAY_ONOFF:
+               return PLUGIN_GET(lcd_power)(index, val);
+       case PROP_DISPLAY_BRIGHTNESS_BY_LUX:
+               return PLUGIN_GET(backlight_brightness_by_lux)(val);
+       case PROP_DISPLAY_IMAGE_ENHANCE_MODE:
+               return PLUGIN_GET(image_enhance_mode)(val);
+       case PROP_DISPLAY_IMAGE_ENHANCE_SCENARIO:
+               return PLUGIN_GET(image_enhance_scenario)(val);
+       case PROP_DISPLAY_IMAGE_ENHANCE_TONE:
+               return PLUGIN_GET(image_enhance_tone)(val);
+       case PROP_DISPLAY_IMAGE_ENHANCE_OUTDOOR:
+               return PLUGIN_GET(image_enhance_outdoor)(val);
+       case PROP_DISPLAY_IMAGE_ENHANCE_INFO:
+               return PLUGIN_SYS(image_enhance_info)(val);
+       }
+
+       return -1;
+}
+
+static int display_set_prop(int __prop, int val)
+{
+       int prop = PROPERTY_PROP(__prop);
+       int index = PROPERTY_INDEX(__prop);
+       int ps_stat;
+       int ps_disp_stat;
+       int disp_cnt;
+       int r;
+
+       r = PLUGIN_GET(display_count)(&disp_cnt);
+       if (r < 0) {
+               DEVERR("Get display count failed");
+               return -1;
+       }
+
+       if (index >= disp_cnt) {
+               DEVERR("Invalid Argument: index(%d) > max(%d)", index, disp_cnt);
+               return -1;
+       }
+
+       switch (prop) {
+       case PROP_DISPLAY_BRIGHTNESS:
+               /* check power saving */
+               vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_SYSMODE_STATUS, &ps_stat);
+               if (ps_stat == 1)
+                       vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_DISPLAY, &ps_disp_stat);
+               if (ps_disp_stat != 1)
+                       ps_disp_stat = 0;
+               return PLUGIN_SET(backlight_brightness)(index, val, ps_disp_stat);
+       case PROP_DISPLAY_ACL_CONTROL:
+               return PLUGIN_SET(backlight_acl_control)(index, val);
+       case PROP_DISPLAY_ONOFF:
+               return PLUGIN_SET(lcd_power)(index, val);
+       case PROP_DISPLAY_FRAME_RATE:
+               return PLUGIN_SET(display_frame_rate)(val);
+       case PROP_DISPLAY_IMAGE_ENHANCE_MODE:
+               return PLUGIN_SET(image_enhance_mode)(val);
+       case PROP_DISPLAY_IMAGE_ENHANCE_SCENARIO:
+               return PLUGIN_SET(image_enhance_scenario)(val);
+       case PROP_DISPLAY_IMAGE_ENHANCE_TONE:
+               return PLUGIN_SET(image_enhance_tone)(val);
+       case PROP_DISPLAY_IMAGE_ENHANCE_OUTDOOR:
+               return PLUGIN_SET(image_enhance_outdoor)(val);
+       }
+
+       return -1;
+}
+
+static const struct device display = {
+       .name     = "display",
+       .set_prop = display_set_prop,
+       .get_prop = display_get_prop,
+       .type     = DEVICE_TYPE_DISPLAY,
+};
+
+static void __CONSTRUCTOR__ module_init(void)
+{
+       add_device(&(display.type));
+}
+
+static void __DESTRUCTOR__ module_fini(void)
+{
+       remove_device(&(display.type));
+}
diff --git a/devices/extcon.c b/devices/extcon.c
new file mode 100644 (file)
index 0000000..42a41d1
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * device-node
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+
+#include <stdio.h>
+#include "device-internal.h"
+
+static int extcon_get_prop(int prop, int *val)
+{
+       switch (prop) {
+       case PROP_EXTCON_TA_ONLINE:
+               return PLUGIN_GET(jack_charger_online)(val);
+       case PROP_EXTCON_EARJACK_ONLINE:
+               return PLUGIN_GET(jack_earjack_online)(val);
+       case PROP_EXTCON_EARKEY_ONLINE:
+               return PLUGIN_GET(jack_earkey_online)(val);
+       case PROP_EXTCON_HDMI_ONLINE:
+               return PLUGIN_GET(jack_hdmi_online)(val);
+       case PROP_EXTCON_USB_ONLINE:
+               return PLUGIN_GET(jack_usb_online)(val);
+       case PROP_EXTCON_CRADLE_ONLINE:
+               return PLUGIN_GET(jack_cradle_online)(val);
+       case PROP_EXTCON_TVOUT_ONLINE:
+               return PLUGIN_GET(jack_tvout_online)(val);
+       case PROP_EXTCON_KEYBOARD_ONLINE:
+               return PLUGIN_GET(jack_keyboard_online)(val);
+       case PROP_EXTCON_HDMI_SUPPORT:
+               return PLUGIN_GET(hdmi_support)(val);
+       case PROP_EXTCON_UART_PATH:
+               return PLUGIN_GET(uart_path)(val);
+       case PROP_EXTCON_USB_PATH:
+               return PLUGIN_GET(usb_path)(val);
+       }
+
+       return -1;
+}
+
+static int extcon_set_prop(int prop, int val)
+{
+       int r;
+
+       switch (prop) {
+       case PROP_EXTCON_UART_PATH:
+               r = PLUGIN_SET(uart_path)(val);
+               if (r == 0) {
+                       if (val == PATH_CP)
+                               system("/usr/bin/save_blenv uartpath CP");
+                       else
+                               system("/usr/bin/save_blenv uartpath AP");
+               }
+               return r;
+       case PROP_EXTCON_USB_PATH:
+               r = PLUGIN_SET(usb_path)(val);
+               if (r == 0) {
+                       if (val == PATH_CP)
+                               system("/usr/bin/save_blenv usbpath CP");
+                       else
+                               system("/usr/bin/save_blenv usbpath AP");
+               }
+               return r;
+       }
+
+       return -1;
+}
+
+
+static const struct device extcon = {
+       .name     = "extcon",
+       .set_prop = extcon_set_prop,
+       .get_prop = extcon_get_prop,
+       .type     = DEVICE_TYPE_EXTCON,
+};
+
+static void __CONSTRUCTOR__ module_init(void)
+{
+       add_device(&(extcon.type));
+}
+
+static void __DESTRUCTOR__ module_fini(void)
+{
+       remove_device(&(extcon.type));
+}
diff --git a/devices/led.c b/devices/led.c
new file mode 100644 (file)
index 0000000..925b306
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * device-node
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+
+#include <stdio.h>
+#include "device-internal.h"
+
+static int led_get_prop(int prop, int *val)
+{
+       switch (prop) {
+       case PROP_LED_MAX_BRIGHTNESS:
+               return PLUGIN_GET(leds_torch_max_brightness)(val);
+       case PROP_LED_BRIGHTNESS:
+               return PLUGIN_GET(leds_torch_brightness)(val);
+       }
+
+       return -1;
+}
+
+static int led_set_prop(int prop, int val)
+{
+       switch (prop) {
+       case PROP_LED_BRIGHTNESS:
+               return PLUGIN_SET(leds_torch_brightness)(val);
+       }
+
+       return -1;
+}
+
+static const struct device led = {
+       .name     = "led",
+       .set_prop = led_set_prop,
+       .get_prop = led_get_prop,
+       .type     = DEVICE_TYPE_LED,
+};
+
+static void __CONSTRUCTOR__ module_init(void)
+{
+       add_device(&(led.type));
+}
+
+static void __DESTRUCTOR__ module_fini(void)
+{
+       remove_device(&(led.type));
+}
diff --git a/devices/memory.c b/devices/memory.c
new file mode 100644 (file)
index 0000000..eb60465
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * device-node
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+
+#include <stdio.h>
+#include "device-internal.h"
+
+static int memory_get_prop(int prop, int *val)
+{
+       switch (prop) {
+       case PROP_MEMORY_NODE:
+               return PLUGIN_GET(memnotify_node)((char*)val);
+       case PROP_MEMORY_VICTIM_TASK:
+               return PLUGIN_GET(memnotify_victim_task)(val);
+       }
+
+       return -1;
+}
+
+static int memory_set_prop(int prop, int val)
+{
+       switch (prop) {
+       case PROP_MEMORY_THRESHOLD_LV1:
+               return PLUGIN_SET(memnotify_threshold_lv1)(val);
+       case PROP_MEMORY_THRESHOLD_LV2:
+               return PLUGIN_SET(memnotify_threshold_lv2)(val);
+       }
+
+       return -1;
+}
+
+static const struct device memory = {
+       .name     = "memory",
+       .set_prop = memory_set_prop,
+       .get_prop = memory_get_prop,
+       .type     = DEVICE_TYPE_MEMORY,
+};
+
+static void __CONSTRUCTOR__ module_init(void)
+{
+       add_device(&(memory.type));
+}
+
+static void __DESTRUCTOR__ module_fini(void)
+{
+       remove_device(&(memory.type));
+}
diff --git a/devices/power.c b/devices/power.c
new file mode 100644 (file)
index 0000000..c57943a
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * device-node
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+
+#include <stdio.h>
+#include "device-internal.h"
+
+static int power_get_prop(int prop, int *val)
+{
+       switch (prop) {
+       case PROP_POWER_CAPACITY:
+               return PLUGIN_GET(battery_capacity)(val);
+       case PROP_POWER_CAPACITY_RAW:
+               return PLUGIN_GET(battery_capacity_raw)(val);
+       case PROP_POWER_CHARGE_FULL:
+               return PLUGIN_GET(battery_charge_full)(val);
+       case PROP_POWER_CHARGE_NOW:
+               return PLUGIN_GET(battery_charge_now)(val);
+       case PROP_POWER_WAKEUP_COUNT:
+               return PLUGIN_GET(power_wakeup_count)(val);
+       case PROP_POWER_PRESENT:
+               return PLUGIN_GET(battery_present)(val);
+       case PROP_POWER_HEALTH:
+               return PLUGIN_GET(battery_health)(val);
+       case PROP_POWER_INSUSPEND_CHARGING_SUPPORT:
+               return PLUGIN_GET(battery_support_insuspend_charging)(val);
+       }
+
+       return -1;
+}
+
+static int power_set_prop(int prop, int val)
+{
+       switch (prop) {
+       case PROP_POWER_STATE:
+               return PLUGIN_SET(power_state)(val);
+       case PROP_POWER_WAKEUP_COUNT:
+               return PLUGIN_SET(power_wakeup_count)(val);
+       }
+
+       return -1;
+}
+
+static const struct device power = {
+       .name     = "power",
+       .set_prop = power_set_prop,
+       .get_prop = power_get_prop,
+       .type     = DEVICE_TYPE_POWER,
+};
+
+static void __CONSTRUCTOR__ module_init(void)
+{
+       add_device(&(power.type));
+}
+
+static void __DESTRUCTOR__ module_fini(void)
+{
+       remove_device(&(power.type));
+}
diff --git a/devices/process.c b/devices/process.c
new file mode 100644 (file)
index 0000000..94ee4c9
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * device-node
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+
+#include <stdio.h>
+#include "device-internal.h"
+
+static int process_get_prop(int prop, int *val)
+{
+       switch (prop) {
+       case PROP_PROCESS_NODE:
+               return PLUGIN_GET(process_monitor_node)((char*)val);
+       }
+
+       return -1;
+}
+
+static int process_set_prop(int prop, int val)
+{
+       switch (prop) {
+       case PROP_PROCESS_MP_PNP:
+               return PLUGIN_SET(process_monitor_mp_pnp)(val);
+       case PROP_PROCESS_MP_VIP:
+               return PLUGIN_SET(process_monitor_mp_vip)(val);
+       }
+
+       return -1;
+}
+
+static const struct device process = {
+       .name     = "process",
+       .set_prop = process_set_prop,
+       .get_prop = process_get_prop,
+       .type     = DEVICE_TYPE_PROCESS,
+};
+
+static void __CONSTRUCTOR__ module_init(void)
+{
+       add_device(&(process.type));
+}
+
+static void __DESTRUCTOR__ module_fini(void)
+{
+       remove_device(&(process.type));
+}
diff --git a/devices/vibrator.c b/devices/vibrator.c
new file mode 100644 (file)
index 0000000..80d8e3e
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * device-node
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+
+#include <stdio.h>
+#include "device-internal.h"
+
+static int vibrator_get_prop(int prop, int *val)
+{
+       switch (prop) {
+       case PROP_VIBRATOR_LEVEL:
+               return PLUGIN_GET(haptic_vibetones_level)(val);
+       case PROP_VIBRATOR_LEVEL_MAX:
+               return PLUGIN_GET(haptic_vibetones_level_max)(val);
+       }
+
+       return -1;
+}
+
+static int vibrator_set_prop(int prop, int val)
+{
+       switch (prop) {
+       case PROP_VIBRATOR_ENABLE:
+               return PLUGIN_SET(haptic_vibetones_enable)(val);
+       case PROP_VIBRATOR_LEVEL:
+               return PLUGIN_SET(haptic_vibetones_level)(val);
+       case PROP_VIBRATOR_ONESHOT:
+               return PLUGIN_SET(haptic_vibetones_oneshot)(val);
+       }
+
+       return -1;
+}
+
+static const struct device vibrator = {
+       .name     = "vibrator",
+       .set_prop = vibrator_set_prop,
+       .get_prop = vibrator_get_prop,
+       .type     = DEVICE_TYPE_VIBRATOR,
+};
+
+static void __CONSTRUCTOR__ module_init(void)
+{
+       add_device(&(vibrator.type));
+}
+
+static void __DESTRUCTOR__ module_fini(void)
+{
+       remove_device(&(vibrator.type));
+}
diff --git a/devman_plugin.pc.in b/devman_plugin.pc.in
new file mode 100644 (file)
index 0000000..0ce74e9
--- /dev/null
@@ -0,0 +1,12 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: devman_plugin
+Description: SAMSUNG Linux platform devman plugin library
+Version: @VERSION@
+Requires:
+Cflags: -I${includedir}
diff --git a/include/device-internal.h b/include/device-internal.h
new file mode 100644 (file)
index 0000000..7e3dbb7
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * device-node
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * 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 __DEVICE_INTERNAL_H__
+#define __DEVICE_INTERNAL_H__
+
+#include "device-node.h"
+
+#ifndef __CONSTRUCTOR__
+#define __CONSTRUCTOR__ __attribute__ ((constructor))
+#endif
+
+#ifndef __DESTRUCTOR__
+#define __DESTRUCTOR__ __attribute__ ((destructor))
+#endif
+
+#define FEATURE_DEVICE_NODE_DLOG
+#ifdef FEATURE_DEVICE_NODE_DLOG
+#define LOG_TAG "DEVICE_NODE"
+#include <dlog.h>
+#define DEVLOG(fmt, args...)        SLOGD(fmt, ##args)
+#define DEVERR(fmt, args...)        SLOGE(fmt, ##args)
+#else
+#define DEVLOG(x, ...)              do { } while (0)
+#define DEVERR(x, ...)              do { } while (0)
+#endif
+
+#define DEVMAN_PLUGIN_PATH  "/usr/lib/libslp_devman_plugin.so"
+
+#ifndef PLUGIN_DEFINE
+#define PLUGIN_DEFINE
+#define PLUGIN_SYS(node)       plugin_intf->OEM_sys_##node
+#define PLUGIN_GET(node)       plugin_intf->OEM_sys_get_##node
+#define PLUGIN_SET(node)       plugin_intf->OEM_sys_set_##node
+#endif
+
+struct device {
+       enum device_type type;
+       char *name;
+       int (*set_prop) (int property, int val);
+       int (*get_prop) (int property, int *val);
+};
+
+void add_device(enum device_type *devtype);
+void remove_device(enum device_type *devtype);
+
+extern const OEM_sys_devman_plugin_interface *plugin_intf;
+extern const OEM_sys_devman_plugin_interface default_plugin;
+
+#endif         /* __DEVICE_INTERNAL_H__ */
diff --git a/include/device-node.h b/include/device-node.h
new file mode 100644 (file)
index 0000000..935bc18
--- /dev/null
@@ -0,0 +1,219 @@
+/*
+ * device-node
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * 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 __DEVICE_NODE_H__
+#define __DEVICE_NODE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "devman_plugin_intf.h"
+
+#ifndef API
+#define API __attribute__ ((visibility("default")))
+#endif
+
+/**
+ * @file        device-node.h
+ * @ingroup     FRAMEWORK/SYSTEM
+ * @brief       This file contains the API for the status of devices
+ * @author      TIZEN
+ * @date        2013-02-15
+ * @version     0.1
+ */
+
+/**
+ * @addtogroup DEVICE_NODE
+ * @{
+ */
+
+/**
+ * @par Description:
+ *     device type enum
+ */
+enum device_type
+{
+       DEVICE_TYPE_DISPLAY,            /**< display */
+       DEVICE_TYPE_VIBRATOR,           /**< vibrator */
+       DEVICE_TYPE_EXTCON,             /**< extcon - Micro USB, 3.5 pi jack etc */
+       DEVICE_TYPE_LED,                /**< LED */
+       DEVICE_TYPE_POWER,              /**< battery, PMIC, etc about power */
+       DEVICE_TYPE_MEMORY,             /**< memory */
+       DEVICE_TYPE_CPU,                /**< cpu */
+       DEVICE_TYPE_PROCESS,            /**< process */
+       DEVICE_TYPE_MAX,
+};
+
+/**
+ * @par Description:
+ *     DEVICE_TYPE_DISPLAY property for generic APIs
+ */
+enum {
+       PROP_DISPLAY_DISPLAY_COUNT,
+       PROP_DISPLAY_BRIGHTNESS,
+       PROP_DISPLAY_ACL_CONTROL,
+       PROP_DISPLAY_ONOFF,
+       PROP_DISPLAY_BRIGHTNESS_BY_LUX,
+       PROP_DISPLAY_FRAME_RATE,
+       PROP_DISPLAY_IMAGE_ENHANCE_MODE,
+       PROP_DISPLAY_IMAGE_ENHANCE_SCENARIO,
+       PROP_DISPLAY_IMAGE_ENHANCE_TONE,
+       PROP_DISPLAY_IMAGE_ENHANCE_OUTDOOR,
+       PROP_DISPLAY_IMAGE_ENHANCE_TUNE,
+       PROP_DISPLAY_IMAGE_ENHANCE_INFO,
+};
+
+/**
+ * @par Description:
+ * DEVICE_TYPE_HAPTIC property for generic APIs
+ */
+enum {
+       PROP_VIBRATOR_LEVEL_MAX,
+       PROP_VIBRATOR_LEVEL,
+       PROP_VIBRATOR_ENABLE,
+       PROP_VIBRATOR_ONESHOT,
+};
+
+/**
+ * @par Description:
+ *     DEVICE_TYPE_JACK property for generic APIs
+ */
+enum {
+       PROP_EXTCON_TA_ONLINE,        /**< Travel Adapter(Charger) */
+       PROP_EXTCON_EARJACK_ONLINE,   /**< Earjack */
+       PROP_EXTCON_EARKEY_ONLINE,    /**< Earkey */
+       PROP_EXTCON_HDMI_ONLINE,      /**< HDMI */
+       PROP_EXTCON_USB_ONLINE,       /**< USB connection */
+       PROP_EXTCON_CRADLE_ONLINE,    /**< Cradle connection */
+       PROP_EXTCON_TVOUT_ONLINE,     /**< analog tvout */
+       PROP_EXTCON_KEYBOARD_ONLINE,  /**< Microphone */
+       PROP_EXTCON_HDMI_SUPPORT,     /**< Support HDMI*/
+       PROP_EXTCON_UART_PATH,
+       PROP_EXTCON_USB_PATH,
+};
+
+/**
+ * @par Description:
+ *  DEVICE_TYPE_LED property for generic APIs
+ */
+enum {
+       PROP_LED_BRIGHTNESS,
+       PROP_LED_MAX_BRIGHTNESS,
+};
+
+/**
+ * @par Description:
+ *     DEVICE_TYPE_POWER property for generic APIs
+ */
+enum {
+       PROP_POWER_CAPACITY,                    /**< Current remaining battery */
+       PROP_POWER_CAPACITY_RAW,                /**< Current remaining battery expressed 1/10000 */
+       PROP_POWER_CHARGE_FULL,                 /**< Battery is full-charged.*/
+       PROP_POWER_CHARGE_NOW,                  /**< Battery is being charged now */
+       PROP_POWER_STATE,
+       PROP_POWER_WAKEUP_COUNT,
+       PROP_POWER_PRESENT,
+       PROP_POWER_HEALTH,                      /**< Battery status about cahrge */
+       PROP_POWER_INSUSPEND_CHARGING_SUPPORT,
+};
+
+/**
+ * @par Description:
+ *     DEVICE_TYPE_MEMORY property for generic APIs
+ */
+enum {
+       PROP_MEMORY_NODE,
+       PROP_MEMORY_VICTIM_TASK,
+       PROP_MEMORY_THRESHOLD_LV1,
+       PROP_MEMORY_THRESHOLD_LV2,
+};
+
+/**
+ * @par Description:
+ *     DEVICE_TYPE_CPU property for generic APIs
+ */
+enum {
+       PROP_CPU_CPUINFO_MAX_FREQ,
+       PROP_CPU_CPUINFO_MIN_FREQ,
+       PROP_CPU_SCALING_MAX_FREQ,
+       PROP_CPU_SCALING_MIN_FREQ,
+};
+
+/**
+ * @par Description:
+ *     DEVICE_TYPE_PROCESS property for generic APIs
+ */
+enum {
+       PROP_PROCESS_NODE,
+       PROP_PROCESS_MP_PNP,
+       PROP_PROCESS_MP_VIP,
+};
+
+/**
+ * @fn int device_get_property(enum device_type devtype, int property, int *value)
+ * @par Description:
+ *     This generic API is used to get the property values of supported devices.\n
+ *     If the caller process does not have permission, it returns failure.
+ * @param[in] devtype device type that you want to get the value
+ * @param[in] property value property that you want to get the value
+ * @param[out] *value current value of device property
+ * @return 0 on success, -1 if failed
+ * @see device_set_property()
+ * @par Example:
+ * @code
+ *     ...
+ *     if( device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CAPACITY, &val) < 0 )
+ *             printf("Fail to get property\n");
+ *     else
+ *             printf("Property is %d\n", val);
+ *     ...
+ * @endcode
+ */
+int device_get_property(enum device_type devtype, int property, int *value);
+
+/**
+ * @fn int device_set_property(enum device_type devtype, int property, int value)
+ * @par Description:
+ *     This generic API is used to set the property values of supported devices.\n
+ *     If the caller process does not have permission, it returns failure.
+ * @param[in] devtype device type that you want to set the value
+ * @param[in] property value property that you want to set the value
+ * @param[in] value value that you want to set
+ * @return 0 on success, -1 if failed
+ * @see device_get_property()
+ * @par Example
+ * @code
+ *     ...
+ *     if( device_set_property(DEVICE_TYPE_DISPLAY, PROP_DISPLAY_BRIGHTNESS, val) < 0 )
+ *             printf("Fail to set property\n");
+ *     else
+ *             printf("Property is set %d\n", val);
+ *     ...
+ * @endcode
+ */
+int device_set_property(enum device_type devtype, int property, int value);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/devman_plugin_intf.h b/include/devman_plugin_intf.h
new file mode 100644 (file)
index 0000000..7053c3a
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * device-node
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * 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,
+       POWER_STATE_PRE_SUSPEND,
+       POWER_STATE_POST_RESUME,
+};
+
+enum {
+       LUX_DECREMENT,
+       LUX_NOCHANGE,
+       LUX_INCREMENT,
+};
+
+enum {
+       WM_MODE_MIN = 0x00,
+       WM_MODE_NORMAL = WM_MODE_MIN,
+       WM_MODE_CONSERVATIVE,
+       WM_MODE_MEDIUM,
+       WM_MODE_AGGRESSIVE,
+       WM_MODE_OUTDOOR,
+       WM_MODE_MAX = WM_MODE_OUTDOOR
+};
+
+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_battery_support_insuspend_charging) (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);
+
+       int     (*OEM_sys_get_backlight_brightness_by_lux) (int lux);
+
+       int     (*OEM_sys_get_whitemagic_mode) (int index, int *value);
+       int     (*OEM_sys_set_whitemagic_mode) (int index, int value);
+
+       int     (*OEM_sys_get_hdmi_support) (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/libdevice-node.manifest b/packaging/libdevice-node.manifest
new file mode 100644 (file)
index 0000000..843f460
--- /dev/null
@@ -0,0 +1,21 @@
+<manifest>
+       <define>
+               <domain name="device"/>
+               <provide>
+                       <label name="device::camera"/>
+                       <label name="device::app_logging"/>
+                       <label name="device::sys_logging"/>
+                       <label name="device::audio"/>
+                       <label name="device::recording"/>
+                       <label name="device::hwcodec"/>
+                       <label name="device::video"/>
+                       <label name="device::radio"/>
+                       <label name="device::bklight"/>
+                       <label name="device::led"/>
+                       <label name="device::mdnie"/>
+               </provide>
+       </define>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
diff --git a/packaging/libdevice-node.spec b/packaging/libdevice-node.spec
new file mode 100644 (file)
index 0000000..c8a9640
--- /dev/null
@@ -0,0 +1,61 @@
+Name:       libdevice-node
+Summary:    Library to control OAL APIs
+Version:    0.1.0
+Release:    0
+Group:      System/Libraries
+License:    Apache License, Version 2.0
+Source0:    %{name}-%{version}.tar.gz
+Source1:       %{name}.manifest
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(vconf)
+BuildRequires:  pkgconfig(dlog)
+
+%description
+development package of library to control OAL APIs
+
+%package devel
+Summary:       Control OAL APIs (devel)
+Group:         Development/Libraries
+Requires:      %{name} = %{version}-%{release}
+
+%description devel
+Library to control OAL APIs (devel)
+
+
+%prep
+%setup -q
+
+%build
+CFLAGS="$CFLAGS" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/device-node
+%make_install
+cp -a %{SOURCE1} %{buildroot}%{_datadir}/
+install -D -d %{buildroot}/etc/rc.d/rc3.d/
+install -D -d %{buildroot}/etc/rc.d/rc4.d/
+ln -sf ../init.d/smack_device_labeling %{buildroot}/etc/rc.d/rc3.d/S44smack_device_labeling
+ln -sf ../init.d/smack_device_labeling %{buildroot}/etc/rc.d/rc4.d/S44smack_device_labeling
+
+%post
+if [ ! -e "/lib/firmware/mdnie" ]
+then
+       mkdir -p /lib/firmware/mdnie
+fi
+
+%postun
+
+%files
+%{_libdir}/*.so.*
+%{_libdir}/udev/rules.d/*
+%{_datadir}/license/device-node
+%attr(755,root,root) %{_sysconfdir}/rc.d/*
+%manifest %{_datadir}/%{name}.manifest
+
+%files devel
+%{_includedir}/device-node/*.h
+%{_libdir}/*.so
+%{_libdir}/pkgconfig/*.pc
diff --git a/smack_device_labeling b/smack_device_labeling
new file mode 100755 (executable)
index 0000000..d3d482e
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# Set device node permissions for security
+chsmack -a 'device::camera' /dev/video1
+chsmack -a 'device::camera' /dev/s3c-jpg
+chsmack -a 'device::app_logging' /dev/log_main
+chsmack -a 'device::app_logging' /dev/log_events
+chsmack -a 'device::app_logging' /dev/log_radio
+chsmack -a 'device::sys_logging' /dev/log_system
+chsmack -a 'device::audio' /dev/snd/
+chsmack -a 'device::audio' /dev/snd/controlC0
+chsmack -a 'device::audio' /dev/snd/pcmC0D0p
+chsmack -a 'device::audio' /dev/snd/pcmC0D1p
+chsmack -a 'device::audio' /dev/snd/pcmC0D2p
+chsmack -a 'device::audio' /dev/snd/pcmC0D3p
+chsmack -a 'device::audio' /dev/snd/timer
+chsmack -a 'device::recording' /dev/snd/pcmC0D0c
+chsmack -a 'device::recording' /dev/snd/pcmC0D1c
+chsmack -a 'device::recording' /dev/snd/pcmC0D2c
+chsmack -a 'device::recording' /dev/snd/pcmC0D3c
+chsmack -a 'device::hwcodec' /dev/s3c-mfc
+chsmack -a 'device::hwcodec' /dev/video5
+chsmack -a 'device::hwcodec' /dev/video6
+chsmack -a 'device::video' /dev/fb0
+chsmack -a 'device::video' /dev/video0
+chsmack -a 'device::video' /dev/video2
+chsmack -a 'device::video' /dev/video3
+chsmack -a 'device::video' /dev/s3c-mem
+chsmack -a 'device::radio' /dev/radio0
+chsmack -a 'device::bklight' /sys/class/backlight/*/brightness
+chsmack -a 'device::led' /sys/class/camera/flash/rear_flash
+chsmack -a 'device::led' /sys/class/camera/flash/max_brightness
+chsmack -a 'device::mdnie' /sys/class/extension/mdnie/mode
+chsmack -a 'device::mdnie' /sys/class/extension/mdnie/scenario
+chsmack -a 'device::mdnie' /sys/class/extension/mdnie/tone
+chsmack -a 'device::mdnie' /sys/class/extension/mdnie/outdoor
+chsmack -a 'device::mdnie' /sys/class/extension/mdnie/tune
diff --git a/src/device-node.c b/src/device-node.c
new file mode 100644 (file)
index 0000000..b567a65
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * device-node
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+
+#include <string.h>
+#include <glib.h>
+#include <dlfcn.h>
+#include <errno.h>
+#include "device-internal.h"
+
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#define container_of(ptr, type, member) ({            \
+                const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
+                (type *)( (char *)__mptr - offsetof(type,member) );})
+
+static GList *dev_head;
+static void *dlopen_handle;
+const OEM_sys_devman_plugin_interface *plugin_intf;
+
+void add_device(enum device_type *devtype)
+{
+       dev_head = g_list_append(dev_head, devtype);
+}
+
+void remove_device(enum device_type *devtype)
+{
+       dev_head = g_list_remove(dev_head, devtype);
+}
+
+static enum device_type *find_device(enum device_type devtype)
+{
+       GList *elem;
+       enum device_type *type = NULL;
+
+       for (elem = dev_head; elem; elem = elem->next) {
+               type = elem->data;
+               if (*type == devtype)
+                       break;
+       }
+
+       return type;
+}
+
+API int device_get_property(enum device_type devtype, int property, int *value)
+{
+       struct device *dev;
+       enum device_type *type;
+       int r;
+
+       type = find_device(devtype);
+       if (type == NULL) {
+               DEVERR("devtype cannot find");
+               errno = EPERM;
+               return -1;
+       }
+
+       dev = container_of(type, struct device, type);
+       if (dev == NULL) {
+               DEVERR("device cannot find");
+               errno = EPERM;
+               return -1;
+       }
+
+       if (dev->get_prop == NULL) {
+               DEVERR("devtype doesn't have getter function");
+               errno = EPERM;
+               return -1;
+       }
+
+       r = dev->get_prop(property, value);
+       if (r == -ENODEV) {
+               DEVERR("Not support driver");
+               errno = ENODEV;
+               return -1;
+       } else if (r == -1) {
+               DEVERR("get_prop of %s return failes", dev->name);
+               errno = EPERM;
+               return -1;
+       }
+
+       errno = 0;
+       return 0;
+}
+
+API int device_set_property(enum device_type devtype, int property, int value)
+{
+       enum device_type *type;
+       struct device *dev;
+       int r;
+
+       type = find_device(devtype);
+       if (type == NULL) {
+               DEVERR("devtype cannot find");
+               errno = EPERM;
+               return -1;
+       }
+
+       dev = container_of(type, struct device, type);
+       if (dev == NULL) {
+               DEVERR("device cannot find");
+               errno = EPERM;
+               return -1;
+       }
+
+       if (dev->set_prop == NULL) {
+               DEVERR("devtype doesn't have setter function");
+               errno = EPERM;
+               return -1;
+       }
+
+       r = dev->set_prop(property, value);
+       if (r == -ENODEV) {
+               DEVERR("Not support driver");
+               errno = ENODEV;
+               return -1;
+       } else if (r == -1) {
+               DEVERR("set_prop of %s return failes", dev->name);
+               errno = EPERM;
+               return -1;
+       }
+
+       errno = 0;
+       return 0;
+}
+
+static void __CONSTRUCTOR__ module_init(void)
+{
+       const OEM_sys_devman_plugin_interface *(*OEM_sys_get_devman_plugin_interface) ();
+       char *error;
+
+       dlopen_handle = dlopen(DEVMAN_PLUGIN_PATH, RTLD_NOW);
+       if (!dlopen_handle) {
+               DEVERR("dlopen() failed");
+               goto ERROR;
+       }
+
+       OEM_sys_get_devman_plugin_interface = dlsym(dlopen_handle, "OEM_sys_get_devman_plugin_interface");
+       if ((error = dlerror()) != NULL) {
+               DEVERR("dlsym() failed: %s", error);
+               goto ERROR;
+       }
+
+       plugin_intf = OEM_sys_get_devman_plugin_interface();
+       if (!plugin_intf) {
+               DEVERR("get_devman_plugin_interface() failed");
+               goto ERROR;
+       }
+
+       return;
+
+ERROR:
+       plugin_intf = &default_plugin;
+
+       if (dlopen_handle)
+               dlclose(dlopen_handle);
+}
+
+static void __DESTRUCTOR__ module_fini(void)
+{
+       if (dlopen_handle)
+               dlclose(dlopen_handle);
+}
diff --git a/src/device-plugin.c b/src/device-plugin.c
new file mode 100644 (file)
index 0000000..13bfdc2
--- /dev/null
@@ -0,0 +1,479 @@
+/*
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+*/
+
+
+#include <string.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <dirent.h>
+#include <errno.h>
+
+#include "devman_plugin_intf.h"
+
+static int OEM_sys_get_display_count(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_backlight_min_brightness(int index, int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_backlight_max_brightness(int index, int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_backlight_brightness(int index, int *value, int power_saving)
+{
+       return 0;
+}
+
+static int OEM_sys_set_backlight_brightness(int index, int value, int power_saving)
+{
+       return 0;
+}
+
+static int OEM_sys_set_backlight_dimming(int index, int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_backlight_acl_control(int index, int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_backlight_acl_control(int index, int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_lcd_power(int index, int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_lcd_power(int index, int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_image_enhance_mode(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_image_enhance_mode(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_image_enhance_scenario(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_image_enhance_scenario(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_image_enhance_tone(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_image_enhance_tone(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_image_enhance_outdoor(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_image_enhance_outdoor(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_image_enhance_tune(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_image_enhance_tune(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_image_enhance_info(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_display_frame_rate(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_uart_path(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_uart_path(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_usb_path(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_usb_path(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_haptic_vibetones_level_max(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_haptic_vibetones_level(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_haptic_vibetones_level(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_haptic_vibetones_enable(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_haptic_vibetones_oneshot(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_battery_capacity(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_battery_capacity_raw(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_battery_charge_full(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_battery_charge_now(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_battery_present(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_battery_health(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_battery_polling_required(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_battery_support_insuspend_charging(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_jack_charger_online(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_jack_earjack_online(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_jack_earkey_online(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_jack_hdmi_online(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_jack_usb_online(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_jack_cradle_online(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_jack_tvout_online(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_jack_keyboard_online(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_leds_torch_max_brightness(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_leds_torch_brightness(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_leds_torch_brightness(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_power_state(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_power_wakeup_count(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_power_wakeup_count(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_memnotify_node(char *node)
+{
+       return 0;
+}
+
+static int OEM_sys_get_memnotify_victim_task(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_memnotify_threshold_lv1(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_memnotify_threshold_lv2(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_process_monitor_node(char *node)
+{
+       return 0;
+}
+
+static int OEM_sys_set_process_monitor_mp_pnp(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_process_monitor_mp_vip(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_cpufreq_cpuinfo_max_freq(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_cpufreq_cpuinfo_min_freq(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_cpufreq_scaling_max_freq(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_cpufreq_scaling_max_freq(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_cpufreq_scaling_min_freq(int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_cpufreq_scaling_min_freq(int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_backlight_brightness_by_lux(int lux)
+{
+       return 0;
+}
+
+static int OEM_sys_get_whitemagic_mode(int index, int *value)
+{
+       return 0;
+}
+
+static int OEM_sys_set_whitemagic_mode(int index, int value)
+{
+       return 0;
+}
+
+static int OEM_sys_get_hdmi_support(int *value)
+{
+       return 0;
+}
+
+const OEM_sys_devman_plugin_interface default_plugin = {
+       /* Light interfaces */
+       .OEM_sys_get_display_count = &OEM_sys_get_display_count,
+       .OEM_sys_get_backlight_min_brightness = &OEM_sys_get_backlight_min_brightness,
+       .OEM_sys_get_backlight_max_brightness = &OEM_sys_get_backlight_max_brightness,
+       .OEM_sys_get_backlight_brightness = &OEM_sys_get_backlight_brightness,
+       .OEM_sys_set_backlight_brightness = &OEM_sys_set_backlight_brightness,
+       .OEM_sys_set_backlight_dimming = &OEM_sys_set_backlight_dimming,
+       .OEM_sys_get_backlight_acl_control = &OEM_sys_get_backlight_acl_control,
+       .OEM_sys_set_backlight_acl_control = &OEM_sys_set_backlight_acl_control,
+
+       .OEM_sys_get_lcd_power = &OEM_sys_get_lcd_power,
+       .OEM_sys_set_lcd_power = &OEM_sys_set_lcd_power,
+
+       /* Image Ehnhace interfaces */
+       .OEM_sys_get_image_enhance_mode = &OEM_sys_get_image_enhance_mode,
+       .OEM_sys_set_image_enhance_mode = &OEM_sys_set_image_enhance_mode,
+       .OEM_sys_get_image_enhance_scenario = &OEM_sys_get_image_enhance_scenario,
+       .OEM_sys_set_image_enhance_scenario = &OEM_sys_set_image_enhance_scenario,
+       .OEM_sys_get_image_enhance_tone = &OEM_sys_get_image_enhance_tone,
+       .OEM_sys_set_image_enhance_tone = &OEM_sys_set_image_enhance_tone,
+       .OEM_sys_get_image_enhance_outdoor = &OEM_sys_get_image_enhance_outdoor,
+       .OEM_sys_set_image_enhance_outdoor = &OEM_sys_set_image_enhance_outdoor,
+
+       .OEM_sys_get_image_enhance_tune = &OEM_sys_get_image_enhance_tune,
+       .OEM_sys_set_image_enhance_tune = &OEM_sys_set_image_enhance_tune,
+
+       .OEM_sys_image_enhance_info = &OEM_sys_image_enhance_info,
+
+       .OEM_sys_set_display_frame_rate = &OEM_sys_set_display_frame_rate,
+
+       /* UART path interfaces */
+       .OEM_sys_get_uart_path = &OEM_sys_get_uart_path,
+       .OEM_sys_set_uart_path = &OEM_sys_set_uart_path,
+
+       /* USB path interfaces */
+       .OEM_sys_get_usb_path = &OEM_sys_get_usb_path,
+       .OEM_sys_set_usb_path = &OEM_sys_set_usb_path,
+
+       /* Vibrator interfaces */
+       .OEM_sys_get_haptic_vibetones_level_max = &OEM_sys_get_haptic_vibetones_level_max,
+       .OEM_sys_get_haptic_vibetones_level = &OEM_sys_get_haptic_vibetones_level,
+       .OEM_sys_set_haptic_vibetones_level = &OEM_sys_set_haptic_vibetones_level,
+       .OEM_sys_set_haptic_vibetones_enable = &OEM_sys_set_haptic_vibetones_enable,
+       .OEM_sys_set_haptic_vibetones_oneshot = &OEM_sys_set_haptic_vibetones_oneshot,
+
+       /* Battery interfaces */
+       .OEM_sys_get_battery_capacity = &OEM_sys_get_battery_capacity,
+       .OEM_sys_get_battery_capacity_raw = &OEM_sys_get_battery_capacity_raw,
+       .OEM_sys_get_battery_charge_full = &OEM_sys_get_battery_charge_full,
+       .OEM_sys_get_battery_charge_now = &OEM_sys_get_battery_charge_now,
+       .OEM_sys_get_battery_present = &OEM_sys_get_battery_present,
+       .OEM_sys_get_battery_health = &OEM_sys_get_battery_health,
+       .OEM_sys_get_battery_polling_required= &OEM_sys_get_battery_polling_required,
+       .OEM_sys_get_battery_support_insuspend_charging = &OEM_sys_get_battery_support_insuspend_charging,
+
+       /* Connection interfaces  */
+       .OEM_sys_get_jack_charger_online = &OEM_sys_get_jack_charger_online,
+       .OEM_sys_get_jack_earjack_online = &OEM_sys_get_jack_earjack_online,
+       .OEM_sys_get_jack_earkey_online = &OEM_sys_get_jack_earkey_online,
+       .OEM_sys_get_jack_hdmi_online = &OEM_sys_get_jack_hdmi_online,
+       .OEM_sys_get_jack_usb_online = &OEM_sys_get_jack_usb_online,
+       .OEM_sys_get_jack_cradle_online = &OEM_sys_get_jack_cradle_online,
+       .OEM_sys_get_jack_tvout_online = &OEM_sys_get_jack_tvout_online,
+       .OEM_sys_get_jack_keyboard_online = &OEM_sys_get_jack_keyboard_online,
+
+       .OEM_sys_get_hdmi_support = &OEM_sys_get_hdmi_support,
+
+       /* Torch interfaces */
+       .OEM_sys_get_leds_torch_max_brightness = &OEM_sys_get_leds_torch_max_brightness,
+       .OEM_sys_get_leds_torch_brightness = &OEM_sys_get_leds_torch_brightness,
+       .OEM_sys_set_leds_torch_brightness = &OEM_sys_set_leds_torch_brightness,
+
+       /* Power management interfaces */
+       .OEM_sys_set_power_state = &OEM_sys_set_power_state,
+
+       /* TODO: Should determine enum values of wakeup_count nodes */
+       .OEM_sys_get_power_wakeup_count = &OEM_sys_get_power_wakeup_count,
+       .OEM_sys_set_power_wakeup_count = &OEM_sys_set_power_wakeup_count,
+
+       /* OOM interfaces */
+       .OEM_sys_get_memnotify_node = &OEM_sys_get_memnotify_node,
+       .OEM_sys_get_memnotify_victim_task = &OEM_sys_get_memnotify_victim_task,
+       .OEM_sys_set_memnotify_threshold_lv1 = &OEM_sys_set_memnotify_threshold_lv1,
+       .OEM_sys_set_memnotify_threshold_lv2 = &OEM_sys_set_memnotify_threshold_lv2,
+
+       /* Process monitor interfaces */
+       .OEM_sys_get_process_monitor_node = &OEM_sys_get_process_monitor_node,
+       .OEM_sys_set_process_monitor_mp_pnp = &OEM_sys_set_process_monitor_mp_pnp,
+       .OEM_sys_set_process_monitor_mp_vip = &OEM_sys_set_process_monitor_mp_vip,
+
+       /* UART path interfaces */
+       .OEM_sys_get_cpufreq_cpuinfo_max_freq = &OEM_sys_get_cpufreq_cpuinfo_max_freq,
+       .OEM_sys_get_cpufreq_cpuinfo_min_freq = &OEM_sys_get_cpufreq_cpuinfo_min_freq,
+       .OEM_sys_get_cpufreq_scaling_max_freq = &OEM_sys_get_cpufreq_scaling_max_freq,
+       .OEM_sys_set_cpufreq_scaling_max_freq = &OEM_sys_set_cpufreq_scaling_max_freq,
+       .OEM_sys_get_cpufreq_scaling_min_freq = &OEM_sys_get_cpufreq_scaling_min_freq,
+       .OEM_sys_set_cpufreq_scaling_min_freq = &OEM_sys_set_cpufreq_scaling_min_freq,
+
+       .OEM_sys_get_backlight_brightness_by_lux = &OEM_sys_get_backlight_brightness_by_lux,
+
+       .OEM_sys_get_whitemagic_mode = &OEM_sys_get_whitemagic_mode,
+       .OEM_sys_set_whitemagic_mode = &OEM_sys_set_whitemagic_mode,
+};
diff --git a/udev/rules.d/95-permissions-slp.rules b/udev/rules.d/95-permissions-slp.rules
new file mode 100644 (file)
index 0000000..f092b12
--- /dev/null
@@ -0,0 +1,64 @@
+ACTION=="remove", GOTO="permissions_slp_end"
+
+KERNEL=="s3c-jpeg",            MODE="0660", GROUP="camera"
+KERNEL=="s5p-jpeg",            MODE="0660", GROUP="camera"
+KERNEL=="radio[0-9]",          MODE="0660", GROUP="radio"
+KERNEL=="s5p-mfc",             MODE="0660", GROUP="hwcodec"
+KERNEL=="s3c-mfc",             MODE="0660", GROUP="hwcodec"
+KERNEL=="srp",                 MODE="0660", GROUP="hwcodec"
+KERNEL=="log_main",            MODE="0660", GROUP="app_logging"
+KERNEL=="log_events",          MODE="0660", GROUP="app_logging"
+KERNEL=="log_radio",           MODE="0660", GROUP="app_logging"
+KERNEL=="log_system",          MODE="0660", GROUP="sys_logging"
+KERNEL=="controlC0D[0-9]c",    MODE="0660", GROUP="recording"
+KERNEL=="pcmC0D[0-9]c",                MODE="0660", GROUP="recording"
+KERNEL=="controlC0",           MODE="0660", GROUP="audio"
+KERNEL=="pcmC0D[0-9]p",                MODE="0660", GROUP="audio"
+KERNEL=="fb[0-9]",             MODE="0660", GROUP="video"
+KERNEL=="s3c-mem",             MODE="0660", GROUP="video"
+KERNEL=="umts_csd",            MODE="0660", GROUP="video_tel"
+
+KERNEL=="pvrsrvkm",            MODE="0666"
+KERNEL=="ump",                 MODE="0666"
+KERNEL=="mali",                        MODE="0666"
+KERNEL=="slp_global_lock",     MODE="0666"
+KERNEL=="usb_mtp_gadget",      MODE="0666"
+KERNEL=="usb_accessory",       MODE="0666"
+SUBSYSTEM=="drm",              MODE="0666"
+
+# Marvell
+KERNEL=="uio[0-9]",            MODE="0666"
+
+# Brightness control
+SUBSYSTEM=="leds",      ATTR{brightness}=="?*", RUN+="/bin/chmod 0664 %S/%p/brightness", RUN+="/bin/chown :system_torch %S/%p/brightness"
+SUBSYSTEM=="backlight", ATTR{brightness}=="?*", RUN+="/bin/chmod 0664 %S/%p/brightness", RUN+="/bin/chown :system_bklight %S/%p/brightness"
+
+# flash (7/16 added)
+SUBSYSTEM=="camera",    RUN+="/bin/chmod 0666 %S/%p/rear_flash"
+SUBSYSTEM=="camera",    RUN+="/bin/chmod 0666 %S/%p/max_brightness"
+
+# mDNIe
+DRIVER=="mdnie",       RUN+="/bin/chmod 0666 %S/%p/mode"
+DRIVER=="mdnie",       RUN+="/bin/chmod 0666 %S/%p/scenario"
+DRIVER=="mdnie",       RUN+="/bin/chmod 0666 %S/%p/tone"
+DRIVER=="mdnie",       RUN+="/bin/chmod 0666 %S/%p/outdoor"
+DRIVER=="mdnie",       RUN+="/bin/chmod 0666 %S/%p/tune"
+
+# haptic
+SUBSYSTEM=="haptic",   RUN+="/bin/chmod 0666 %S/%p/level"
+SUBSYSTEM=="haptic",   RUN+="/bin/chmod 0666 %S/%p/enable"
+SUBSYSTEM=="haptic",   RUN+="/bin/chmod 0666 %S/%p/oneshot"
+
+# Video4Linux
+SUBSYSTEM!="video4linux", GOTO="v4l_slp_end"
+IMPORT{program}="uname_env kernel-release"
+
+KERNEL=="video0", ENV{UNAME_KERNEL_RELEASE}=="3.0.*", GROUP="camera", MODE="0660", GOTO="v4l_slp_end"
+KERNEL=="video1", ENV{UNAME_KERNEL_RELEASE}=="3.4.*", GROUP="camera", MODE="0660", GOTO="v4l_slp_end"
+KERNEL=="video3", ENV{UNAME_KERNEL_RELEASE}=="3.4.*", GROUP="camera", MODE="0660", GOTO="v4l_slp_end"
+
+# Remaining video devices
+KERNEL=="video[0-9]", MODE="0660", GROUP="video"
+LABEL="v4l_slp_end"
+
+LABEL="permissions_slp_end"