Permalink
Browse files

Release powerd 4.0.0-rc1 to the public

  • Loading branch information...
0 parents commit fbf56b4a02b74e06a6ab31f30c67cda3fddcbd03 @smtodwal smtodwal committed with Herb Kuta Apr 27, 2012
Showing with 7,996 additions and 0 deletions.
  1. +25 −0 .gitignore
  2. +136 −0 CMakeLists.txt
  3. +108 −0 README.md
  4. +240 −0 doc/Doxyfile.in
  5. +35 −0 include/powerd-glib.h
  6. +37 −0 include/powerd-lunaservice.h
  7. +75 −0 include/powerd.h
  8. +45 −0 include/private/clock.h
  9. +119 −0 include/private/debug.h
  10. +35 −0 include/private/idler.h
  11. +52 −0 include/private/powerdltp.h
  12. +53 −0 include/private/wait.h
  13. +43 −0 libpowerd/CMakeLists.txt
  14. +163 −0 libpowerd/clock.c
  15. +725 −0 libpowerd/commands.c
  16. +152 −0 libpowerd/init.c
  17. +38 −0 libpowerd/init.h
  18. +28 −0 libpowerd/powerd.pc.in
  19. +217 −0 libpowerd/wait.c
  20. +44 −0 powerd/CMakeLists.txt
  21. +385 −0 powerd/alarms/timeout_alarm.c
  22. +75 −0 powerd/alarms/timeout_alarm.h
  23. +469 −0 powerd/charging/battery.c
  24. +83 −0 powerd/charging/battery.h
  25. +353 −0 powerd/charging/batterypoll.c
  26. +24 −0 powerd/charging/batterypoll.h
  27. +347 −0 powerd/charging/charger.c
  28. +40 −0 powerd/charging/charger.h
  29. +714 −0 powerd/charging/charging_logic.c
  30. +69 −0 powerd/charging/charging_logic.h
  31. +229 −0 powerd/charging/suspend.c
  32. +119 −0 powerd/com_palm_power_lunabus.c
  33. +177 −0 powerd/config.c
  34. +51 −0 powerd/config.h
  35. +100 −0 powerd/etc/event.d/powerd
  36. +162 −0 powerd/main.c
  37. +36 −0 powerd/main.h
  38. +25 −0 powerd/preferences/powerd.conf
  39. +263 −0 powerd/suspend/shutdown.c
  40. +42 −0 powerd/suspend/suspend.h
  41. +270 −0 powerd/suspend/suspend_ipc.c
  42. +219 −0 powerd/timesaver.c
  43. +27 −0 powerd/timesaver.h
  44. +33 −0 powerd/utils/common.h
  45. +157 −0 powerd/utils/init.c
  46. +48 −0 powerd/utils/init.h
  47. +199 −0 powerd/utils/logging.c
  48. +43 −0 powerd/utils/logging.h
  49. +81 −0 powerd/utils/lunaservice_utils.c
  50. +30 −0 powerd/utils/lunaservice_utils.h
  51. +146 −0 powerd/utils/sysfs.c
  52. +30 −0 powerd/utils/sysfs.h
  53. +265 −0 powerd/utils/timersource.c
  54. +38 −0 powerd/utils/timersource.h
  55. +137 −0 powerd/utils/uevent.c
  56. +28 −0 powerd/utils/uevent.h
  57. +33 −0 service/com.palm.power.json.prv
  58. +33 −0 service/com.palm.power.json.pub
  59. +23 −0 service/com.palm.power.service.prv
  60. +23 −0 service/com.palm.power.service.pub
@@ -0,0 +1,25 @@
+# @@@LICENSE
+#
+# Copyright (c) 2007-2012 Hewlett-Packard Development Company, L.P.
+#
+# 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.
+#
+# LICENSE@@@
+BUILD*
+CMakeCache.txt
+cmake_install.cmake
+CMakeFiles
+doc/Doxyfile
+doc/html
+patches
+libpowerd/*.pc
@@ -0,0 +1,136 @@
+# @@@LICENSE
+#
+# Copyright (c) 2007-2012 Hewlett-Packard Development Company, L.P.
+#
+# 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.
+#
+# LICENSE@@@
+
+#
+# powerd/CMakeLists.txt
+#
+
+
+cmake_minimum_required(VERSION 2.6)
+
+project(powerd)
+
+set(POWERD_API_VERSION_MAJOR 4)
+set(POWERD_API_VERSION_MINOR 0)
+set(POWERD_API_VERSION_PATCH 0)
+set(POWERD_LIBRARY_VERSION "${POWERD_API_VERSION_MAJOR}.${POWERD_API_VERSION_MINOR}.${POWERD_API_VERSION_PATCH}")
+set(POWERD_LIBRARY_NAME "${CMAKE_PROJECT_NAME}")
+
+# Make sure the build system's version of this component matches what we're building.
+# The intent is for it to pass in POWERD_COMPONENT_VERSION via the command line.
+if(DEFINED POWERD_COMPONENT_VERSION)
+ if (NOT (POWERD_LIBRARY_VERSION STREQUAL POWERD_COMPONENT_VERSION))
+ message(FATAL_ERROR "Component version from build system (${POWERD_COMPONENT_VERSION}) != library version (${POWERD_LIBRARY_VERSION})")
+ endif()
+endif()
+
+# XXX Why is CMAKE_BUILD_TYPE empty under Ubuntu?
+if(NOT CMAKE_BUILD_TYPE)
+ set (CMAKE_BUILD_TYPE "Release")
+endif()
+
+if(NOT DEFINED ENV{PKG_CONFIG_PATH})
+ set(ENV{PKG_CONFIG_PATH} "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
+endif()
+
+if(CMAKE_INSTALL_PREFIX STREQUAL "/usr")
+ set(SYSCONFDIR_FULL "/etc")
+else()
+ set(SYSCONFDIR_FULL "${CMAKE_INSTALL_PREFIX}/etc")
+endif()
+
+message("")
+
+message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+message(STATUS "CMAKE_FIND_ROOT_PATH: ${CMAKE_FIND_ROOT_PATH}")
+message(STATUS "ENV{PKG_CONFIG_PATH}: $ENV{PKG_CONFIG_PATH}")
+message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
+
+# Note that TARGET_CORE_OS is no longer used, but keep it around in case it turns out to be needed later.
+set(DEFAULT_TARGET_CORE_OS "ubuntu" CACHE INTERNAL "The default core OS for which to build")
+
+# Should specify a core OS (ubuntu, rockhopper, etc.)
+if(TARGET_CORE_OS)
+ message(STATUS "TARGET_CORE_OS: ${TARGET_CORE_OS}")
+else()
+ set(TARGET_CORE_OS "${DEFAULT_TARGET_CORE_OS}")
+ message(STATUS "No TARGET_CORE_OS value specified -- defaulting to ${TARGET_CORE_OS}")
+endif()
+set(TARGET_CORE_OS ${TARGET_CORE_OS} CACHE STRING "The core OS for which to build")
+
+message("")
+
+
+macro(add_flags flags)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flags}")
+endmacro()
+
+macro(add_linker_flags flags)
+ # Appending to CMAKE_EXE_LINKER_FLAGS fails to add them to the link command line -- why?
+ # Note that using add_definitions() also fails to add to the link command line.
+ add_flags("${flags}")
+endmacro()
+
+
+include(FindPkgConfig)
+
+# Check that we have glib-2.0
+pkg_check_modules(GLIB2 REQUIRED glib-2.0)
+add_definitions(${GLIB2_CFLAGS})
+
+# Check that we have luna-service2
+pkg_check_modules(LUNASERVICE2 REQUIRED luna-service2)
+add_definitions(${LUNASERVICE2_CFLAGS})
+
+# luna-service2 requires cjson; make sure it's available
+pkg_check_modules(CJSON REQUIRED cjson)
+add_definitions(${CJSON_CFLAGS})
+
+
+# Specifying this causes "warning: 'struct timespec' declared inside parameter list" in libpowerd/clock.h.
+#add_definitions("-std=c99")
+
+# Turn on all useful warnings, but don't specify -Werror -- having warnings break the build makes
+# switching to a new compiler a lengthy and painful ordeal.
+add_definitions("-Wall")
+
+# Specify which symbols are to be exported
+# TODO: Create this
+#add_linker_flags("-Wl,--version-script=${PROJECT_SOURCE_DIR}/src/${POWERD_LIBRARY_NAME}Exports.map")
+
+# Require that all undefined symbols are satisfied by the libraries from target_link_libraries()
+add_linker_flags("-Wl,--no-undefined")
+# XXX_ The libraries that come with gcc fail when --no-allow-shlib-undefined is specified
+#add_linker_flags("-Wl,--no-allow-shlib-undefined")
+
+
+add_subdirectory(libpowerd)
+add_subdirectory(powerd)
+
+
+# This adds a target called "docs" (i.e., make docs). doxygen and dot
+# (from graphviz) are expected to be available.
+# ${PROJECT_BINARY_DIR} is the build directory and ${PROJECT_SOURCE_DIR}
+# is the source directory.
+configure_file(${PROJECT_SOURCE_DIR}/doc/Doxyfile.in
+ ${PROJECT_BINARY_DIR}/doc/Doxyfile)
+
+add_custom_target(docs
+ doxygen ${PROJECT_BINARY_DIR}/doc/Doxyfile
+ SOURCES ${PROJECT_SOURCE_DIR}/doc/Doxyfile.in
+ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc)
108 README.md
@@ -0,0 +1,108 @@
+powerd
+======
+Powerd is one of the primary daemons that is started when webOS boots. It is responsible for monitoring battery parameters like temperature, current, voltage and other inputs, and making decisions about battery charging. It interfaces with the underlying hardware using the Nyx client library, talking to the battery and charger modules for the platform. At the same time it exposes the battery and charging information to the upper layers through the Luna Service Bus. Powerd also has the capability to run the necessary CTIA checks for temperature limits on the platform.
+
+How to Build on Linux
+=====================
+
+## Dependencies
+
+Below are the tools and libraries (and their minimum versions) required to build powerd:
+
+* cmake 2.6
+* gcc 4.3
+* glib-2.0 2.16.6
+* make (any version)
+* openwebos/cjson 1.8.0
+* openwebos/luna-service2 3.0.0
+* openwebos/nyx-lib 2.0.0 RC 2
+* pkg-config 0.22
+
+
+## Building
+
+Once you have downloaded the source, execute the following to build it:
+
+ $ mkdir BUILD
+ $ cd BUILD
+ $ cmake ..
+ $ make
+ $ sudo make install
+
+The header files will be installed under
+
+ /usr/local/include/powerd
+
+the libraries and pkg-config file under
+
+ /usr/local/lib
+
+the daemon under
+
+ /usr/local/sbin
+
+the default preferences file under
+
+ /usr/local/etc/default
+
+and the upstart script under
+
+ /usr/local/etc/event.d
+
+You can install it elsewhere by supplying a value for _CMAKE\_INSTALL\_PREFIX_ when invoking _cmake_. For example:
+
+ $ cmake -D CMAKE_INSTALL_PREFIX:STRING=$HOME/projects/openwebos ..
+ $ make
+ $ make install
+
+will install the files in subdirectories of $HOME/projects/openwebos instead of subdirectories of /usr/local.
+
+Specifying _CMAKE\_INSTALL\_PREFIX_ also causes the pkg-config files under it to be used to find headers and libraries. To have _pkg-config_ look in a different tree, set the environment variable PKG_CONFIG_PATH to the path to its _lib/pkgconfig_ subdirectory.
+
+## Uninstalling
+
+From the directory where you originally ran _make install_, invoke:
+
+ $ sudo xargs rm < install_manifest.txt
+
+## Generating documentation
+
+The tools required to generate the documentation are:
+
+* doxygen 1.6.3
+* graphviz 2.20.2
+
+Once you have run _cmake_, execute the following to generate the documentation:
+
+ $ make docs
+
+To view the generated HTML documentation, point your browser to
+
+ doc/html/index.html
+
+## Linking against libpowerd
+
+If your system has pkg-config then you can just add this to your makefile:
+
+ CFLAGS += $(shell pkg-config --cflags powerd)
+ LDFLAGS += $(shell pkg-config --libs powerd)
+
+# Copyright and License Information
+
+All content, including all source code files and documentation files in this repository are:
+
+ Copyright (c) 2007-2012 Hewlett-Packard Development Company, L.P.
+
+All content, including all source code files and documentation files in this repository are:
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this content 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.
+
Oops, something went wrong.

0 comments on commit fbf56b4

Please sign in to comment.