diff options
author | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-16 01:18:00 +0900 |
---|---|---|
committer | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-16 01:18:00 +0900 |
commit | f55f908bee7c246a6eadbdd63932c0529887109e (patch) | |
tree | f65c6bab505b5b29dc70a65db3d934a100fd4ddf | |
parent | 92f3814e21da282c71f8ccbc31fe61c7641a6a74 (diff) | |
download | devman-f55f908bee7c246a6eadbdd63932c0529887109e.tar.gz devman-f55f908bee7c246a6eadbdd63932c0529887109e.tar.bz2 devman-f55f908bee7c246a6eadbdd63932c0529887109e.zip |
merge with master
33 files changed, 514 insertions, 2782 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c3b9042..be175cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,55 +6,42 @@ pkg_check_modules(rpkgs REQUIRED vconf dlog heynoti - haptic) + haptic + device-node) ADD_DEFINITIONS(${rpkgs_CFLAGS}) SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRAINTS true) SET(SRCS - src/device_plugin.c - src/device_engine.c src/device_haptic.c src/if_legacy.c - src/if_generic.c src/devman_internal.c) SET(HEADERS include/devman.h include/devman_managed.h include/devman_image.h - include/devman_error.h include/devman_haptic.h include/devman_haptic_ext.h - include/devman_haptic_ext_core.h - include/devman_plugin_intf.h - SLP_devman_PG.h) - -INCLUDE(devices/CMakeLists.txt) + include/devman_haptic_ext_core.h) SET(INC_DIR include) INCLUDE_DIRECTORIES(${INC_DIR}) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) -SET(EXEC_PREFIX "\${prefix}") -SET(LIBDIR "\${prefix}/lib") -SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}") -SET(DATADIR ${CMAKE_DATADIR}) +SET(EXEC_PREFIX "${PREFIX}/bin") +SET(LIBDIR "${PREFIX}/lib") +SET(INCLUDEDIR "${PREFIX}/include/${PROJECT_NAME}") +SET(DATADIR "${PREFIX}/share/devman") SET(VERSION 0.1) -SET(RC_LOCAL_SCRIPT devman) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") -ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") -ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"") -ADD_DEFINITIONS("-DENABLE_DLOG_OUT -DSLP_DEBUG") - ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS} ${TARGET_SRCS}) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${rpkgs_LDFLAGS} "-ldl") +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${rpkgs_LDFLAGS}) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION}) ADD_EXECUTABLE(display_wd src/display_wd.c) @@ -63,15 +50,11 @@ INSTALL(TARGETS display_wd DESTINATION bin) CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) CONFIGURE_FILE(${PROJECT_NAME}_haptic.pc.in ${PROJECT_NAME}_haptic.pc @ONLY) -CONFIGURE_FILE(${PROJECT_NAME}_plugin.pc.in ${PROJECT_NAME}_plugin.pc @ONLY) -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT RuntimeLibraries) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_haptic.pc DESTINATION lib/pkgconfig) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_plugin.pc DESTINATION lib/pkgconfig) +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_haptic.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) FOREACH(hfile ${HEADERS}) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} DESTINATION include/${PROJECT_NAME}) ENDFOREACH(hfile) - -INSTALL(PROGRAMS ${RC_LOCAL_SCRIPT} DESTINATION /etc/rc.d/init.d) diff --git a/devices/CMakeLists.txt b/devices/CMakeLists.txt deleted file mode 100644 index c8d8f7e..0000000 --- a/devices/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -SET(TARGET_SRCS - devices/haptic.c - devices/jack_35pi.c - devices/jack_microusb.c - devices/mmc.c - devices/power_supply_battery.c - devices/power_supply_pmic.c - devices/uart.c - devices/video.c - devices/led.c -) diff --git a/devices/haptic.c b/devices/haptic.c deleted file mode 100644 index a7563ac..0000000 --- a/devices/haptic.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * devman - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: DongGi Jang <dg0402.jang@samsung.com> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - -#include "device_engine.h" -#include "device_plugin.h" - -static int get_haptic(int prop, int *val) -{ - switch (prop) { - case HAPTIC_PROP_LEVEL: - return plugin_intf->OEM_sys_get_haptic_vibetones_level(val); - case HAPTIC_PROP_LEVEL_MAX: - return plugin_intf->OEM_sys_get_haptic_vibetones_level_max(val); - } - - return -1; -} - -static int set_haptic(int prop, int val) -{ - switch (prop) { - case HAPTIC_PROP_ENABLE: - return plugin_intf->OEM_sys_set_haptic_vibetones_enable(val); - case HAPTIC_PROP_LEVEL: - return plugin_intf->OEM_sys_set_haptic_vibetones_level(val); - case HAPTIC_PROP_ONESHOT: - return plugin_intf->OEM_sys_set_haptic_vibetones_oneshot(val); - } - - return -1; -} - -static struct device haptic = { - .devname = "haptic", - .set_int = set_haptic, - .get_int = get_haptic, - .devtype = DEVTYPE_HAPTIC -}; - -static void __attribute__ ((constructor)) module_init() -{ - add_dev(&haptic); -} diff --git a/devices/jack_35pi.c b/devices/jack_35pi.c deleted file mode 100644 index 2e985b2..0000000 --- a/devices/jack_35pi.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * devman - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: DongGi Jang <dg0402.jang@samsung.com> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - - -#include "device_engine.h" -#include "device_plugin.h" - -static int get_35pi(int prop, int *val) -{ - - switch (prop) { - case JACK_PROP_MIC_ONLINE: - return -1; - case JACK_PROP_EARKEY_PRESS: - return plugin_intf->OEM_sys_get_jack_earkey_online(val); - case JACK_PROP_EARJACK_ONLINE: - return plugin_intf->OEM_sys_get_jack_earjack_online(val); - case JACK_PROP_TVOUT_ONLINE: - return plugin_intf->OEM_sys_get_jack_tvout_online(val); - } - - return -1; -} - -static struct device microusb = { - .devname = "35pi", - .get_int = get_35pi, - .devtype = DEVTYPE_JACK, -}; - -static void __attribute__ ((constructor)) module_init() -{ - add_dev(µusb); -} diff --git a/devices/jack_microusb.c b/devices/jack_microusb.c deleted file mode 100644 index 61234a8..0000000 --- a/devices/jack_microusb.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * devman - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: DongGi Jang <dg0402.jang@samsung.com> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - - -#include "device_engine.h" -#include "device_plugin.h" - -static int get_microusb_status(int prop, int *val) -{ - switch (prop) { - case JACK_PROP_USB_ONLINE: - return plugin_intf->OEM_sys_get_jack_usb_online(val); - case JACK_PROP_TA_ONLINE: - return plugin_intf->OEM_sys_get_jack_charger_online(val); - case JACK_PROP_HDMI_ONLINE: - return plugin_intf->OEM_sys_get_jack_hdmi_online(val); - case JACK_PROP_CRADLE_ONLINE: - return plugin_intf->OEM_sys_get_jack_cradle_online(val); - case JACK_PROP_USB_PATH: - return plugin_intf->OEM_sys_get_usb_path(val); - } - - return -1; -} - -static int set_microusb_path(int prop, int val) -{ - int ret = -1; - switch (prop) { - case JACK_PROP_USB_PATH: - ret = plugin_intf->OEM_sys_set_usb_path(val); - if(ret == 0){ - if(val == PATH_CP) - system("/usr/bin/save_blenv usbpath CP"); - else - system("/usr/bin/save_blenv usbpath AP"); - } - return ret; - } - - return -1; -} - -static struct device microusb = { - .devname = "microusb", - .set_int = set_microusb_path, - .get_int = get_microusb_status, - .devtype = DEVTYPE_JACK, -}; - -static void __attribute__ ((constructor)) module_init() -{ - add_dev(µusb); -} diff --git a/devices/led.c b/devices/led.c deleted file mode 100644 index 378665d..0000000 --- a/devices/led.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * devman - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: DongGi Jang <dg0402.jang@samsung.com> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - - -#include "device_engine.h" -#include "device_plugin.h" - -static int get_led_prop(int prop, int *val) -{ - switch (prop) { - case LED_PROP_BRIGHTNESS: - return plugin_intf->OEM_sys_get_leds_torch_brightness(val); - case LED_PROP_MAX_BRIGHTNESS: - return plugin_intf->OEM_sys_get_leds_torch_max_brightness(val); - } - return -1; -} - -static int set_led_prop(int prop, int val) -{ - switch (prop) { - case LED_PROP_BRIGHTNESS: - return plugin_intf->OEM_sys_set_leds_torch_brightness(val); - } - return -1; -} - -static struct device led_prop = { - .devname = "led", - .set_int = set_led_prop, - .get_int = get_led_prop, - .devtype = DEVTYPE_LED -}; - -static void __attribute__ ((constructor)) module_init() -{ - add_dev(&led_prop); -} diff --git a/devices/mmc.c b/devices/mmc.c deleted file mode 100644 index 802bff0..0000000 --- a/devices/mmc.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * devman - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: DongGi Jang <dg0402.jang@samsung.com> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/ioctl.h> -#include <sys/mount.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <limits.h> -#include <string.h> -#include <signal.h> -#include <errno.h> -#include <heynoti.h> -#include <vconf.h> - -#include "device_engine.h" - -#define MMC_DEV "/dev/mmcblk" -#define MMC_MOUNT_PATH "/opt/storage/sdcard" -#define MMC_PARENT_PATH "/opt/storage" - -static int exec_process(char *name, const char *arg1) -{ - int ret, pid; - int i; - - if (name[0] == '\0') - return 0; - - pid = fork(); - switch (pid) { - case -1: - ERR("Fork error"); - ret = -1; - break; - case 0: - for (i = 0; i < _NSIG; i++) - signal(i, SIG_DFL); - execl(name, name, "-c", "-F", "32", arg1, NULL); - ERR("execlp() error : %s\n", strerror(errno)); - exit(-1); - break; - default: - ret = pid; - break; - } - return ret; -} - -static int get_mmcblk_num() -{ - int i; - char buf[255]; - - /* mmcblk0 and mmcblk1 is reserved for movinand */ - for (i = 9; i > 0; i--) { - snprintf(buf, 255, "%s%d", MMC_DEV, i); - if (access(buf, R_OK) == 0) - return i; - } - ERR("Failed to find mmc block number\n"); - return -1; -} - -int format_mmc(int blknum) -{ - int fd; - struct stat parent_stat, mount_stat; - char parent_path[PATH_MAX], mount_path[PATH_MAX]; - int ret_s = 0; - unsigned char buf[512]; - char dev_mmcblk[NAME_MAX]; - int mkfs_pid = 0; - int retry_cnt = 0; - - if (blknum < 0) { - ERR("blknum(%d) is error", blknum); - vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT, VCONFKEY_SYSMAN_MMC_FORMAT_FAILED); - return -1; - } - - snprintf(dev_mmcblk, sizeof(dev_mmcblk), "%s%d", MMC_DEV, blknum); - snprintf(parent_path, sizeof(parent_path), "%s", MMC_PARENT_PATH); - snprintf(mount_path, sizeof(mount_path), "%s", MMC_MOUNT_PATH); - - DBG("1. checking mount path"); - - if (stat(mount_path, &mount_stat) != 0 || stat(parent_path, &parent_stat) != 0) { - ERR("get stat error : %s", strerror(errno)); - vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT, VCONFKEY_SYSMAN_MMC_FORMAT_FAILED); - return -1; - } - - if (mount_stat.st_dev == parent_stat.st_dev) { - ERR("Does not mounted, same st_dev"); - vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT, VCONFKEY_SYSMAN_MMC_FORMAT_FAILED); - return -1; - } - - if (umount2(MMC_MOUNT_PATH, MNT_FORCE) == -1) { - ERR("devman mmc_format umount fail : %s", strerror(errno)); - if (umount2(MMC_MOUNT_PATH, MNT_FORCE) == -1) { - vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT, VCONFKEY_SYSMAN_MMC_FORMAT_FAILED); - ERR("devman mmc_format umount retry fail : %s", strerror(errno)); - return -1; - } - } - - DBG("2. Initializing a MBR"); - - memset(buf, 0, sizeof(buf)); - buf[0x1FE] = 0x55; - buf[0x1FF] = 0xAA; - - fd = open(dev_mmcblk, O_RDWR); - if (fd < 0) { - ERR("%s open fail : %s", dev_mmcblk, strerror(errno)); - ret_s = -1; - } else { - if (write(fd, buf, sizeof(buf)) < 0) { - ERR("%s write fail to erase partition : %s", dev_mmcblk, strerror(errno)); - close(fd); - ret_s = -2; - } else { - sync(); - usleep(200000); - - DBG("3. Creating partition table"); - - if (ioctl(fd, BLKRRPART, NULL) < 0) { - ERR("%s ioctl fail : %s", dev_mmcblk, strerror(errno)); - } - - close(fd); - sync(); - - DBG("4. Executing mkfs.vfat"); - - mkfs_pid = exec_process("/sbin/mkfs.vfat", dev_mmcblk); - if (mkfs_pid == -1) { - ERR("devman mmc_format mkfs.vfat fail"); - ret_s = -3; - } - - snprintf(buf, sizeof(buf), "%s%d", "/proc/", mkfs_pid); - while (1) { - sleep(1); - if (access(buf, R_OK) != 0) - break; - } - - sync(); - } - } - - if (ret_s) { - vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT, VCONFKEY_SYSMAN_MMC_FORMAT_FAILED); - ERR("Format Failure : error(%d)", ret_s); - heynoti_publish("mmcblk_remove"); - return -1; - } - - while (mount(dev_mmcblk, MMC_MOUNT_PATH, "vfat", 0, - "uid=0,gid=0,dmask=0000,fmask=0111,iocharset=iso8859-1,utf8,shortname=mixed,smackfsroot=*,smackfsdef=*") != 0) { - if (++retry_cnt > 10) { - vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT, VCONFKEY_SYSMAN_MMC_FORMAT_FAILED); - ERR("Format Failure : error(%d)", ret_s); - heynoti_publish("mmcblk_remove"); - return -1; - } - usleep(100000); - ERR("Failed to mount mmc card... retrying(%02d) : %s", retry_cnt, strerror(errno)); - } - - vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT, VCONFKEY_SYSMAN_MMC_FORMAT_COMPLETED); - DBG("Format Successful"); - return 0; -} - -static int set_mmc_int(int prop, int val) -{ - int ret = -1; - switch (prop) { - case MMC_PROP_FORMAT: - ret = format_mmc(get_mmcblk_num()); - return ret; - } - - return -1; - -} - -static struct device mmc = { - .devname = "mmc", - .set_int = set_mmc_int, - .devtype = DEVTYPE_MMC, -}; - -static void __attribute__ ((constructor)) module_init() -{ - add_dev(&mmc); -} diff --git a/devices/power_supply_battery.c b/devices/power_supply_battery.c deleted file mode 100644 index b551196..0000000 --- a/devices/power_supply_battery.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * devman - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: DongGi Jang <dg0402.jang@samsung.com> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - - -#include "device_engine.h" -#include "device_plugin.h" - -static int get_battery(int prop, int *val) -{ - switch (prop) { - case POWER_SUPPLY_PROP_CAPACITY: - return plugin_intf->OEM_sys_get_battery_capacity(val); - case POWER_SUPPLY_PROP_CAPACITY_RAW: - return plugin_intf->OEM_sys_get_battery_capacity_raw(val); - } - - return -1; -} - -static struct device powersupply = { - .devname = "power_supply_battery", - .set_int = NULL, - .get_int = get_battery, - .devtype = DEVTYPE_POWERSUPPLY, -}; - -static void __attribute__ ((constructor)) module_init() -{ - add_dev(&powersupply); -} diff --git a/devices/power_supply_pmic.c b/devices/power_supply_pmic.c deleted file mode 100644 index 8c8ff6e..0000000 --- a/devices/power_supply_pmic.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * devman - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: DongGi Jang <dg0402.jang@samsung.com> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - - -#include "device_engine.h" -#include "device_plugin.h" - -static int get_pmic(int prop, int *val) -{ - switch (prop) { - case POWER_SUPPLY_PROP_CHARGE_NOW: - return plugin_intf->OEM_sys_get_battery_charge_now(val); - case POWER_SUPPLY_PROP_CHARGE_FULL: - return plugin_intf->OEM_sys_get_battery_charge_full(val); - case POWER_SUPPLY_PROP_BATTERY_HEALTH: - return plugin_intf->OEM_sys_get_battery_health(val); - } - - return -1; -} - -static struct device powersupply = { - .devname = "power_supply_pmic", - .set_int = NULL, - .get_int = get_pmic, - .devtype = DEVTYPE_POWERSUPPLY, -}; - -static void __attribute__ ((constructor)) module_init() -{ - add_dev(&powersupply); -} diff --git a/devices/uart.c b/devices/uart.c deleted file mode 100644 index f27bd65..0000000 --- a/devices/uart.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * devman - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: DongGi Jang <dg0402.jang@samsung.com> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - - -#include "device_engine.h" -#include "device_plugin.h" - -static int uart_get(int prop, int *val) -{ - switch (prop) { - case UART_PROP_SELECT_PATH: - return plugin_intf->OEM_sys_get_uart_path(val); - } - - return -1; -} - -static int uart_set(int prop, int val) -{ - int ret = -1 ; - switch (prop) { - case UART_PROP_SELECT_PATH: - ret = plugin_intf->OEM_sys_set_uart_path(val); - if(ret == 0){ - if(val == PATH_CP) - system("/usr/bin/save_blenv uartpath CP"); - else - system("/usr/bin/save_blenv uartpath AP"); - } - return ret; - } - - return -1; -} - -static struct device uart = { - .devname = "uart", - .set_int = uart_set, - .get_int = uart_get, - .devtype = DEVTYPE_UART, -}; - -static void __attribute__ ((constructor)) module_init() -{ - add_dev(&uart); -} diff --git a/devices/video.c b/devices/video.c deleted file mode 100644 index 7d57a36..0000000 --- a/devices/video.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * devman - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: DongGi Jang <dg0402.jang@samsung.com> - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - - -#include "device_engine.h" -#include "device_plugin.h" -#include "vconf.h" - -#define PROPERTY_MASK 0x0F -#define INDEX_SHIFT_CNT 4 - -static int get_video_prop(int prop, int *val) -{ - int _prop = prop & PROPERTY_MASK; - int _index = prop >> 4; - int _max_disp_cnt = -1; - int power_saving_stat = -1; - int power_saving_display_stat = -1; - - DBG("Property: %d, Index: %d", _prop, _index); - if (0 > plugin_intf->OEM_sys_get_display_count(&_max_disp_cnt)) { - ERR("Get display count failed"); - return -1; - } - - if (_index >= _max_disp_cnt) { - ERR("Invalid Argument: display index > max display count"); - return -1; - } - - switch (_prop) { - case DISPLAY_PROP_BRIGHTNESS: - /* check power saving */ - vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_SYSMODE_STATUS, &power_saving_stat); - if (power_saving_stat == 1) - vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_DISPLAY, &power_saving_display_stat); - if (power_saving_display_stat != 1) - power_saving_display_stat = 0; - return plugin_intf->OEM_sys_get_backlight_brightness(_index, val, power_saving_display_stat); - case DISPLAY_PROP_MIN_BRIGHTNESS: - return plugin_intf->OEM_sys_get_backlight_min_brightness(_index, val); - case DISPLAY_PROP_MAX_BRIGHTNESS: - return plugin_intf->OEM_sys_get_backlight_max_brightness(_index, val); - case DISPLAY_PROP_ONOFF: - return plugin_intf->OEM_sys_get_lcd_power(_index, val); - case DISPLAY_PROP_GAMMA: - /* TODO: not supported yet */ - DBG("Gamma is not supported"); - return 0; - case DISPLAY_PROP_DISPLAY_COUNT: - *val = _max_disp_cnt; - return 0; - case DISPLAY_PROP_ACL_CONTROL: - return plugin_intf->OEM_sys_get_backlight_acl_control(_index, val); - case DISPLAY_PROP_IMAGE_ENHANCE_MODE: - return plugin_intf->OEM_sys_get_image_enhance_mode(val); - case DISPLAY_PROP_IMAGE_ENHANCE_SCENARIO: - return plugin_intf->OEM_sys_get_image_enhance_scenario(val); - case DISPLAY_PROP_IMAGE_ENHANCE_TONE: - return plugin_intf->OEM_sys_get_image_enhance_tone(val); - case DISPLAY_PROP_IMAGE_ENHANCE_OUTDOOR: - return plugin_intf->OEM_sys_get_image_enhance_outdoor(val); - case DISPLAY_PROP_IMAGE_ENHANCE_INFO: - return plugin_intf->OEM_sys_image_enhance_info(val); - } - - return -1; -} - -static int set_video_prop(int prop, int val) -{ - int _prop = prop & PROPERTY_MASK; - int _index = prop >> 4; - int _max_disp_cnt = -1; - int power_saving_stat = -1; - int power_saving_display_stat = -1; - - DBG("Property: %d, Index: %d", _prop, _index); - if (0 > plugin_intf->OEM_sys_get_display_count(&_max_disp_cnt)) { - ERR("Get display count failed"); - return -1; - } - - if (_index >= _max_disp_cnt) { - ERR("Invalid Argument: display index > max display count"); - return -1; - } - - switch (_prop) { - case DISPLAY_PROP_BRIGHTNESS: - /* check power saving */ - vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_SYSMODE_STATUS, &power_saving_stat); - if (power_saving_stat == 1) - vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_DISPLAY, &power_saving_display_stat); - if (power_saving_display_stat != 1) - power_saving_display_stat = 0; - return plugin_intf->OEM_sys_set_backlight_brightness(_index, val, power_saving_display_stat); - case DISPLAY_PROP_ONOFF: - return plugin_intf->OEM_sys_set_lcd_power(_index, val); - case DISPLAY_PROP_GAMMA: - /* TODO:not supported yet */ - DBG("Gamma is not supported"); - return 0; - case DISPLAY_PROP_ACL_CONTROL: - return plugin_intf->OEM_sys_set_backlight_acl_control(_index, val); - case DISPLAY_PROP_IMAGE_ENHANCE_MODE: - return plugin_intf->OEM_sys_set_image_enhance_mode(val); - case DISPLAY_PROP_IMAGE_ENHANCE_SCENARIO: - return plugin_intf->OEM_sys_set_image_enhance_scenario(val); - case DISPLAY_PROP_IMAGE_ENHANCE_TONE: - return plugin_intf->OEM_sys_set_image_enhance_tone(val); - case DISPLAY_PROP_IMAGE_ENHANCE_OUTDOOR: - return plugin_intf->OEM_sys_set_image_enhance_outdoor(val); - } - - return -1; -} - -static struct device video_prop = { - .devname = "video", - .set_int = set_video_prop, - .get_int = get_video_prop, - .devtype = DEVTYPE_DISPLAY0 -}; - -static void __attribute__ ((constructor)) module_init() -{ - add_dev(&video_prop); -} @@ -1,35 +0,0 @@ -#!/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/devman_plugin.pc.in b/devman_plugin.pc.in deleted file mode 100644 index 0ce74e9..0000000 --- a/devman_plugin.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -# 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_engine.h b/include/device_engine.h deleted file mode 100644 index c33bc48..0000000 --- a/include/device_engine.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * devman - * 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_ENGINE_H__ -#define __DEVICE_ENGINE_H__ - -#ifndef API -#define API __attribute__ ((visibility("default"))) -#endif - -#include <stdio.h> - -#include "devlog.h" -#include "devman.h" - -struct device { - devtype_t devtype; - char *devname; - int (*set_int) (int property, int val); - int (*get_int) (int property, int *val); - int (*probe) (void); - struct device *next; -}; - -void add_dev(struct device *dev); -struct device *find_device(struct device *root_dev, devtype_t devtype); -int set_devtype(char *devname, devtype_t devtype); -void reset_devtype(); -void print_devices(); - -#endif /* __DEVICE_ENGINE_H__ */ diff --git a/include/device_haptic.h b/include/device_haptic.h deleted file mode 100644 index e8fad12..0000000 --- a/include/device_haptic.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * devman - * 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_HAPTIC_H__ -#define __DEVICE_HAPTIC_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Default capability value - */ -#define DEFAULT_MOTOR_COUNT 1 - -/* - * Default device handle - */ -#define DEFAULT_DEVICE_HANDLE 1 - -/* - * Default duration value - */ -#define DEFAULT_DURATION_VALUE 30 - -/* - * Feedback level for generic APIs - */ - enum { - VIBE_FEEDBACK_LEVEL_0 = 0, /* HAPTIC FEEDBACK LEVEL 0 */ - VIBE_FEEDBACK_LEVEL_1 = 2000, /* HAPTIC_FEEDBACK_LEVEL_1 */ - VIBE_FEEDBACK_LEVEL_2 = 4000, /* HAPTIC_FEEDBACK_LEVEL_2 */ - VIBE_FEEDBACK_LEVEL_3 = 6000, /* HAPTIC_FEEDBACK_LEVEL_3 */ - VIBE_FEEDBACK_LEVEL_4 = 8000, /* HAPTIC_FEEDBACK_LEVEL_4 */ - VIBE_FEEDBACK_LEVEL_5 = 10000, /* HAPTIC_FEEDBACK_LEVEL_5 */ - }; - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/include/device_plugin.h b/include/device_plugin.h deleted file mode 100644 index 2866dbb..0000000 --- a/include/device_plugin.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * devman - * 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_PLUGIN_H__ -#define __DEVICE_PLUGIN_H__ - -#include "devman_plugin_intf.h" -#include "devlog.h" - -#define DEVMAN_PLUGIN_PATH "/usr/lib/libslp_devman_plugin.so" - -const OEM_sys_devman_plugin_interface *plugin_intf; - -#endif /* __DEVICE_PLUGIN_H__ */ diff --git a/include/devlog.h b/include/devlog.h index 8ad91ff..346b71a 100644 --- a/include/devlog.h +++ b/include/devlog.h @@ -19,155 +19,16 @@ #ifndef __DEVLOG_H__ #define __DEVLOG_H__ -/* - * SYSLOG_INFO(), SYSLOG_ERR(), SYSLOG_DBG() are syslog() wrappers. - * PRT_INFO(), PRT_ERR(), PRT_DBG() are fprintf() wrappers. - * - * If SLP_DEBUG is not defined, SYSLOG_DBG() and PRT_DBG() is ignored. - * - * IF SLP_SYSLOG_OUT is defined, - * INFO(), ERR(), DBG() are SYSLOG_XXX() - * IF ENABLE_DLOG_OUT is defined, - * INFO(), ERR(), DBG() are SLOGI(), SLOGE(), SLOGD() - * Otherwise, - * They are PRT_XXX() - * - * - * warn_if(exrp, fmt, ...) - * If expr is true, The fmt string is printed using ERR(). - * - * ret_if(), retv_if(), retm_if(), retvm_if() - * If expr is true, current function return. - * Postfix 'v' means that it has a return value and 'm' means that it has output message. - * - */ -#include <stdio.h> -#include <stdlib.h> +#define FEATURE_DEVMAN_DLOG -#if defined(ENABLE_DLOG_OUT) -# define LOG_TAG "DEVMAN" -# include <dlog.h> +#ifdef FEATURE_DEVMAN_DLOG + #define LOG_TAG "DEVMAN" + #include <dlog.h> + #define DEVLOG(fmt, args...) SLOGD(fmt, ##args) + #define DEVERR(fmt, args...) SLOGE(fmt, ##args) #else -# include <syslog.h> -# define __LOG(prio, fmt, arg...) \ - do { syslog(prio, fmt, ##arg); } while (0) -# define __LOGD(prio, fmt, arg...) \ - do { \ - if (getenv("SLP_DEBUG")) { \ - syslog(prio, "[%s:%d] "fmt"\n", __FILE__, __LINE__, ##arg); \ - } \ - } while (0) -#endif - -#define __PRTI(fmt, arg...) \ - do { fprintf(stdout, fmt"\n", ##arg); } while (0) -#define __PRTE(fmt, arg...) \ - do { fprintf(stderr, fmt"\n", ##arg); } while (0) -#define __PRTD(fmt, arg...) \ - do { \ - if (getenv("SLP_DEBUG")) { \ - fprintf(stdout, "[%s:%d] "fmt"\n", __FILE__, __LINE__, ##arg); \ - } \ - } while(0) -#define _NOUT(arg...) do { } while (0) - -#ifdef SLP_DEBUG -# define _LOGD __LOGD -# define _LOG __LOG -# define _PRTD __PRTD -# define _PRTI __PRTI -# define _PRTE __PRTE -#else -# define _LOGD _NOUT -# define _LOG __LOG -# define _PRTD _NOUT -# define _PRTI __PRTI -# define _PRTE __PRTE -#endif - -#define PRT_INFO(fmt, arg...) _PRTI(fmt, ##arg) -#define PRT_ERR(fmt, arg...) _PRTE(fmt, ##arg) -#define PRT_DBG(fmt, arg...) _PRTD(fmt, ##arg) - -#if defined(SLP_SYSLOG_OUT) -# define SYSLOG_INFO(fmt, arg...) _LOG(LOG_INFO, fmt, ##arg) -# define SYSLOG_ERR(fmt, arg...) _LOG(LOG_ERR, fmt, ##arg) -# define SYSLOG_DBG(fmt, arg...) _LOGD(LOG_DEBUG, fmt, ##arg) -# define INFO SYSLOG_INFO -# define ERR SYSLOG_ERR -# define DBG SYSLOG_DBG -#elif defined(ENABLE_DLOG_OUT) -# define INFO SLOGI -# define ERR SLOGE -# define DBG SLOGD -#else -# define INFO PRT_INFO -# define ERR PRT_ERR -# define DBG PRT_DBG -#endif - -#ifdef SLP_DEBUG -# define warn_if(expr, fmt, arg...) do { \ - if (expr) { \ - DBG("(%s) -> "fmt, #expr, ##arg); \ - } \ - } while (0) -# define ret_if(expr) do { \ - if (expr) { \ - DBG("(%s) -> %s() return", #expr, __FUNCTION__); \ - return; \ - } \ - } while (0) -# define retv_if(expr, val) do { \ - if (expr) { \ - DBG("(%s) -> %s() return", #expr, __FUNCTION__); \ - return (val); \ - } \ - } while (0) -# define retm_if(expr, fmt, arg...) do { \ - if (expr) { \ - ERR(fmt, ##arg); \ - DBG("(%s) -> %s() return", #expr, __FUNCTION__); \ - return; \ - } \ - } while (0) -# define retvm_if(expr, val, fmt, arg...) do { \ - if (expr) { \ - ERR(fmt, ##arg); \ - DBG("(%s) -> %s() return", #expr, __FUNCTION__); \ - return (val); \ - } \ - } while (0) - -#else -# define warn_if(expr, fmt, arg...) do { \ - if (expr) { \ - ERR(fmt, ##arg); \ - } \ - } while (0) -# define ret_if(expr) do { \ - if (expr) { \ - return; \ - } \ - } while (0) -# define retv_if(expr, val) do { \ - if (expr) { \ - return (val); \ - } \ - } while (0) -# define retm_if(expr, fmt, arg...) do { \ - if (expr) { \ - ERR(fmt, ##arg); \ - return; \ - } \ - } while (0) -# define retvm_if(expr, val, fmt, arg...) do { \ - if (expr) { \ - ERR(fmt, ##arg); \ - return (val); \ - } \ - } while (0) - + #define DEVLOG(x, ...) + #define DEVERR(x, ...) #endif -#endif /* __DEVLOG_H__ */ +#endif // __DEVLOG_H__ diff --git a/include/devman.h b/include/devman.h index bd43a20..c1d104f 100644 --- a/include/devman.h +++ b/include/devman.h @@ -23,20 +23,19 @@ #define DEPRECATED __attribute__((deprecated)) #endif -#include "devman_error.h" -/** START: This code related to the opensource api will be removed */ -#include "devman_managed.h" -/** END: Will be remved */ - #ifdef __cplusplus extern "C" { #endif +/** START: This code related to the opensource api will be removed */ +#include "devman_managed.h" +/** END: Will be remved */ + /** * @file devman.h * @ingroup DEVICE_MANAGER * @brief This file contains the API for the status of devices - * @author SLP2.0 + * @author Tizen2.0 * @date 2010-01-24 * @version 0.1 */ @@ -54,23 +53,32 @@ extern "C" { */ /** + * @brief Enumerations of error code for Devman + */ +typedef enum { + DEVMAN_ERROR_NONE = 0, /**< Successful */ + DEVMAN_ERROR_OPERATION_FAILED = -1, /**< Operation failed */ + DEVMAN_ERROR_NOT_SUPPORTED = -2, /**< Not supported in this device */ +} devman_error_e; + +/** * @par Description: * device type enum */ typedef enum devtype_list { - DEVTYPE_POWERSUPPLY, /**< battery, PMIC, etc about power */ - DEVTYPE_DISPLAY0, /**< main screen */ - DEVTYPE_DISPLAY1, /**< sub screen */ - DEVTYPE_HAPTIC, /**< motor */ - DEVTYPE_LED, /**< LED */ - DEVTYPE_JACK, /**< jack - Micro USB, 3.5 pi jack etc */ - DEVTYPE_TOUCHSCREEN, /**< main touch screen */ - DEVTYPE_TOUCHKEY, /**< touchkey */ - DEVTYPE_GPS, - DEVTYPE_UART, - DEVTYPE_MMC, /**< MMC card(Micro SD) */ - DEVTYPE_EFFECT_HAPTIC, /**< extended touchsense */ - DEVTYPE_MAX + DEVTYPE_DISPLAY0, /**< main screen */ + DEVTYPE_DISPLAY1 = DEVTYPE_DISPLAY0, /**< sub screen */ + DEVTYPE_HAPTIC, /**< motor */ + DEVTYPE_JACK, /**< jack - Micro USB, 3.5 pi jack etc */ + DEVTYPE_LED, /**< LED */ + DEVTYPE_POWERSUPPLY, /**< battery, PMIC, etc about power */ + DEVTYPE_MAX, + DEVTYPE_TOUCHSCREEN = -1, + DEVTYPE_TOUCHKEY = -1, + DEVTYPE_GPS = -1, + DEVTYPE_UART = -1, + DEVTYPE_MMC = -1, + DEVTYPE_EFFECT_HAPTIC = -1, } devtype_t; /** @@ -78,16 +86,16 @@ extern "C" { * DEVTYPE_POWERSUPPLY property for generic APIs */ enum { + /**< Current remaining battery */ + POWER_SUPPLY_PROP_CAPACITY, + /**< Current remaining battery expressed 1/10000 */ + POWER_SUPPLY_PROP_CAPACITY_RAW, /**< Battery is full-charged.*/ POWER_SUPPLY_PROP_CHARGE_FULL, /**< Battery is being charged now */ POWER_SUPPLY_PROP_CHARGE_NOW, - /**< Current remaining battery */ - POWER_SUPPLY_PROP_CAPACITY, /**< iBattery status about cahrge */ - POWER_SUPPLY_PROP_BATTERY_HEALTH, - /**< Current remaining battery expressed 1/10000 */ - POWER_SUPPLY_PROP_CAPACITY_RAW, + POWER_SUPPLY_PROP_BATTERY_HEALTH = 9, }; /** @@ -95,18 +103,18 @@ extern "C" { * DEVTYPE_DISPLAY0 and DEVTYPE_DISPLAY1 property for generic APIs */ enum { - DISPLAY_PROP_ONOFF, - DISPLAY_PROP_BRIGHTNESS, - DISPLAY_PROP_MIN_BRIGHTNESS, - DISPLAY_PROP_MAX_BRIGHTNESS, - DISPLAY_PROP_GAMMA, DISPLAY_PROP_DISPLAY_COUNT, + DISPLAY_PROP_BRIGHTNESS, DISPLAY_PROP_ACL_CONTROL, - DISPLAY_PROP_IMAGE_ENHANCE_MODE, + DISPLAY_PROP_ONOFF, + DISPLAY_PROP_IMAGE_ENHANCE_MODE = 8, DISPLAY_PROP_IMAGE_ENHANCE_SCENARIO, DISPLAY_PROP_IMAGE_ENHANCE_TONE, DISPLAY_PROP_IMAGE_ENHANCE_OUTDOOR, - DISPLAY_PROP_IMAGE_ENHANCE_INFO, + DISPLAY_PROP_IMAGE_ENHANCE_INFO = 13, + DISPLAY_PROP_MIN_BRIGHTNESS = -1, + DISPLAY_PROP_MAX_BRIGHTNESS = -1, + DISPLAY_PROP_GAMMA = -1, }; /** @@ -123,15 +131,15 @@ extern "C" { * DEVTYPE_JACK property for generic APIs */ enum { - JACK_PROP_EARJACK_ONLINE, /**< Earjack */ - JACK_PROP_MIC_ONLINE, /**< Microphone */ - JACK_PROP_TVOUT_ONLINE, /**< analog tvout */ - JACK_PROP_USB_ONLINE, /**< USB connection */ JACK_PROP_TA_ONLINE, /**< Travel Adapter(Charger) */ + JACK_PROP_EARJACK_ONLINE, /**< Earjack */ + JACK_PROP_EARKEY_PRESS, /**< */ JACK_PROP_HDMI_ONLINE, /**< Digital tvout */ + JACK_PROP_USB_ONLINE, /**< USB connection */ JACK_PROP_CRADLE_ONLINE, /**< Cradle connection */ - JACK_PROP_USB_PATH, /**< */ - JACK_PROP_EARKEY_PRESS, /**< */ + JACK_PROP_TVOUT_ONLINE, /**< analog tvout */ + JACK_PROP_MIC_ONLINE = -1, + JACK_PROP_USB_PATH = -1, }; /** @@ -140,11 +148,8 @@ extern "C" { */ enum { TCKEY_PROP_FIRST, - /**< */ TCKEY_PROP_SECOND, - /**< */ TCKEY_PROP_THIRD, - /**< */ }; /** @@ -168,56 +173,12 @@ extern "C" { * Motor property for generic APIs */ enum { - HAPTIC_PROP_ENABLE, - HAPTIC_PROP_LEVEL, HAPTIC_PROP_LEVEL_MAX, + HAPTIC_PROP_LEVEL, + HAPTIC_PROP_ENABLE, HAPTIC_PROP_ONESHOT, }; -/** - * @fn int device_get_property(devtype_t 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(DEVTYPE_POWERSUPPLY, POWER_SUPPLY_PROP_CAPACITY, &val) < 0 ) - * printf("Fail to get property\n"); - * else - * printf("Property is %d\n", val); - * ... - * @endcode - */ - int device_get_property(devtype_t devtype, int property, int *value); - -/** - * @fn int device_set_property(devtype_t 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(DEVTYPE_DISPLAY0, DISPLAY_PROP_BRIGHTNESS, val) < 0 ) - * printf("Fail to set property\n"); - * else - * printf("Property is set %d\n", val); - * ... - * @endcode - */ - int device_set_property(devtype_t devtype, int property, int value); - /* Application level interfaces */ /** @@ -571,6 +532,196 @@ extern "C" { /** * @par Description: + * mode - dynamic, standard, natural, movie + */ + enum image_enhance_mode { + MODE_DYNAMIC = 0, + MODE_STANDARD, + MODE_NATURAL, + MODE_MOVIE, + }; + +/** + * @par Description: + * This API is used to get image enhance mode.\n + * It returns enum value which is the current mode on success.\n + * Or a negative value(-1) is returned on failure. + * @return enum value for current mode on success, -1 if failed + * @par Example + * @code + * ... + * ret = device_get_image_enhance_mode(); + * if( ret < 0 ) + * printf("Fail to get current image enhance mode\n"); + * ... + * @endcode + */ + int device_get_image_enhance_mode(void); + +/** + * @par Description: + * This API is used to set image enhance mode.\n + * @param[in] val mode enum vlaue + * @return 0 on success, -1 if failed + * @par Example + * @code + * ... + * if( device_set_image_enhance_mode(MODE_DYNAMIC) < 0 ) + * printf("Fail to set the image enhance mode\n"); + * ... + * @endcode + */ + int device_set_image_enhance_mode(int val); + +/** + * @par Description: + * scenario - ui, gallery, video, vtcall, camera, browser, negative, bypass + */ + enum image_enhance_scenario { + SCENARIO_UI = 0, + SCENARIO_GALLERY, + SCENARIO_VIDEO, + SCENARIO_VTCALL, + SCENARIO_CAMERA, + SCENARIO_BROWSER, + SCENARIO_NEGATIVE, + SCENARIO_BYPASS, + }; + +/** + * @par Description: + * This API is used to get image enhance scenario.\n + * It returns enum value which is the current scenario on success.\n + * Or a negative value(-1) is returned on failure. + * @return enum value for current wcenario on success, -1 if failed + * @par Example + * @code + * ... + * ret = device_get_image_enhance_scenario(); + * if( ret < 0 ) + * printf("Fail to get current image enhance scenarioe\n"); + * ... + * @endcode + */ + int device_get_image_enhance_scenario(void); + +/** + * @par Description: + * This API is used to set image enhance scenario.\n + * @param[in] val scenario enum vlaue + * @return 0 on success, -1 if failed + * @par Example + * @code + * ... + * if( device_set_image_enhance_scenario(SCENARIO_UI) < 0 ) + * printf("Fail to set the image enhance scenario\n"); + * ... + * @endcode + */ + int device_set_image_enhance_scenario(int val); + +/** + * @par Description: + * tone - normal, warm, cold + */ + enum image_enhance_tone { + TONE_NORMAL = 0, + TONE_WARM, + TONE_COLD, + }; + +/** + * @par Description: + * This API is used to get image enhance tone.\n + * It returns enum value which is the current mode on success.\n + * Or a negative value(-1) is returned on failure. + * @return enum value for current tone on success, -1 if failed + * @par Example + * @code + * ... + * ret = device_get_image_enhance_tone(); + * if( ret < 0 ) + * printf("Fail to get current image enhance tone\n"); + * ... + * @endcode + */ + int device_get_image_enhance_tone(void); + +/** + * @par Description: + * This API is used to set image enhance tone.\n + * @param[in] val tone vlaue + * @return 0 on success, -1 if failed + * @par Example + * @code + * ... + * if( device_set_image_enhance_tone(TONE_NORMAL) < 0 ) + * printf("Fail to set the image enhance tone\n"); + * ... + * @endcode + */ + int device_set_image_enhance_tone(int val); + +/** + * @par Description: + * outdoor - off, on + */ + enum image_enhance_outdoor { + OUTDOOR_OFF = 0, + OUTDOOR_ON, + }; + +/** + * @par Description: + * This API is used to get image enhance outdoor.\n + * It returns enum value which is the current outdoor on success.\n + * Or a negative value(-1) is returned on failure. + * @return enum value for current outdoor on success, -1 if failed + * @par Example + * @code + * ... + * ret = device_get_image_enhance_ourdoor(); + * if( ret < 0 ) + * printf("Fail to get current image enhance outdoor\n"); + * ... + * @endcode + */ + int device_get_image_enhance_outdoor(void); + +/** + * @par Description: + * This API is used to set image enhance outdoor.\n + * @param[in] val outdoor vlaue + * @return 0 on success, -1 if failed + * @par Example + * @code + * ... + * if( device_set_image_enhance_outdoor(TONE_NORMAL) < 0 ) + * printf("Fail to set the image enhance outdoor\n"); + * ... + * @endcode + */ + int device_set_image_enhance_outdoor(int val); + +/** + * @par Description: + * This API is used to get information about image enhance function.\n + * It returns 1, this device can use enhance mode.\n + * Or a negative value(-1) is returned, it doesn't support enhance mode. + * @return 1 is returned on support for enhance mode, -1 if not. + * @par Example + * @code + * ... + * ret = device_get_image_enhance_info(); + * if( ret < 0 ) + * printf("Not support image enhance mode on this device\n"); + * ... + * @endcode + */ + int device_get_image_enhance_info(void); + +/** + * @par Description: * This API is used to get the current brightness of the led.\n * It gets the current brightness of the led by calling device_get_property() function.\n * It returns integer value which is the current brightness on success.\n @@ -609,6 +760,22 @@ extern "C" { /** * @par Description: + * This API is used to set the current brightness of the led without noti.\n + * It sets the current brightness of the led by calling device_set_property() function.\n + * @param[in] val brightness value that you want to set + * @return 0 on success, -1 if failed + * @see device_get_led_brt() + * @par Example + * @code + * ... + * if( device_set_led_brt_without_noti(1) < 0 ) + * printf("Fail to set the brightness of the led\n"); + * @endcode + */ + int device_set_led_brt_without_noti(int val); + +/** + * @par Description: * This API is used to get the max brightness of the led.\n * It gets the current brightness of the led by calling device_get_property() function.\n * It returns integer value which is the max brightness on success.\n diff --git a/include/devman_error.h b/include/devman_error.h deleted file mode 100644 index 4ee58cf..0000000 --- a/include/devman_error.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * devman - * 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_ERROR_H__ -#define __DEVMAN_ERROR_H__ - -#ifndef DEPRECATED -#define DEPRECATED __attribute__((deprecated)) -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @file devman_error.h - * @ingroup DEVICE_MANAGER - * @brief This file contains error state for devman - * @author SLP2.0 - * @date 2012-08-10 - * @version 0.1 - */ - -/** - * @addtogroup DEVICE_MANAGER - * @{ - */ - -/** - * @brief Enumerations of error code for Devman - */ -typedef enum -{ - DEVMAN_ERROR_NONE = 0, /**< Successful */ - DEVMAN_ERROR_OPERATION_FAILED = -1, /**< Operation failed */ - DEVMAN_ERROR_NOT_SUPPORTED = -2, /**< Not supported in this device */ -} devman_error_e; - -/** - * @} // end of internal APIs - */ - -#ifdef __cplusplus -} -#endif -#endif diff --git a/include/devman_haptic.h b/include/devman_haptic.h index 2b3df7e..d8b05c1 100644 --- a/include/devman_haptic.h +++ b/include/devman_haptic.h @@ -143,7 +143,7 @@ extern "C" { * @endcode */ - int device_haptic_open(haptic_dev_idx dev_idx, unsigned int mode); + int device_haptic_open(haptic_dev_idx dev_idx, unsigned int mode) __attribute__ ((deprecated)); /** * @fn int device_haptic_close(int dev_handle) @@ -167,7 +167,7 @@ extern "C" { * @endcode */ - int device_haptic_close(int dev_handle); + int device_haptic_close(int dev_handle) __attribute__ ((deprecated)); /** * @fn int device_haptic_play_pattern(int dev_handle, int pattern , int iteration , int feedback_level ) @@ -201,7 +201,7 @@ extern "C" { */ int device_haptic_play_pattern(int dev_handle, int pattern, - int iteration, int feedback_level); + int iteration, int feedback_level) __attribute__ ((deprecated)); /** * @fn int device_haptic_play_file(int dev_handle, const char *file_name , int iteration , int feedback_level ) @@ -236,7 +236,7 @@ extern "C" { */ int device_haptic_play_file(int dev_handle, const char *file_name, - int iteration, int feedback_level); + int iteration, int feedback_level) __attribute__ ((deprecated)); /** * @fn int device_haptic_play_file_with_priority(int device_handle, const char *file_name, int priority_level, int iteration, int feedback_level) @@ -275,7 +275,7 @@ extern "C" { */ int device_haptic_play_file_with_priority(int device_handle, const char *file_name, - int priority, int iteration, int feedback_level); + int priority, int iteration, int feedback_level) __attribute__ ((deprecated)); /** * @fn int device_haptic_play_buffer(int dev_handle, const unsigned char *vibe_buffer, int iteration , int feedback_level ) @@ -309,7 +309,7 @@ extern "C" { */ int device_haptic_play_buffer(int dev_handle, const unsigned char *vibe_buffer, - int iteration, int feedback_level); + int iteration, int feedback_level) __attribute__ ((deprecated)); /** * @fn int device_haptic_play_monotone(int dev_handle, int duration) @@ -336,7 +336,7 @@ extern "C" { * @endcode */ - int device_haptic_play_monotone(int dev_handle, int duration); + int device_haptic_play_monotone(int dev_handle, int duration) __attribute__ ((deprecated)); /** * @fn int device_haptic_play_monotone_with_feedback_level(int dev_handle, int duration, int feedback_level) @@ -368,7 +368,7 @@ extern "C" { * @endcode */ - int device_haptic_play_monotone_with_feedback_level(int dev_handle, int duration, int feedback_level); + int device_haptic_play_monotone_with_feedback_level(int dev_handle, int duration, int feedback_level) __attribute__ ((deprecated)); /** * @fn int device_haptic_play_monotone_with_detail_feedback_level(int dev_handle, int duration, int detail_feedback_level) @@ -398,7 +398,7 @@ extern "C" { * @endcode */ - int device_haptic_play_monotone_with_detail_feedback_level(int dev_handle, int duration, int detail_feedback_level); + int device_haptic_play_monotone_with_detail_feedback_level(int dev_handle, int duration, int detail_feedback_level) __attribute__ ((deprecated)); /** * @fn int device_haptic_stop_play(int dev_handle) @@ -440,7 +440,7 @@ extern "C" { */ int device_haptic_get_buffer_duration(int dev_handle, const unsigned char *vibe_buffer, - int *duration); + int *duration) __attribute__ ((deprecated)); /** * @fn int device_haptic_get_pattern_duration(int dev_handle, int pattern , int* duration) @@ -461,7 +461,7 @@ extern "C" { */ int device_haptic_get_pattern_duration(int dev_handle, int pattern, - int *duration); + int *duration) __attribute__ ((deprecated)); /** * @fn int device_haptic_get_file_duration(int dev_handle, const char *file_name , int* duration) @@ -482,7 +482,7 @@ extern "C" { int device_haptic_get_file_duration(int dev_handle, const char *file_name, - int *duration); + int *duration) __attribute__ ((deprecated)); /** * @fn int device_haptic_get_device_count(void) @@ -492,7 +492,7 @@ extern "C" { * On success it returns a number of devices. In case of failure it returns a negative value. \n * @return if it succeed, it return number of devices, otherwise negative value return */ - int device_haptic_get_device_count(void); + int device_haptic_get_device_count(void) __attribute__ ((deprecated)); /** * @fn int device_haptic_convert_to_binary(const char *haptic_name) @@ -504,7 +504,7 @@ extern "C" { * On success it returns 0. In case of failure it returns a negative value.\n * @return if it succeed, it return 0, otherwise negative value return */ - int device_haptic_convert_to_binary(const char *haptic_name); + int device_haptic_convert_to_binary(const char *haptic_name) __attribute__ ((deprecated)); /** * @} diff --git a/include/devman_image.h b/include/devman_image.h index 5d34870..f964450 100644 --- a/include/devman_image.h +++ b/include/devman_image.h @@ -19,223 +19,18 @@ #ifndef __DEVMAN_IMAGE_H__ #define __DEVMAN_IMAGE_H__ -#ifndef DEPRECATED -#define DEPRECATED __attribute__((deprecated)) -#endif - -#ifdef __cplusplus -extern "C" { -#endif - /** * @file devman_image.h - * @ingroup DEVICE_MANAGER - * @brief This file contains the prototypes of API to control image enhance mode - * @author SLP2.0 + * @defgroup devman_image Definitions of managed api set + * @ingroup DEVICE_MANAGER_MANAGED + * @brief This file contains the definitions of managed API for devices + * @details define functions that control enhance mode and haptic device + * @author Tizen2.0 * @date 2010-06-26 * @version 0.1 */ -/** - * @addtogroup DEVICE_MANAGER - * @{ - */ - -/** - * @par Description: - * mode - dynamic, standard, natural, movie - */ - enum image_enhance_mode { - MODE_DYNAMIC = 0, - MODE_STANDARD, - MODE_NATURAL, - MODE_MOVIE, - }; - -/** - * @par Description: - * This API is used to get image enhance mode.\n - * It returns enum value which is the current mode on success.\n - * Or a negative value(-1) is returned on failure. - * @return enum value for current mode on success, -1 if failed - * @par Example - * @code - * ... - * ret = device_get_image_enhance_mode(); - * if( ret < 0 ) - * printf("Fail to get current image enhance mode\n"); - * ... - * @endcode - */ - int device_get_image_enhance_mode(void); - -/** - * @par Description: - * This API is used to set image enhance mode.\n - * @param[in] val mode enum vlaue - * @return 0 on success, -1 if failed - * @par Example - * @code - * ... - * if( device_set_image_enhance_mode(MODE_DYNAMIC) < 0 ) - * printf("Fail to set the image enhance mode\n"); - * ... - * @endcode - */ - int device_set_image_enhance_mode(int val); - -/** - * @par Description: - * scenario - ui, gallery, video, vtcall, camera, browser, negative, bypass - */ - enum image_enhance_scenario { - SCENARIO_UI = 0, - SCENARIO_GALLERY, - SCENARIO_VIDEO, - SCENARIO_VTCALL, - SCENARIO_CAMERA, - SCENARIO_BROWSER, - SCENARIO_NEGATIVE, - SCENARIO_BYPASS, - }; - -/** - * @par Description: - * This API is used to get image enhance scenario.\n - * It returns enum value which is the current scenario on success.\n - * Or a negative value(-1) is returned on failure. - * @return enum value for current wcenario on success, -1 if failed - * @par Example - * @code - * ... - * ret = device_get_image_enhance_scenario(); - * if( ret < 0 ) - * printf("Fail to get current image enhance scenarioe\n"); - * ... - * @endcode - */ - int device_get_image_enhance_scenario(void); - -/** - * @par Description: - * This API is used to set image enhance scenario.\n - * @param[in] val scenario enum vlaue - * @return 0 on success, -1 if failed - * @par Example - * @code - * ... - * if( device_set_image_enhance_scenario(SCENARIO_UI) < 0 ) - * printf("Fail to set the image enhance scenario\n"); - * ... - * @endcode - */ - int device_set_image_enhance_scenario(int val); - -/** - * @par Description: - * tone - normal, warm, cold - */ - enum image_enhance_tone { - TONE_NORMAL = 0, - TONE_WARM, - TONE_COLD, - }; - -/** - * @par Description: - * This API is used to get image enhance tone.\n - * It returns enum value which is the current mode on success.\n - * Or a negative value(-1) is returned on failure. - * @return enum value for current tone on success, -1 if failed - * @par Example - * @code - * ... - * ret = device_get_image_enhance_tone(); - * if( ret < 0 ) - * printf("Fail to get current image enhance tone\n"); - * ... - * @endcode - */ - int device_get_image_enhance_tone(void); - -/** - * @par Description: - * This API is used to set image enhance tone.\n - * @param[in] val tone vlaue - * @return 0 on success, -1 if failed - * @par Example - * @code - * ... - * if( device_set_image_enhance_tone(TONE_NORMAL) < 0 ) - * printf("Fail to set the image enhance tone\n"); - * ... - * @endcode - */ - int device_set_image_enhance_tone(int val); - -/** - * @par Description: - * outdoor - off, on - */ - enum image_enhance_outdoor { - OUTDOOR_OFF = 0, - OUTDOOR_ON, - }; - -/** - * @par Description: - * This API is used to get image enhance outdoor.\n - * It returns enum value which is the current outdoor on success.\n - * Or a negative value(-1) is returned on failure. - * @return enum value for current outdoor on success, -1 if failed - * @par Example - * @code - * ... - * ret = device_get_image_enhance_ourdoor(); - * if( ret < 0 ) - * printf("Fail to get current image enhance outdoor\n"); - * ... - * @endcode - */ - int device_get_image_enhance_outdoor(void); - -/** - * @par Description: - * This API is used to set image enhance outdoor.\n - * @param[in] val outdoor vlaue - * @return 0 on success, -1 if failed - * @par Example - * @code - * ... - * if( device_set_image_enhance_outdoor(TONE_NORMAL) < 0 ) - * printf("Fail to set the image enhance outdoor\n"); - * ... - * @endcode - */ - int device_set_image_enhance_outdoor(int val); - -/** - * @par Description: - * This API is used to get information about image enhance function.\n - * It returns 1, this device can use enhance mode.\n - * Or a negative value(-1) is returned, it doesn't support enhance mode. - * @return 1 is returned on support for enhance mode, -1 if not. - * @par Example - * @code - * ... - * ret = device_get_image_enhance_info(); - * if( ret < 0 ) - * printf("Not support image enhance mode on this device\n"); - * ... - * @endcode - */ - int device_get_image_enhance_info(void); - -/** - * @} // end of image enhance APIs - */ +// This file will be deprecated +#include "devman.h" -#ifdef __cplusplus -} -#endif -#endif +#endif /* __DEVMAN_IMAGE_H__ */ diff --git a/include/devman_managed.h b/include/devman_managed.h index 99af69c..3fd9cab 100644 --- a/include/devman_managed.h +++ b/include/devman_managed.h @@ -21,18 +21,16 @@ /** * @file devman_managed.h - * @defgroup devman_managed Definitions of managed api set + * @defgroup devman_managed Definitions of managed api set * @ingroup DEVICE_MANAGER_MANAGED - * @author Jiyoung Yun (jy910.yun@samsung.com) * @brief This file contains the definitions of managed API for devices - * @details define functions that control enhance mode and haptic device - * @author SLP2.0 + * @details define functions that control enhance mode and haptic device + * @author Tizen2.0 * @date 2010-06-26 * @version 0.1 */ -#include "devman_error.h" -#include "devman_image.h" -#include "devman_haptic.h" +// This file will be deprecated +#include "devman.h" #endif /* __DEVMAN_MANAGED_H__ */ diff --git a/include/devman_plugin_intf.h b/include/devman_plugin_intf.h deleted file mode 100644 index d5bb649..0000000 --- a/include/devman_plugin_intf.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * devman - * 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/devman.spec b/packaging/devman.spec index e3346e2..f08788f 100644 --- a/packaging/devman.spec +++ b/packaging/devman.spec @@ -1,8 +1,8 @@ #sbs-git:slp/pkgs/d/devman devman 0.1.6 5bf2e95e0bb15c43ff928f7375e1978b0accb0f8 Name: devman Summary: Device manager library -Version: 0.1.9 -Release: 8 +Version: 0.1.10 +Release: 0 Group: System/Libraries License: Apache License, Version 2.0 Source0: %{name}-%{version}.tar.gz @@ -14,6 +14,7 @@ BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(heynoti) BuildRequires: pkgconfig(haptic) +BuildRequires: pkgconfig(device-node) %description Device manager library for device control @@ -42,36 +43,24 @@ Requires: libdevman-devel = %{version}-%{release} %description -n libdevman-haptic-devel Haptic Device manager library for device control (devel) -%package -n libdevman-plugin-devel -Summary: Device manager plugin library for (devel) -Group: Development/Libraries - -%description -n libdevman-plugin-devel -Device manager plugin library for device control (devel) - %prep %setup -q %build cp %{SOURCE1} . -CFLAGS="$CFLAGS" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_DEVMAN_RSRC_PREFIX=share/devman -DCMAKE_DATADIR=/opt - +%cmake . make %{?jobs:-j%jobs} %install rm -rf %{buildroot} %make_install -mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc3.d -mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc4.d - %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files -n libdevman %manifest devman.manifest -%{_sysconfdir}/rc.d/init.d/devman %{_bindir}/display_wd %{_libdir}/libdevman.so.* @@ -79,9 +68,7 @@ mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc4.d %{_includedir}/devman/devman.h %{_includedir}/devman/devman_managed.h %{_includedir}/devman/devman_image.h -%{_includedir}/devman/devman_error.h %{_includedir}/devman/devman_haptic.h -%{_includedir}/devman/SLP_devman_PG.h %{_libdir}/pkgconfig/devman.pc %{_libdir}/libdevman.so @@ -89,7 +76,3 @@ mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc4.d %{_includedir}/devman/devman_haptic_ext.h %{_includedir}/devman/devman_haptic_ext_core.h %{_libdir}/pkgconfig/devman_haptic.pc - -%files -n libdevman-plugin-devel -%{_includedir}/devman/devman_plugin_intf.h -%{_libdir}/pkgconfig/devman_plugin.pc diff --git a/src/device_convert.c b/src/device_convert.c deleted file mode 100644 index 2df479d..0000000 --- a/src/device_convert.c +++ /dev/null @@ -1,549 +0,0 @@ -/* - * devman - * 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 <stdlib.h> -#include <string.h> -#include <dirent.h> -#include <sys/stat.h> -#include <unistd.h> - -#include "devlog.h" -#include <devman_haptic.h> -#include <devman_haptic_ext.h> -#include <devman_haptic_ext_core.h> - -#ifndef EXTAPI -#define EXTAPI __attribute__ ((visibility("default"))) -#endif /* EXTAPI */ - -#ifdef PERFORM_CHECK -static long long ms = 0; - -#define MICROSECONDS(tv) ((tv.tv_sec * 1000000ll) + tv.tv_usec) - -#define ESTIMATE_PERFORMANCE() \ - do { \ - struct timeval tv; \ - if (ms == 0) { \ - gettimeofday(&tv, NULL); \ - ms = MICROSECONDS(tv); \ - fDBG(stderr, "%s start time : %lld\n", __func__, ms); \ - } else { \ - gettimeofday(&tv, NULL); \ - fDBG(stderr, "%s elapsed time : %lld\n", __func__, MICROSECONDS(tv) - ms); \ - ms = 0; \ - } \ - } while(0) -#else -#define ESTIMATE_PERFORMANCE() -#endif - -#define MAX_FILE_PATH 256 /* Maximum file path length */ -#define SAMPLE_INTERVAL 10.0 /* Sample calculation interval in milliseconds */ -#define IVT_BUFFER_SIZE 4096 /* IVT buffer size */ -#define BASE 5 -#define FOLDER_MASK 664 - -typedef enum { - WAVETYPE_SQUARE = 1, - WAVETYPE_TRIANGLE, - WAVETYPE_SINE, - WAVETYPE_SAWTOOTHUP, - WAVETYPE_SAWTOOTHDOWN -} effect_wave_type; - -/* This functions loads the IVT file into memory */ -static unsigned char *_load_ivt_file(const char *filepath) -{ - FILE *pFile; - long cbyFileSize; - unsigned char *p_ivt_data = NULL; - /* open the IVT file */ - /* IMPORTANT: open the IVT file as a binary file to avoid translation */ - pFile = fopen(filepath, "rb"); - if (!pFile) - { - /* handle error, application-specific */ - return p_ivt_data; - } - /* determine the file size */ - /* fseek returns zero on success, non-zero on failure */ - if (fseek(pFile, 0, SEEK_END)) - { - /* handle error, application-specific */ - fclose(pFile); - return p_ivt_data; - } - cbyFileSize = ftell(pFile); - if (fseek(pFile, 0, SEEK_SET)) - { - /* handle error, application-specific */ - fclose(pFile); - return p_ivt_data; - } - /* allocate a buffer for the IVT data */ - p_ivt_data = (unsigned char *)malloc(cbyFileSize); - if (!p_ivt_data) - { - /* handle error, application-specific */ - fclose(pFile); - return p_ivt_data; - } - /* read the IVT data from the IVT file */ - if (fread(p_ivt_data, 1, cbyFileSize, pFile) != cbyFileSize) - { - /* handle error, application-specific */ - free(p_ivt_data); - p_ivt_data = 0; - fclose(pFile); - return p_ivt_data; - } - /* close the IVT file */ - if (0 != fclose(pFile)) - { - /* handle error, application-specific */ - return p_ivt_data; - } - /* you can now play effects from the IVT data that was loaded into g_pIVTData */ - return p_ivt_data; -} - -/* converts effect type to string*/ -static char *_convert_effect_type_to_string(int effect_type) -{ - switch (effect_type) { - case HAPTIC_EFFECT_TYPE_PERIODIC: - return "HAPTIC_EFFECT_TYPE_PERIODIC"; - case HAPTIC_EFFECT_TYPE_MAGSWEEP: - return "HAPTIC_EFFECT_TYPE_MAGSWEEP"; - case HAPTIC_EFFECT_TYPE_TIMELINE: - return "HAPTIC_EFFECT_TYPE_TIMELINE"; - case HAPTIC_EFFECT_TYPE_STREAMING: - return "HAPTIC_EFFECT_TYPE_STREAMING"; - case HAPTIC_EFFECT_TYPE_WAVEFORM: - return "HAPTIC_EFFECT_TYPE_WAVEFORM"; - } - return NULL; -} - -/*This functions gets Periodic effect details using devman API*/ -static int _get_periodic_effect_details(const unsigned char *pivt_data, int index, HapticPeriodic *periodic_effect) -{ - int result = -1; - result = device_haptic_get_periodic_effect_definition(pivt_data, index, - &periodic_effect->duration, &periodic_effect->magnitude, - &periodic_effect->period, &periodic_effect->style, - &periodic_effect->attacktime, &periodic_effect->attacklevel, - &periodic_effect->fadetime, &periodic_effect->fadelevel); - if (result == 0) { - DBG("device_haptic_get_periodic_effect_definition() Success"); - DBG("Duration : %d", periodic_effect->duration); - DBG("Magnitude : %d", periodic_effect->magnitude); - DBG("Period : %d", periodic_effect->period); - DBG("Style & Wave Type : %d", periodic_effect->style); - DBG("Attacktime : %d", periodic_effect->attacktime); - DBG("Attacklevel : %d", periodic_effect->attacklevel); - DBG("Fadetime : %d", periodic_effect->fadetime); - DBG("Fadelevel : %d", periodic_effect->fadelevel); - } else { - DBG("device_haptic_get_periodic_effect_definition() failed. Reason:%d", result); - } - return result; -} - -/*This functions gets MagSweep effect details using devman API*/ -static int _get_magsweep_effect_details(const unsigned char *p_ivt_data, int index, HapticMagSweep *magsweep_effect) -{ - int result = -1; - result = device_haptic_get_magsweep_effect_definition(p_ivt_data, index, - &magsweep_effect->duration, &magsweep_effect->magnitude, - &magsweep_effect->style, - &magsweep_effect->attacktime, &magsweep_effect->attacklevel, - &magsweep_effect->fadetime, &magsweep_effect->fadelevel); - if (result == 0) { - DBG("device_haptic_get_magsweep_effect_definition() Success"); - DBG("Duration : %d", magsweep_effect->duration); - DBG("Magnitude : %d", magsweep_effect->magnitude); - DBG("Style : %d", magsweep_effect->style); - DBG("Attacktime : %d", magsweep_effect->attacktime); - DBG("Attacklevel : %d", magsweep_effect->attacklevel); - DBG("Fadetime : %d", magsweep_effect->fadetime); - DBG("Fadelevel : %d", magsweep_effect->fadelevel); - } else { - DBG("device_haptic_get_magsweep_effect_definition() failed. Reason:%d", result); - } - return result; -} - -/*This functions gets Timeline effect details using devman API*/ -static int _get_timeline_effect_details(const unsigned char *p_ivt_data, int index, HapticElement *timeline_effect) -{ - unsigned char ivt_buffer[IVT_BUFFER_SIZE+1] = {0,}; - int result = -1; - - result = device_haptic_initialize_buffer(ivt_buffer, sizeof(ivt_buffer)); - if (result ==0) { - result = device_haptic_read_element(ivt_buffer, IVT_BUFFER_SIZE, 0, 0, timeline_effect); - if (result == 0) { - DBG("Element type:%d", timeline_effect->elementtype); - } else { - DBG("device_haptic_read_element() failed. Reason :%d", result); - } - } else { - DBG("device_haptic_initialize_buffer() failed. Reason:%d", result); - } - return result; -} - -/* This function parses the Periodic effect received and generates - * corresponding LED pattern for it */ -static char *_parse_periodic_effect_and_generate_led_pattern(HapticPeriodic periodic, int *buffer_size) -{ - char *led_pattern = NULL; - int unit = periodic.magnitude/10; - int i = 0; - int sample_index = 0; - int value = 0; - int style = 0; - int wave_type = 0; - int mid = periodic.period/2; - int j = 0; - int step = 0; - int delta = 0; - int base = BASE*unit; - char const_value ='0'; - - led_pattern = (char*)calloc(((periodic.duration/SAMPLE_INTERVAL)+1), sizeof(char)); - if (led_pattern == NULL) { - DBG("Memory allocation failure"); - return NULL; - } - - if (periodic.magnitude >0) - const_value = '1'; - - if (periodic.attacktime == 0 && periodic.attacklevel == 0 - && periodic.fadetime == 0 && periodic.fadelevel == 0) { - DBG("Periodic effect"); - - if (periodic.style <=0) { - DBG("Unknown periodic effect"); - free(led_pattern); - return NULL; - } else { - /* Extract Style and wave type*/ - DBG("Style and wave type: %d", periodic.style); - style = periodic.style && HAPTIC_STYLE_SUPPORT_MASK; - wave_type = periodic.style && HAPTIC_WAVETYPE_SUPPORT_MASK; - DBG("Style : %d", style); - DBG("Wave type : %d", wave_type); - - /* Generate pattern based on Wave type. Ignore Style*/ - switch (wave_type) { - case WAVETYPE_SQUARE: - case WAVETYPE_SAWTOOTHDOWN: - { - for (i = 0; i<periodic.duration; i =i+periodic.period) { - for (j =SAMPLE_INTERVAL; j<=periodic.period; j = j+SAMPLE_INTERVAL) { - if (j <= mid) - led_pattern[sample_index++] = '1'; - else - led_pattern[sample_index++] = '0'; - } - } - break; - } - case WAVETYPE_TRIANGLE: - case WAVETYPE_SINE: - { - step = periodic.magnitude/mid; - delta = step * SAMPLE_INTERVAL; - for (i = 0; i<periodic.duration; i =i+periodic.period) { - value = 0; - for (j =SAMPLE_INTERVAL; j<=periodic.period; j = j+SAMPLE_INTERVAL) { - if (j <= mid) - value = value + delta; - else - value = value - delta; - if (value>= base) - led_pattern[sample_index++] = '1'; - else - led_pattern[sample_index++] = '0'; - } - } - break; - } - case WAVETYPE_SAWTOOTHUP: - { - for (i = 0; i<periodic.duration; i =i+periodic.period) { - for (j =SAMPLE_INTERVAL; j<=periodic.period; j = j+SAMPLE_INTERVAL) { - if (j > mid) - led_pattern[sample_index++] = '1'; - else - led_pattern[sample_index++] = '0'; - } - } - break; - } - default: DBG("Unknown wave type\n"); - break; - } - } - } else { - /*TODO*/ - /* handling periodic effect if attacktime and fade time less than period*/ - /* Need to keep repeating the pattern with attack and fade effectes within period till duration is reached*/ - if (periodic.attacktime>periodic.period || periodic.fadetime>periodic.period) { - if (periodic.attacktime >0) { - DBG("Attack time present\n"); - - if (periodic.attacklevel >periodic.magnitude) { /* Decrementing effect */ - step = (periodic.attacklevel - periodic.magnitude)/periodic.attacktime; - } else if (periodic.attacklevel <periodic.magnitude) { /* Incrementing effect */ - step = ( periodic.magnitude - periodic.attacklevel)/periodic.attacktime; - } - delta = step * SAMPLE_INTERVAL; - - for (i=SAMPLE_INTERVAL; i<= periodic.attacktime; i = i+SAMPLE_INTERVAL) { - value = value+delta; - if (value>base) - led_pattern[sample_index++] = '1'; - else - led_pattern[sample_index++] = '0'; - } - } - - for (i = periodic.attacktime+SAMPLE_INTERVAL; i<= (periodic.duration-periodic.fadetime); i = i+ SAMPLE_INTERVAL) { - led_pattern[sample_index++] = const_value; - } - if (periodic.fadetime >0) { - step = (periodic.magnitude - periodic.fadelevel)/periodic.fadetime; - delta = step* SAMPLE_INTERVAL; - value = periodic.magnitude; - for (i = (periodic.duration-periodic.fadetime+SAMPLE_INTERVAL); i<= periodic.duration; i = i+ SAMPLE_INTERVAL) { - value = value - delta; - if (value>base) - led_pattern[sample_index++] = '1'; - else - led_pattern[sample_index++] = '0'; - } - } - } - } - /*To mark end of effect*/ - led_pattern[sample_index++] = '0'; - *buffer_size = sample_index; - DBG("LED Pattern for Periodic effect: %s", led_pattern); - return led_pattern; -} - -/* This function parses the MagSweep effect received and generates - * corresponding LED pattern for it */ -static char *_parse_magsweep_effect_and_generate_led_pattern(HapticMagSweep mag_sweep, int *buffer_size) -{ - int unit = mag_sweep.magnitude/10; - int i =0; - int sample_index = 0; - int step = 0; - int delta = 0; - int value =0; - int base = BASE*unit; - char const_value ='0'; - char *led_pattern = NULL; - - led_pattern = (char*)calloc(((mag_sweep.duration/SAMPLE_INTERVAL)+1), sizeof(char)); - if (led_pattern == NULL) { - DBG("Memory allocation failure"); - return NULL; - } - - if (mag_sweep.magnitude >0) - const_value = '1'; - - if (mag_sweep.attacktime == 0 && mag_sweep.attacklevel == 0 - && mag_sweep.fadetime == 0 && mag_sweep.fadelevel == 0) { - /* Constant effect with maximum magnitude*/ - DBG("Constant effect"); - - for (i = 0; i<=mag_sweep.duration; i=i+SAMPLE_INTERVAL) { - led_pattern[sample_index++] = const_value; - } - } else { - DBG("Varying effect"); - /* Handling Attack effect*/ - if (mag_sweep.attacktime >0) { - DBG("Attack time present"); - - if (mag_sweep.attacklevel >mag_sweep.magnitude) { /* Decrementing effect */ - step = (mag_sweep.attacklevel - mag_sweep.magnitude)/mag_sweep.attacktime; - } else if (mag_sweep.attacklevel <mag_sweep.magnitude) { /* Incrementing effect */ - step = ( mag_sweep.magnitude - mag_sweep.attacklevel)/mag_sweep.attacktime; - } - delta = step * SAMPLE_INTERVAL; - - for (i=SAMPLE_INTERVAL; i<= mag_sweep.attacktime; i = i+SAMPLE_INTERVAL) { - value = value+delta; - if (value>base) - led_pattern[sample_index++] = '1'; - else - led_pattern[sample_index++] = '0'; - } - } - /* For Handling constant effect between attacktime and fade time*/ - for (i = mag_sweep.attacktime+SAMPLE_INTERVAL; i<= (mag_sweep.duration-mag_sweep.fadetime); i = i+ SAMPLE_INTERVAL) { - led_pattern[sample_index++] = const_value; - } - /* Handling fading effect*/ - if (mag_sweep.fadetime >0) { - step = (mag_sweep.magnitude - mag_sweep.fadelevel)/mag_sweep.fadetime; - delta = step* SAMPLE_INTERVAL; - value = mag_sweep.magnitude; - for (i = (mag_sweep.duration-mag_sweep.fadetime+ SAMPLE_INTERVAL); i<= mag_sweep.duration; i = i+ SAMPLE_INTERVAL) { - value = value - delta; - if (value>base) - led_pattern[sample_index++] = '1'; - else - led_pattern[sample_index++] = '0'; - } - } - - } - /*To mark end of effect*/ - led_pattern[sample_index++] = '0'; - *buffer_size = sample_index; - DBG("Appending 0 at the end"); - DBG("LED Pattern for MagSweep effect: %s", led_pattern); - return led_pattern; -} - -static int _write_pattern_to_file(const char *binary_path, char *pled_dat, int buf_size, int *opened_flag) -{ - FILE *ptr_myfile = NULL; - - DBG("LED file name:%s", binary_path); - /* Open file for the FIRST time */ - if (*opened_flag) { - ptr_myfile = fopen(binary_path, "wb+"); - if (!ptr_myfile) { - DBG("Unable to open file!"); - return -1; - } - *opened_flag = 0; - } else { - ptr_myfile = fopen(binary_path, "ab+"); - if (!ptr_myfile) { - DBG("Unable to open file!"); - return -1; - } - } - - DBG("Buffer: %s", pled_dat); - if (fwrite(pled_dat, 1, buf_size, ptr_myfile) <= 0) { - DBG("fwrite() failed"); - } else { - DBG("fwrite() success"); - } - - fclose(ptr_myfile); - return 0; -} - -static int _convert_ivt_to_binary(const char *haptic_path, const char *binary_path) -{ - unsigned char *pivt_dat = NULL; - char *pled_dat = NULL; - int result = -1; - int effect_cnt = -1; - int effect_type = -1; - int effect_duration = -1; - int buf_size = -1; - int opened_flag = 1; // 1 : Not opened, 0 : Opened - HapticPeriodic periodic_effect; - HapticMagSweep magsweep_effect; - HapticElement element; - int i; - - /* Load IVT file into memory */ - pivt_dat = _load_ivt_file(haptic_path); - if (!pivt_dat) { - DBG("Loading IVT failed"); - return -1; - } - - /* Get total number of effects in IVT file */ - effect_cnt = device_haptic_get_effect_count(pivt_dat); - DBG("device_haptic_get_effect_count() Return:%d", effect_cnt); - - /* Parse effects in IVT */ - for (i = 0; i < effect_cnt; i++) { - /* Get effect type*/ - result = device_haptic_get_effect_type(pivt_dat, i, &effect_type); - if (result < 0) { - DBG("EffectNo:%d Getting Effect Type Failed. Reason:%d", (i+1), result); - continue; - } - - DBG("EffectNo:%d EffectType:%s\n", (i+1), _convert_effect_type_to_string(effect_type)); - switch (effect_type) { - case HAPTIC_EFFECT_TYPE_PERIODIC: - memset(&periodic_effect, 0x00, sizeof(HapticPeriodic)); - if (_get_periodic_effect_details(pivt_dat, i, &periodic_effect) == 0) { - /* Parse periodic effect type*/ - pled_dat = _parse_periodic_effect_and_generate_led_pattern(periodic_effect, &buf_size); - if (pled_dat) { - _write_pattern_to_file(binary_path, pled_dat, buf_size, &opened_flag); - free(pled_dat); - } - } - break; - case HAPTIC_EFFECT_TYPE_MAGSWEEP: - memset(&magsweep_effect, 0x00, sizeof(HapticMagSweep)); - if (_get_magsweep_effect_details(pivt_dat, i, &magsweep_effect) == 0) { - /* Parse magsweep effect type*/ - pled_dat = _parse_magsweep_effect_and_generate_led_pattern(magsweep_effect, &buf_size); - if (pled_dat) { - _write_pattern_to_file(binary_path, pled_dat, buf_size, &opened_flag); - free(pled_dat); - } - } - break; - case HAPTIC_EFFECT_TYPE_TIMELINE: - memset(&element, 0x00, sizeof(HapticElement)); - if (_get_timeline_effect_details(pivt_dat, i, &element) > 0) { - device_haptic_get_effect_duration(pivt_dat, i, &effect_duration); - DBG("Timeline effect duration:%d", effect_duration); - } - break; - case HAPTIC_EFFECT_TYPE_STREAMING: - case HAPTIC_EFFECT_TYPE_WAVEFORM: - default: - DBG("Unsupported effect type"); - break; - } - } - - free(pivt_dat); - return 0; -} - -EXTAPI int device_haptic_convert_to_binary(const char *haptic_name) -{ - DBG("this api is not implementation yet"); - return -1; -} diff --git a/src/device_engine.c b/src/device_engine.c deleted file mode 100644 index 23c0704..0000000 --- a/src/device_engine.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * devman - * 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 <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <errno.h> -#include <string.h> -#include <stdlib.h> -#include <dirent.h> -#include <unistd.h> -#include <sys/stat.h> - -#include "device_engine.h" - -#define BUFF_MAX 255 - -struct device *dev_head = NULL; - -void add_dev(struct device *dev) -{ - dev->next = dev_head; - dev_head = dev; -} - -void print_devices() -{ - struct device *dev; - dev = dev_head; - - while (dev) { - DBG("%s - %d", dev->devname, dev->devtype); - dev = dev->next; - } -} - -void reset_devtype() -{ - struct device *dev; - dev = dev_head; - - while (dev) { - dev->devtype = -1; - dev = dev->next; - } -} - -struct device *find_device(struct device *root_dev, devtype_t devtype) -{ - struct device *dev; - - if (devtype == -1) - return NULL; - - if (root_dev == NULL) - dev = dev_head; - else - dev = root_dev; - - while (dev) { - if (dev->devtype == devtype) - return dev; - dev = dev->next; - } - - return NULL; -} - -int set_devtype(char *devname, devtype_t devtype) -{ - int ret; - struct device *dev; - dev = dev_head; - - while (dev) { - if (strstr(dev->devname, devname)) { - if ((strstr(dev->devname, "auto") != NULL) && - (dev->probe != NULL)) { - ret = dev->probe(); - if (ret < 0) { - DBG("auto probe failed"); - return -1; - } - } - - dev->devtype = devtype; - return 0; - } - dev = dev->next; - } - - return -1; -} diff --git a/src/device_haptic.c b/src/device_haptic.c index 69f8be8..90aceb8 100644 --- a/src/device_haptic.c +++ b/src/device_haptic.c @@ -58,13 +58,13 @@ int device_haptic_open(haptic_dev_idx dev_idx, unsigned int mode) int handle = -1; if (!(dev_idx == DEV_IDX_0 || dev_idx == DEV_IDX_1 || dev_idx == DEV_IDX_ALL)) { - ERR("Invalid parameter - dev_idx(%d)", dev_idx); + DEVERR("Invalid parameter - dev_idx(%d)", dev_idx); return HAPTIC_INVALID_ARGUMENT; } ret = haptic_open(dev_idx, &handle); if (ret != HAPTIC_ERROR_NONE) { - ERR("haptic_open fail : %d", ret); + DEVERR("haptic_open fail : %d", ret); return __error_to_devman_haptic_type(ret); } @@ -77,13 +77,13 @@ int device_haptic_close(int device_handle) int ret = -1; if (device_handle < 0) { - ERR("Invalid parameter - device_handle(%d)", device_handle); + DEVERR("Invalid parameter - device_handle(%d)", device_handle); return HAPTIC_INVALID_ARGUMENT; } ret = haptic_close(device_handle); if (ret != HAPTIC_ERROR_NONE) { - ERR("haptic_close fail : %d", ret); + DEVERR("haptic_close fail : %d", ret); return __error_to_devman_haptic_type(ret); } @@ -96,17 +96,17 @@ int device_haptic_play_buffer(int device_handle, const unsigned char *vibe_buffe int ret = -1; if (device_handle < 0) { - ERR("Invalid parameter - device_handle(%d)", device_handle); + DEVERR("Invalid parameter - device_handle(%d)", device_handle); return HAPTIC_INVALID_ARGUMENT; } if (vibe_buffer == NULL || iteration < 0) { - ERR("Invalid parameter - vibe_buffer(NULL) or iteration(%d)", iteration); + DEVERR("Invalid parameter - vibe_buffer(NULL) or iteration(%d)", iteration); return HAPTIC_INVALID_ARGUMENT; } if (feedback_level < HAPTIC_FEEDBACK_LEVEL_AUTO || feedback_level > HAPTIC_FEEDBACK_LEVEL_END-1) { - ERR("feedback_level is wrong : %d", feedback_level); + DEVERR("feedback_level is wrong : %d", feedback_level); return HAPTIC_INVALID_ARGUMENT; } @@ -118,7 +118,7 @@ int device_haptic_play_buffer(int device_handle, const unsigned char *vibe_buffe ret = haptic_vibrate_buffer_with_detail(device_handle, vibe_buffer, iteration, feedback_level, HAPTIC_PRIORITY_MIN, NULL); if (ret != HAPTIC_ERROR_NONE) { - ERR("haptic_vibrate_buffer_with_detail file : %d", ret); + DEVERR("haptic_vibrate_buffer_with_detail file : %d", ret); return __error_to_devman_haptic_type(ret); } @@ -131,17 +131,17 @@ int device_haptic_play_file(int device_handle, const char *file_name, int iterat int ret = -1; if (device_handle < 0) { - ERR("Invalid parameter - device_handle(%d)", device_handle); + DEVERR("Invalid parameter - device_handle(%d)", device_handle); return HAPTIC_INVALID_ARGUMENT; } if (file_name == NULL || iteration < 0) { - ERR("Invalid parameter - file_name(NULL) or iteration(%d)", iteration); + DEVERR("Invalid parameter - file_name(NULL) or iteration(%d)", iteration); return HAPTIC_INVALID_ARGUMENT; } if (feedback_level < HAPTIC_FEEDBACK_LEVEL_AUTO || feedback_level > HAPTIC_FEEDBACK_LEVEL_END-1) { - ERR("feedback_level is wrong : %d", feedback_level); + DEVERR("feedback_level is wrong : %d", feedback_level); return HAPTIC_INVALID_ARGUMENT; } @@ -153,7 +153,7 @@ int device_haptic_play_file(int device_handle, const char *file_name, int iterat ret = haptic_vibrate_file_with_detail(device_handle, file_name, iteration, feedback_level, HAPTIC_PRIORITY_MIN, NULL); if (ret != HAPTIC_ERROR_NONE) { - ERR("haptic_vibrate_file_with_detail file : %d", ret); + DEVERR("haptic_vibrate_file_with_detail file : %d", ret); return __error_to_devman_haptic_type(ret); } @@ -166,22 +166,22 @@ int device_haptic_play_file_with_priority(int device_handle, const char *file_na int ret = -1; if (device_handle < 0) { - ERR("Invalid parameter - device_handle(%d)", device_handle); + DEVERR("Invalid parameter - device_handle(%d)", device_handle); return HAPTIC_INVALID_ARGUMENT; } if (file_name == NULL || iteration < 0) { - ERR("Invalid parameter - file_name(NULL) or iteration(%d)", iteration); + DEVERR("Invalid parameter - file_name(NULL) or iteration(%d)", iteration); return HAPTIC_INVALID_ARGUMENT; } if (priority_level < HAPTIC_PRIORITY_LEVEL_MIN || priority_level > HAPTIC_PRIORITY_LEVEL_MAX_OEM) { - ERR("priority_level is wrong : %d", priority_level); + DEVERR("priority_level is wrong : %d", priority_level); return HAPTIC_INVALID_ARGUMENT; } if (feedback_level < HAPTIC_FEEDBACK_LEVEL_AUTO || feedback_level > HAPTIC_FEEDBACK_LEVEL_END-1) { - ERR("feedback_level is wrong : %d", feedback_level); + DEVERR("feedback_level is wrong : %d", feedback_level); return HAPTIC_INVALID_ARGUMENT; } @@ -191,7 +191,7 @@ int device_haptic_play_file_with_priority(int device_handle, const char *file_na ret = haptic_vibrate_file_with_detail(device_handle, file_name, iteration, feedback_level, priority_level, NULL); if (ret != HAPTIC_ERROR_NONE) { - ERR("haptic_vibrate_file_with_detail file : %d", ret); + DEVERR("haptic_vibrate_file_with_detail file : %d", ret); return __error_to_devman_haptic_type(ret); } @@ -201,7 +201,7 @@ int device_haptic_play_file_with_priority(int device_handle, const char *file_na EXTAPI int device_haptic_play_pattern(int device_handle, int pattern, int iteration, int feedback_level) { - ERR("Not support api"); + DEVERR("Not support api"); return HAPTIC_NOT_SUPPORTED; } @@ -211,13 +211,13 @@ int device_haptic_stop_play(int device_handle) int ret = -1; if (device_handle < 0) { - ERR("Invalid parameter - device_handle(%d)", device_handle); + DEVERR("Invalid parameter - device_handle(%d)", device_handle); return HAPTIC_INVALID_ARGUMENT; } ret = haptic_stop_all_effects(device_handle); if (ret != HAPTIC_ERROR_NONE) { - ERR("haptic_stop_all_effects fail : %d", ret); + DEVERR("haptic_stop_all_effects fail : %d", ret); return __error_to_devman_haptic_type(ret); } @@ -230,18 +230,18 @@ int device_haptic_play_monotone(int device_handle, int duration) int ret = -1; if (device_handle < 0) { - ERR("Invalid parameter - device_handle(%d)", device_handle); + DEVERR("Invalid parameter - device_handle(%d)", device_handle); return HAPTIC_INVALID_ARGUMENT; } if (duration < 0) { - ERR("Invalid parameter - duration(%d)", duration); + DEVERR("Invalid parameter - duration(%d)", duration); return HAPTIC_INVALID_ARGUMENT; } ret = haptic_vibrate_monotone(device_handle, duration, NULL); if (ret != HAPTIC_ERROR_NONE) { - ERR("haptic_vibrate_monotone fail : %d", ret); + DEVERR("haptic_vibrate_monotone fail : %d", ret); return __error_to_devman_haptic_type(ret); } @@ -254,17 +254,17 @@ int device_haptic_play_monotone_with_feedback_level(int device_handle, int durat int ret = -1; if (device_handle < 0) { - ERR("Invalid parameter - device_handle(%d)", device_handle); + DEVERR("Invalid parameter - device_handle(%d)", device_handle); return HAPTIC_INVALID_ARGUMENT; } if (duration < 0) { - ERR("Invalid parameter - duration(%d)", duration); + DEVERR("Invalid parameter - duration(%d)", duration); return HAPTIC_INVALID_ARGUMENT; } if (feedback_level < HAPTIC_FEEDBACK_LEVEL_AUTO || feedback_level > HAPTIC_FEEDBACK_LEVEL_END-1) { - ERR("feedback_level is wrong : %d", feedback_level); + DEVERR("feedback_level is wrong : %d", feedback_level); return HAPTIC_INVALID_ARGUMENT; } @@ -276,7 +276,7 @@ int device_haptic_play_monotone_with_feedback_level(int device_handle, int durat ret = haptic_vibrate_monotone_with_detail(device_handle, duration, feedback_level, HAPTIC_PRIORITY_MIN, NULL); if (ret != HAPTIC_ERROR_NONE) { - ERR("haptic_vibrate_monotone_with_detail fail : %d", ret); + DEVERR("haptic_vibrate_monotone_with_detail fail : %d", ret); return __error_to_devman_haptic_type(ret); } @@ -289,17 +289,17 @@ int device_haptic_play_monotone_with_detail_feedback_level(int device_handle, in int ret = -1; if (device_handle < 0) { - ERR("Invalid parameter - device_handle(%d)", device_handle); + DEVERR("Invalid parameter - device_handle(%d)", device_handle); return HAPTIC_INVALID_ARGUMENT; } if (duration < 0) { - ERR("Invalid parameter - duration(%d)", duration); + DEVERR("Invalid parameter - duration(%d)", duration); return HAPTIC_INVALID_ARGUMENT; } if (detail_feedback_level < HAPTIC_FEEDBACK_LEVEL_AUTO || detail_feedback_level > 100) { - ERR("detail_feedback_level is wrong : %d", detail_feedback_level); + DEVERR("detail_feedback_level is wrong : %d", detail_feedback_level); return HAPTIC_INVALID_ARGUMENT; } @@ -309,7 +309,7 @@ int device_haptic_play_monotone_with_detail_feedback_level(int device_handle, in ret = haptic_vibrate_monotone_with_detail(device_handle, duration, detail_feedback_level, HAPTIC_PRIORITY_MIN, NULL); if (ret != HAPTIC_ERROR_NONE) { - ERR("haptic_vibrate_monotone_with_detail fail : %d", ret); + DEVERR("haptic_vibrate_monotone_with_detail fail : %d", ret); return __error_to_devman_haptic_type(ret); } @@ -322,18 +322,18 @@ int device_haptic_get_buffer_duration(int device_handle, const unsigned char *vi int ret = -1; if (device_handle < 0) { - ERR("Invalid parameter - device_handle(%d)", device_handle); + DEVERR("Invalid parameter - device_handle(%d)", device_handle); return HAPTIC_INVALID_ARGUMENT; } if (vibe_buffer == NULL || duration == NULL) { - ERR("Invalid parameter - vibe_buffer(NULL) or duration(NULL)"); + DEVERR("Invalid parameter - vibe_buffer(NULL) or duration(NULL)"); return HAPTIC_INVALID_ARGUMENT; } ret = haptic_get_buffer_duration(device_handle, vibe_buffer, duration); if (ret != HAPTIC_ERROR_NONE) { - ERR("haptic_get_buffer_duration fail : %d", ret); + DEVERR("haptic_get_buffer_duration fail : %d", ret); return __error_to_devman_haptic_type(ret); } @@ -346,18 +346,18 @@ int device_haptic_get_file_duration(int device_handle, const char *file_name, in int ret = -1; if (device_handle < 0) { - ERR("Invalid parameter - device_handle(%d)", device_handle); + DEVERR("Invalid parameter - device_handle(%d)", device_handle); return HAPTIC_INVALID_ARGUMENT; } if (file_name == NULL || duration == NULL) { - ERR("Invalid parameter - file_name(NULL) or duration(NULL)"); + DEVERR("Invalid parameter - file_name(NULL) or duration(NULL)"); return HAPTIC_INVALID_ARGUMENT; } ret = haptic_get_file_duration(device_handle, file_name, duration); if (ret != HAPTIC_ERROR_NONE) { - ERR("haptic_get_file_duration fail : %d", ret); + DEVERR("haptic_get_file_duration fail : %d", ret); return __error_to_devman_haptic_type(ret); } @@ -367,7 +367,7 @@ int device_haptic_get_file_duration(int device_handle, const char *file_name, in EXTAPI int device_haptic_get__duration(int device_handle, int pattern, int *duration) { - ERR("Not support api"); + DEVERR("Not support api"); return HAPTIC_NOT_SUPPORTED; } @@ -379,7 +379,7 @@ int device_haptic_get_device_count() ret = haptic_get_count(&count); if (ret != HAPTIC_ERROR_NONE) { - ERR("haptic_get_count fail : %d", ret); + DEVERR("haptic_get_count fail : %d", ret); return __error_to_devman_haptic_type(ret); } diff --git a/src/device_plugin.c b/src/device_plugin.c deleted file mode 100644 index 8721238..0000000 --- a/src/device_plugin.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * devman - * 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 <dlfcn.h> - -#include "device_plugin.h" - -static void *dlopen_handle; - -static void __attribute__ ((constructor)) module_init() -{ - char *error; - - dlopen_handle = dlopen(DEVMAN_PLUGIN_PATH, RTLD_NOW); - if (!dlopen_handle) { - ERR("dlopen() failed"); - return; - } - - const OEM_sys_devman_plugin_interface *(*OEM_sys_get_devman_plugin_interface) (); - OEM_sys_get_devman_plugin_interface = dlsym(dlopen_handle, "OEM_sys_get_devman_plugin_interface"); - if ((error = dlerror()) != NULL) { - ERR("dlsym() failed: %s", error); - dlclose(dlopen_handle); - return; - } - - plugin_intf = OEM_sys_get_devman_plugin_interface(); - if (!plugin_intf) { - ERR("get_devman_plugin_interface() failed"); - dlclose(dlopen_handle); - return; - } -} - - -static void __attribute__ ((destructor)) module_fini() -{ - if (dlopen_handle) { - dlclose(dlopen_handle); - } - -} diff --git a/src/devman_internal.c b/src/devman_internal.c index 9fa5537..5081011 100644 --- a/src/devman_internal.c +++ b/src/devman_internal.c @@ -50,18 +50,18 @@ API int display_register_postjob(void) snprintf(fifo_path, NAME_MAX, "%s.%d", DISPLAY_WD_FIFO, getpid()); if (access(fifo_path, F_OK) == 0) { - ERR("Already registered!"); + DEVERR("Already registered!"); return -1; } if (mkfifo(fifo_path, 0700) != 0) { - ERR("mkfifo error : %s", strerror(errno)); + DEVERR("mkfifo error : %s", strerror(errno)); return -1; } pid = fork(); if(pid < 0) { - ERR("Failed to fork child process for LCD On/Off"); + DEVERR("Failed to fork child process for LCD On/Off"); unlink(fifo_path); return -1; } @@ -76,7 +76,7 @@ API int display_register_postjob(void) fifo_pollfd.fd = open(fifo_path, O_RDWR | O_NONBLOCK); if (fifo_pollfd.fd < 0) { - ERR("Cannot open fifo file"); + DEVERR("Cannot open fifo file"); unlink(fifo_path); return -1; } @@ -84,8 +84,8 @@ API int display_register_postjob(void) /* get the watch dog ready message. */ fifo_pollfd.events = POLLIN; if (poll(&fifo_pollfd, 1, WD_RESPONSE_TIMEOUT) < 0) { - ERR("Cannot poll the fifo file"); - DBG("fifo file path is %s", fifo_path); + DEVERR("Cannot poll the fifo file"); + DEVLOG("fifo file path is %s", fifo_path); close(fifo_pollfd.fd); unlink(fifo_path); return -1; @@ -104,15 +104,15 @@ API int display_cancel_postjob(void) snprintf(buf, PATH_MAX, "%s.%d", DISPLAY_WD_FIFO, getpid()); if (access(buf, F_OK) != 0) { - ERR("No registered the post job!"); + DEVERR("No registered the post job!"); return -1; } if (fifo_fd < 0) fifo_fd = open(buf, O_WRONLY); if (fifo_fd < 0) { - ERR("Cannot open the fifo file"); - DBG("fifo file path is %s", buf); + DEVERR("Cannot open the fifo file"); + DEVLOG("fifo file path is %s", buf); return -1; } ret = DISPLAY_WD_CANCEL; diff --git a/src/display_wd.c b/src/display_wd.c index 9000014..d1d0667 100644 --- a/src/display_wd.c +++ b/src/display_wd.c @@ -19,8 +19,8 @@ #include <stdio.h> #include <stdlib.h> #include <stdbool.h> -#include <strings.h> #include <string.h> +#include <unistd.h> #include <fcntl.h> #include <linux/limits.h> #include <poll.h> @@ -38,7 +38,7 @@ struct pollfd fifo_pollfd; static void sig_quit(int signo) { - fprintf(stderr, "[DISPLAY_WD] display_wd will be exit for signal %d\n", signo); + DEVERR("[DISPLAY_WD] display_wd will be exit for signal %d", signo); if(fifo_pollfd.fd >= 0) close(fifo_pollfd.fd); if (access(fifo_path, F_OK) == 0) @@ -59,7 +59,7 @@ int main(void) snprintf(fifo_path, NAME_MAX, "%s.%d", DISPLAY_WD_FIFO, getppid()); fifo_pollfd.fd = open(fifo_path, O_WRONLY); if (fifo_pollfd.fd < 0) { - fprintf(stderr, "[DISPLAY_WD] Cannot open the fifo file - %s.\n", + DEVERR("[DISPLAY_WD] Cannot open the fifo file - %s.", fifo_path); return -1; } @@ -72,7 +72,7 @@ int main(void) fifo_pollfd.fd = open(fifo_path, O_RDONLY); if (fifo_pollfd.fd < 0) { - fprintf(stderr, "[DISPLAY_WD] Cannot open the fifo file - %s.\n", + DEVERR("[DISPLAY_WD] Cannot open the fifo file - %s.", fifo_path); return -1; } @@ -80,19 +80,16 @@ int main(void) fifo_pollfd.events = (POLLIN | POLLHUP); ret = 0; while (ret != DISPLAY_WD_CANCEL) { + DEVLOG("[DISPLAY_WD] wait...."); if (poll(&fifo_pollfd, 1, -1) < 0) { - fprintf(stderr, - "[DISPLAY_WD] Cannot poll the fifo file - %s\n", - fifo_path); + DEVERR("[DISPLAY_WD] Cannot poll the fifo file - %s", fifo_path); close(fifo_pollfd.fd); return -1; } if (fifo_pollfd.revents & POLLIN) { read(fifo_pollfd.fd, &ret, sizeof(int)); if (ret == DISPLAY_WD_CANCEL) { - fprintf(stderr, - "[DISPLAY_WD] Canceled. - %s, %d\n", - fifo_path, ret); + DEVERR("[DISPLAY_WD] Canceled. - %s, %d", fifo_path, ret); close(fifo_pollfd.fd); return -1; } @@ -111,6 +108,7 @@ int main(void) device_set_property(DEVTYPE_DISPLAY0, DISPLAY_PROP_BRIGHTNESS, val); } } else if (auto_brightness_state == SETTING_BRIGHTNESS_AUTOMATIC_PAUSE) { + DEVLOG("Auto brightness is enable"); vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, SETTING_BRIGHTNESS_AUTOMATIC_ON); } } diff --git a/src/if_generic.c b/src/if_generic.c deleted file mode 100644 index cefc561..0000000 --- a/src/if_generic.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * devman - * 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 <errno.h> - -#include "devman_error.h" -#include "devlog.h" -#include "device_engine.h" - -API int device_get_property(devtype_t devtype, int property, int *value) -{ - struct device *dev = NULL; - int ret = -1; - - retry: - if (dev != NULL) { - dev = dev->next; - if (dev == NULL) { - DBG("devtype cannot find"); - errno = EPERM; - return DEVMAN_ERROR_OPERATION_FAILED; - } - } - - dev = find_device(dev, devtype); - if (dev == NULL) { - DBG("devtype cannot find"); - errno = EPERM; - return DEVMAN_ERROR_OPERATION_FAILED; - } - if (dev->get_int == NULL) { - DBG("get_int of %s is null", dev->devname); - goto retry; - } - - ret = dev->get_int(property, value); - if (ret == -ENODEV) { - DBG("not support driver"); - errno = ENODEV; - return DEVMAN_ERROR_NOT_SUPPORTED; - } - if (ret == -1) { - DBG("get_int of %s return fails", dev->devname); - goto retry; - } - - errno = 0; - return ret; -} - -API int device_set_property(devtype_t devtype, int property, int value) -{ - struct device *dev = NULL; - int ret = -1; - - retry: - if (dev != NULL) { - dev = dev->next; - if (dev == NULL) { - DBG("devtype cannot find"); - errno = EPERM; - return DEVMAN_ERROR_OPERATION_FAILED; - } - } - - dev = find_device(dev, devtype); - if (dev == NULL) { - DBG("devtype cannot find"); - errno = EPERM; - return DEVMAN_ERROR_OPERATION_FAILED; - } - if (dev->set_int == NULL) { - DBG("set_int of %s is null", dev->devname); - goto retry; - } - - ret = dev->set_int(property, value); - if (ret == -ENODEV) { - DBG("not support driver"); - errno = ENODEV; - return DEVMAN_ERROR_NOT_SUPPORTED; - } - if (ret == -1) { - DBG("set_int of %s return fails", dev->devname); - goto retry; - } - - errno = 0; - return ret; -} diff --git a/src/if_legacy.c b/src/if_legacy.c index 13cc689..cd3402b 100644 --- a/src/if_legacy.c +++ b/src/if_legacy.c @@ -18,33 +18,36 @@ #include <vconf.h> #include <errno.h> +#include <device-node.h> +#include "devman.h" #include "devman_internal.h" -#include "device_engine.h" #include "devlog.h" -#define DISP_INDEX_BIT 4 -#define COMBINE_DISP_CMD(cmd, prop, index) (cmd = (prop | (index << DISP_INDEX_BIT))) +#define DISPLAY_MAX_BRIGHTNESS 100 +#define DISPLAY_MIN_BRIGHTNESS 0 -#define SET_FLAG(var, bit) (var |= (1<<bit)) -#define UNSET_FLAG(var, bit) (var &= (~(1<<bit))) -#define BRT_BIT 1 -#define GAMMA_BIT 2 -#define LED_BIT 4 +#define DISP_INDEX_BIT 4 +#define COMBINE_DISP_CMD(cmd, prop, index) (cmd = (prop | (index << DISP_INDEX_BIT))) + +#define SET_FLAG(var, bit) (var |= (1<<bit)) +#define UNSET_FLAG(var, bit) (var &= (~(1<<bit))) +#define BRT_BIT 1 +#define LED_BIT 4 static unsigned int disp_flag = 0x0; API int device_get_battery_pct(void) { - int val = -1; - int ret = -1; + int val; + int ret; - ret = device_get_property(DEVTYPE_POWERSUPPLY, POWER_SUPPLY_PROP_CAPACITY, &val); + ret = device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CAPACITY, &val); if (ret < 0) return ret; if (val < 0 || val > 100) { - ERR("capacity value is wrong"); + DEVERR("capacity value is wrong"); return DEVMAN_ERROR_OPERATION_FAILED; } @@ -53,44 +56,44 @@ API int device_get_battery_pct(void) API int device_is_battery_full(void) { - int charge_full = 0; - int ret = -1; + int val; + int ret; - ret = device_get_property(DEVTYPE_POWERSUPPLY, POWER_SUPPLY_PROP_CHARGE_FULL, &charge_full); + ret = device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_FULL, &val); if (ret < 0) return ret; - if (charge_full != 0 && charge_full != 1) { - ERR("charge_full value is wrong"); + if (val != 0 && val != 1) { + DEVERR("charge_full value is wrong"); return DEVMAN_ERROR_OPERATION_FAILED; } - return charge_full; + return val; } API int device_get_battery_health(void) { - int health = -1; - int ret = -1; + int val; + int ret; - ret = device_get_property(DEVTYPE_POWERSUPPLY, POWER_SUPPLY_PROP_BATTERY_HEALTH, &health); + ret = device_get_property(DEVICE_TYPE_POWER, PROP_POWER_HEALTH, &val); if (ret < 0) return ret; - if (health < BAT_UNKNOWN || health > BAT_COLD) { - ERR("battery health value is wrong"); + if (val < BAT_UNKNOWN || val > BAT_COLD) { + DEVERR("battery health value is wrong"); return DEVMAN_ERROR_OPERATION_FAILED; } - return health; + return val; } API int device_get_battery_pct_raw(void) { - int val = -1; - int ret = -1; + int val; + int ret; - ret = device_get_property(DEVTYPE_POWERSUPPLY, POWER_SUPPLY_PROP_CAPACITY_RAW, &val); + ret = device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CAPACITY_RAW, &val); if (ret < 0) return ret; @@ -102,12 +105,12 @@ API int device_get_battery_pct_raw(void) API int device_get_display_brt(display_num_t lcdnum) { - int val = -1; - int cmd = 0; - int ret = -1; + int val; + int cmd; + int ret; - COMBINE_DISP_CMD(cmd, DISPLAY_PROP_BRIGHTNESS, lcdnum); - ret = device_get_property(DEVTYPE_DISPLAY0, cmd, &val); + COMBINE_DISP_CMD(cmd, PROP_DISPLAY_BRIGHTNESS, lcdnum); + ret = device_get_property(DEVICE_TYPE_DISPLAY, cmd, &val); if (ret < 0) return ret; @@ -116,39 +119,38 @@ API int device_get_display_brt(display_num_t lcdnum) API int device_set_display_brt_with_settings(display_num_t lcdnum, int val) { - int bat_state = -1; - int auto_brightness_state = -1; - int ret = -1; - int cmd = 0; + int bat_state; + int auto_brt_state; + int cmd; + int ret; if (vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &bat_state) != 0) { - ERR("Failed to get VCONFKEY_SYSMAN_BATTERY_STATUS_LOW value"); + DEVERR("Failed to get VCONFKEY_SYSMAN_BATTERY_STATUS_LOW value"); return DEVMAN_ERROR_OPERATION_FAILED; } if (bat_state < VCONFKEY_SYSMAN_BAT_WARNING_LOW) { - DBG("can not set brightness for low battery"); + DEVLOG("can not set brightness for low battery"); return DEVMAN_ERROR_NONE; } - if (vconf_get_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, &auto_brightness_state) != 0) { - ERR("Failed to get VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT value"); + if (vconf_get_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, &auto_brt_state) != 0) { + DEVERR("Failed to get VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT value"); return DEVMAN_ERROR_OPERATION_FAILED; } - if (auto_brightness_state == SETTING_BRIGHTNESS_AUTOMATIC_ON) { - DBG("auto_brightness state is ON, can not change the brightness value"); + if (auto_brt_state == SETTING_BRIGHTNESS_AUTOMATIC_ON) { + DEVLOG("auto_brightness state is ON, can not change the brightness value"); return DEVMAN_ERROR_NONE; } - COMBINE_DISP_CMD(cmd, DISPLAY_PROP_BRIGHTNESS, lcdnum); - ret = device_set_property(DEVTYPE_DISPLAY0, cmd, val); + COMBINE_DISP_CMD(cmd, PROP_DISPLAY_BRIGHTNESS, lcdnum); + ret = device_set_property(DEVICE_TYPE_DISPLAY, cmd, val); if (ret < 0) return ret; if (vconf_set_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, val) != 0) { - ERR("Failed to set VCONFKEY_SETAPPL_LCD_BRIGHTNESS value"); - return DEVMAN_ERROR_OPERATION_FAILED; + DEVERR("Failed to set VCONFKEY_SETAPPL_LCD_BRIGHTNESS value"); } return DEVMAN_ERROR_NONE; @@ -156,32 +158,35 @@ API int device_set_display_brt_with_settings(display_num_t lcdnum, int val) API int device_set_display_brt(display_num_t lcdnum, int val) { - int bat_state = -1; - int auto_brightness_state = -1; - int ret = -1; - int cmd = 0; + int bat_state; + int auto_brt_state; + int cmd; + int ret; if (vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &bat_state) != 0) { - ERR("Failed to get VCONFKEY_SYSMAN_BATTERY_STATUS_LOW value"); + DEVERR("Failed to get VCONFKEY_SYSMAN_BATTERY_STATUS_LOW value"); return DEVMAN_ERROR_OPERATION_FAILED; } vconf_set_int(VCONFKEY_PM_CUSTOM_BRIGHTNESS_STATUS, VCONFKEY_PM_CUSTOM_BRIGHTNESS_ON); if (bat_state < VCONFKEY_SYSMAN_BAT_WARNING_LOW) { - DBG("can not set brightness for low battery"); + DEVLOG("can not set brightness for low battery"); return DEVMAN_ERROR_NONE; } - COMBINE_DISP_CMD(cmd, DISPLAY_PROP_BRIGHTNESS, lcdnum); - ret = device_set_property(DEVTYPE_DISPLAY0, cmd, val); + if (vconf_get_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, &auto_brt_state) != 0) { + DEVERR("Failed to get VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT value"); + return DEVMAN_ERROR_OPERATION_FAILED; + } + + COMBINE_DISP_CMD(cmd, PROP_DISPLAY_BRIGHTNESS, lcdnum); + ret = device_set_property(DEVICE_TYPE_DISPLAY, cmd, val); if (ret < 0) return ret; - if (vconf_get_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, &auto_brightness_state) == 0) { - if (auto_brightness_state == SETTING_BRIGHTNESS_AUTOMATIC_ON) { - DBG("Auto brightness is paused"); - vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, SETTING_BRIGHTNESS_AUTOMATIC_PAUSE); - } + if (auto_brt_state == SETTING_BRIGHTNESS_AUTOMATIC_ON) { + DEVLOG("Auto brightness will be paused"); + vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, SETTING_BRIGHTNESS_AUTOMATIC_PAUSE); } if (!disp_flag) @@ -193,59 +198,60 @@ API int device_set_display_brt(display_num_t lcdnum, int val) API int device_release_brt_ctrl(display_num_t lcdnum) { - int setting_val = 0; - int bat_state = -1; - int auto_brightness_state = -1; - int cmd = 0; - int ret = -1; - int charger_state = -1; - int brt_changed_state = -1; + int bat_state; + int setting_val; + int auto_brt_state; + int charger_state; + int brt_changed_state; + int cmd; + int ret; if (vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &bat_state) != 0) { - ERR("Failed to get VCONFKEY_SYSMAN_BATTERY_STATUS_LOW value"); + DEVERR("Failed to get VCONFKEY_SYSMAN_BATTERY_STATUS_LOW value"); return DEVMAN_ERROR_OPERATION_FAILED; } if (vconf_get_int(VCONFKEY_SYSMAN_CHARGER_STATUS, &charger_state) != 0) { - ERR("Failed to get VCONFKEY_SYSMAN_CHARGER_STATUS value"); + DEVERR("Failed to get VCONFKEY_SYSMAN_CHARGER_STATUS value"); return DEVMAN_ERROR_OPERATION_FAILED; } if (vconf_get_bool(VCONFKEY_PM_BRIGHTNESS_CHANGED_IN_LPM, &brt_changed_state) != 0) { - ERR("Failed to get VCONFKEY_PM_BRIGHTNESS_CHANGED_IN_LPM value"); + DEVERR("Failed to get VCONFKEY_PM_BRIGHTNESS_CHANGED_IN_LPM value"); return DEVMAN_ERROR_OPERATION_FAILED; } vconf_set_int(VCONFKEY_PM_CUSTOM_BRIGHTNESS_STATUS, VCONFKEY_PM_CUSTOM_BRIGHTNESS_OFF); if (bat_state < VCONFKEY_SYSMAN_BAT_WARNING_LOW) { - DBG("can not set brightness for low battery"); + DEVLOG("can not set brightness for low battery"); return DEVMAN_ERROR_NONE; } + if (vconf_get_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, &setting_val) != 0) { + DEVERR("Failed to get VCONFKEY_SETAPPL_LCD_BRIGHTNESS value"); + return DEVMAN_ERROR_OPERATION_FAILED; + } + + if (vconf_get_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, &auto_brt_state) != 0) { + DEVERR("Failed to get VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT value"); + return DEVMAN_ERROR_OPERATION_FAILED; + } + // check dim state if (bat_state == VCONFKEY_SYSMAN_BAT_WARNING_LOW && charger_state == VCONFKEY_SYSMAN_CHARGER_DISCONNECTED && !brt_changed_state) { - DBG("batt warning low : brightness is not changed!"); - COMBINE_DISP_CMD(cmd, DISPLAY_PROP_BRIGHTNESS, lcdnum); - device_set_property(DEVTYPE_DISPLAY0, cmd, 0); + DEVLOG("batt warning low : brightness is not changed!"); + COMBINE_DISP_CMD(cmd, PROP_DISPLAY_BRIGHTNESS, lcdnum); + device_set_property(DEVICE_TYPE_DISPLAY, cmd, 0); return DEVMAN_ERROR_NONE; } - if (vconf_get_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, &setting_val) != 0) { - COMBINE_DISP_CMD(cmd, DISPLAY_PROP_MAX_BRIGHTNESS, lcdnum); - ret = device_get_property(DEVTYPE_DISPLAY0, cmd, &setting_val); - if (ret < 0) - return ret; - setting_val = setting_val * 0.7; - } - - if (vconf_get_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, &auto_brightness_state) == 0) { - if (auto_brightness_state == SETTING_BRIGHTNESS_AUTOMATIC_OFF) { - COMBINE_DISP_CMD(cmd, DISPLAY_PROP_BRIGHTNESS, lcdnum); - device_set_property(DEVTYPE_DISPLAY0, cmd, setting_val); - } else if (auto_brightness_state == SETTING_BRIGHTNESS_AUTOMATIC_PAUSE) { - vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, SETTING_BRIGHTNESS_AUTOMATIC_ON); - } + if (auto_brt_state == SETTING_BRIGHTNESS_AUTOMATIC_OFF) { + COMBINE_DISP_CMD(cmd, PROP_DISPLAY_BRIGHTNESS, lcdnum); + device_set_property(DEVICE_TYPE_DISPLAY, cmd, setting_val); + } else if (auto_brt_state == SETTING_BRIGHTNESS_AUTOMATIC_PAUSE) { + DEVLOG("Auto brightness will be enable"); + vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, SETTING_BRIGHTNESS_AUTOMATIC_ON); } UNSET_FLAG(disp_flag, BRT_BIT); @@ -254,89 +260,40 @@ API int device_release_brt_ctrl(display_num_t lcdnum) return DEVMAN_ERROR_NONE; } -API int device_get_min_brt(display_num_t lcdnum) +API int device_get_max_brt(display_num_t lcdnum) { - int val = -1; - int cmd = 0; - int ret = -1; - - COMBINE_DISP_CMD(cmd, DISPLAY_PROP_MIN_BRIGHTNESS, lcdnum); - ret = device_get_property(DEVTYPE_DISPLAY0, cmd, &val); - if (ret < 0) - return ret; - - return val; + return DISPLAY_MAX_BRIGHTNESS; } -API int device_get_max_brt(display_num_t lcdnum) +API int device_get_min_brt(display_num_t lcdnum) { - int val = -1; - int cmd = 0; - int ret = -1; - - COMBINE_DISP_CMD(cmd, DISPLAY_PROP_MAX_BRIGHTNESS, lcdnum); - ret = device_get_property(DEVTYPE_DISPLAY0, cmd, &val); - if (ret < 0) - return ret; - - return val; + return DISPLAY_MIN_BRIGHTNESS; } API int device_get_display_gamma(display_num_t lcdnum) { - int val = -1; - int cmd = 0; - int ret = -1; - - COMBINE_DISP_CMD(cmd, DISPLAY_PROP_GAMMA, lcdnum); - ret = device_get_property(DEVTYPE_DISPLAY0, cmd, &val); - if (ret < 0) - return ret; - - return val; + DEVERR("Not support this api"); + return DEVMAN_ERROR_NOT_SUPPORTED; } API int device_set_display_gamma(display_num_t lcdnum, display_gamma_t val) { - int ret = -1; - int cmd = 0; - - COMBINE_DISP_CMD(cmd, DISPLAY_PROP_GAMMA, lcdnum); - ret = device_set_property(DEVTYPE_DISPLAY0, cmd, val); - if (ret < 0) - return ret; - - if (!disp_flag) - ret = display_register_postjob(); - if (ret == 0) - SET_FLAG(disp_flag, GAMMA_BIT); - - return DEVMAN_ERROR_NONE; + DEVERR("Not support this api"); + return DEVMAN_ERROR_NOT_SUPPORTED; } API int device_release_gamma_ctrl(display_num_t lcdnum, display_gamma_t org_val) { - int cmd = 0; - int ret = -1; - - COMBINE_DISP_CMD(cmd, DISPLAY_PROP_GAMMA, lcdnum); - ret = device_set_property(DEVTYPE_DISPLAY0, cmd, org_val); - if (ret < 0) - return ret; - - UNSET_FLAG(disp_flag, GAMMA_BIT); - if (!disp_flag) - display_cancel_postjob(); - - return DEVMAN_ERROR_NONE; + DEVERR("Not support this api"); + return DEVMAN_ERROR_NOT_SUPPORTED; } API int device_get_display_count(void) { - int val = -1; - int ret = -1; + int val; + int ret; - ret = device_get_property(DEVTYPE_DISPLAY0, DISPLAY_PROP_DISPLAY_COUNT, &val); + ret = device_get_property(DEVICE_TYPE_DISPLAY, PROP_DISPLAY_DISPLAY_COUNT, &val); if (ret < 0) return ret; @@ -345,10 +302,10 @@ API int device_get_display_count(void) API int device_get_image_enhance_mode(void) { - int val = -1; - int ret = -1; + int val; + int ret; - ret = device_get_property(DEVTYPE_DISPLAY0, DISPLAY_PROP_IMAGE_ENHANCE_MODE, &val); + ret = device_get_property(DEVICE_TYPE_DISPLAY, PROP_DISPLAY_IMAGE_ENHANCE_MODE, &val); if (ret < 0) return ret; @@ -357,9 +314,9 @@ API int device_get_image_enhance_mode(void) API int device_set_image_enhance_mode(int val) { - int ret = -1; + int ret; - ret = device_set_property(DEVTYPE_DISPLAY0, DISPLAY_PROP_IMAGE_ENHANCE_MODE, val); + ret = device_set_property(DEVICE_TYPE_DISPLAY, PROP_DISPLAY_IMAGE_ENHANCE_MODE, val); if (ret < 0) return ret; @@ -368,10 +325,10 @@ API int device_set_image_enhance_mode(int val) API int device_get_image_enhance_scenario(void) { - int val = -1; - int ret = -1; + int val; + int ret; - ret = device_get_property(DEVTYPE_DISPLAY0, DISPLAY_PROP_IMAGE_ENHANCE_SCENARIO, &val); + ret = device_get_property(DEVICE_TYPE_DISPLAY, PROP_DISPLAY_IMAGE_ENHANCE_SCENARIO, &val); if (ret < 0) return ret; @@ -380,9 +337,9 @@ API int device_get_image_enhance_scenario(void) API int device_set_image_enhance_scenario(int val) { - int ret = -1; + int ret; - ret = device_set_property(DEVTYPE_DISPLAY0, DISPLAY_PROP_IMAGE_ENHANCE_SCENARIO, val); + ret = device_set_property(DEVICE_TYPE_DISPLAY, PROP_DISPLAY_IMAGE_ENHANCE_SCENARIO, val); if (ret < 0) return ret; @@ -391,10 +348,10 @@ API int device_set_image_enhance_scenario(int val) API int device_get_image_enhance_tone(void) { - int val = -1; - int ret = -1; + int val; + int ret; - ret = device_get_property(DEVTYPE_DISPLAY0, DISPLAY_PROP_IMAGE_ENHANCE_TONE, &val); + ret = device_get_property(DEVICE_TYPE_DISPLAY, PROP_DISPLAY_IMAGE_ENHANCE_TONE, &val); if (ret < 0) return ret; @@ -403,9 +360,9 @@ API int device_get_image_enhance_tone(void) API int device_set_image_enhance_tone(int val) { - int ret = -1; + int ret; - ret = device_set_property(DEVTYPE_DISPLAY0, DISPLAY_PROP_IMAGE_ENHANCE_TONE, val); + ret = device_set_property(DEVICE_TYPE_DISPLAY, PROP_DISPLAY_IMAGE_ENHANCE_TONE, val); if (ret < 0) return ret; @@ -414,10 +371,10 @@ API int device_set_image_enhance_tone(int val) API int device_get_image_enhance_outdoor(void) { - int val = -1; - int ret = -1; + int val; + int ret; - ret = device_get_property(DEVTYPE_DISPLAY0, DISPLAY_PROP_IMAGE_ENHANCE_OUTDOOR, &val); + ret = device_get_property(DEVICE_TYPE_DISPLAY, PROP_DISPLAY_IMAGE_ENHANCE_OUTDOOR, &val); if (ret < 0) return ret; @@ -426,9 +383,9 @@ API int device_get_image_enhance_outdoor(void) API int device_set_image_enhance_outdoor(int val) { - int ret = -1; + int ret; - ret = device_set_property(DEVTYPE_DISPLAY0, DISPLAY_PROP_IMAGE_ENHANCE_OUTDOOR, val); + ret = device_set_property(DEVICE_TYPE_DISPLAY, PROP_DISPLAY_IMAGE_ENHANCE_OUTDOOR, val); if (ret < 0) return ret; @@ -437,10 +394,10 @@ API int device_set_image_enhance_outdoor(int val) API int device_get_image_enhance_info(void) { - int val = -1; - int ret = -1; + int val; + int ret; - ret = device_get_property(DEVTYPE_DISPLAY0, DISPLAY_PROP_IMAGE_ENHANCE_INFO, &val); + ret = device_get_property(DEVICE_TYPE_DISPLAY, PROP_DISPLAY_IMAGE_ENHANCE_INFO, &val); if (ret < 0) return ret; @@ -449,8 +406,8 @@ API int device_get_image_enhance_info(void) API int device_get_led_brt(void) { - int val = -1; - int ret = -1; + int val; + int ret; ret = device_get_property(DEVTYPE_LED, LED_PROP_BRIGHTNESS, &val); if (ret < 0) @@ -481,10 +438,21 @@ API int device_set_led_brt(int val) return DEVMAN_ERROR_NONE; } +API int device_set_led_brt_without_noti(int val) +{ + int ret; + + ret = device_set_property(DEVTYPE_LED, LED_PROP_BRIGHTNESS, val); + if (ret < 0) + return ret; + + return DEVMAN_ERROR_NONE; +} + API int device_get_max_led(void) { - int val = -1; - int ret = -1; + int val; + int ret; ret = device_get_property(DEVTYPE_LED, LED_PROP_MAX_BRIGHTNESS, &val); if (ret < 0) @@ -495,12 +463,12 @@ API int device_get_max_led(void) API int device_get_acl_control_status(display_num_t num) { - int val = -1; - int cmd = 0; - int ret = -1; + int val; + int cmd; + int ret; - COMBINE_DISP_CMD(cmd, DISPLAY_PROP_ACL_CONTROL, num); - ret = device_get_property(DEVTYPE_DISPLAY0, cmd, &val); + COMBINE_DISP_CMD(cmd, PROP_DISPLAY_ACL_CONTROL, num); + ret = device_get_property(DEVICE_TYPE_DISPLAY, cmd, &val); if (ret < 0) return ret; @@ -509,11 +477,11 @@ API int device_get_acl_control_status(display_num_t num) API int device_set_acl_control_status(display_num_t num, int val) { - int cmd = 0; - int ret = -1; + int cmd; + int ret; - COMBINE_DISP_CMD(cmd, DISPLAY_PROP_ACL_CONTROL, num); - ret = device_set_property(DEVTYPE_DISPLAY0, cmd, val); + COMBINE_DISP_CMD(cmd, PROP_DISPLAY_ACL_CONTROL, num); + ret = device_set_property(DEVICE_TYPE_DISPLAY, cmd, val); if (ret < 0) return ret; |