Skip to content

Commit

Permalink
webOS Open Source Edition initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
Changhyeok Bae committed Mar 12, 2018
0 parents commit 3cb9f78
Show file tree
Hide file tree
Showing 52 changed files with 10,000 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright (c) 2010-2018 LG Electronics, Inc.
#
# 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.
#
# SPDX-License-Identifier: Apache-2.0

# Build/compile products
cscope.out
*.so
*.o
*.d
*.so
.cscope.files
.sc_status
*.swp
Debug/
/patches
*.DS_Store
*.bak

# Build and documentation directories.
/build*
/BUILD*
/doc*

# Eclipse related files
.project
.cproject
/.settings
36 changes: 36 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright (c) 2010-2018 LG Electronics, Inc.
#
# 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.
#
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 2.8.7)

project(nyx-modules)

include(webOS/webOS)
include(FindPkgConfig)

webos_modules_init(1 6 2)
webos_component(7 1 0)
webos_test_provider(GLIB_TEST)
webos_include_install_paths()

pkg_check_modules(PMLOG REQUIRED PmLogLib)
include_directories(${PMLOG_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${PMLOG_CFLAGS_OTHER})

include_directories(include/internal)

webos_nyx_module_provider(OW BATTERY CHARGER DEVICEINFO OSINFO SYSTEM DISPLAY SECURITY SECURITY2)
add_subdirectory(src)
103 changes: 103 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
nyx-modules
===========

Summary
-------
Open webOS portability layer - device specific modules

Description
-----------

The nyx-modules repository is a collection of device specific modules for supporting different functionalities like charging, display, keypad, touchscreen. Currently it supports the emulator versions (qemux86 and qemuarm). However it is extensible in design to add modules for any new device.

How to Build on Linux
=====================

## Dependencies

Below are the tools and libraries (and their minimum versions) required to build nyx-modules:

* cmake (version required by cmake-modules-webos)
* cmake-modules-webos 1.0.0 RC4
* gcc 4.6.3
* glib-2.0 2.32.1
* make (any version)
* nyx-lib 7.3.0
* pkg-config 0.26
* pmloglib 3.3.0

Below is the component (and its minimum version) required to run nyx-modules:
* lsb 4.1

## Building

Once you have downloaded the source, enter the following to build it (after
changing into the directory under which it was downloaded):

$ mkdir BUILD
$ cd BUILD
$ cmake -DNYX_MODULES_REQUIRED="NYXMOD_OW_DISPLAY" ..
$ make
$ sudo make install

The directory under which the files are installed defaults to `/usr/local/webos`.
You can install them elsewhere by supplying a value for `WEBOS_INSTALL_ROOT`
when invoking `cmake`. You'll also need to tell cmake which Nyx modules to build
by supplying a semicolon-separated value for `NYX_MODULES_REQUIRED`. For example:

$ cmake -D WEBOS_INSTALL_ROOT:PATH=$HOME/projects/webosose -DNYX_MODULES_REQUIRED="NYXMOD_OW_DISPLAY;NYXMOD_OW_DEVICEINFO;NYXMOD_OW_OSINFO" ..
$ make
$ make install

will install the files in subdirectories of `$HOME/projects/webosose`.

Note that only modules in the "generic" subdir will build on/for the desktop,
unless you override the value of WEBOS_TARGET_CORE_OS. For example:

$ cmake -D WEBOS_INSTALL_ROOT:PATH=$HOME/projects/webosose -DNYX_MODULES_REQUIRED="NYXMOD_OW_CHARGER" -DWEBOS_TARGET_CORE_OS=rockhopper ..

Specifying `WEBOS_INSTALL_ROOT` also causes `pkg-config` to look in that tree
first before searching the standard locations. You can specify additional
directories to be searched prior to this one by setting the `PKG_CONFIG_PATH`
environment variable.

If not specified, `WEBOS_INSTALL_ROOT` defaults to `/usr/local/webos`.

To configure for a debug build, enter:

$ cmake -D CMAKE_BUILD_TYPE:STRING=Debug ..

To see a list of the make targets that `cmake` has generated, enter:

$ make help

## Uninstalling

From the directory where you originally ran `make install`, enter:

$ [sudo] make uninstall

You will need to use `sudo` if you did not specify `WEBOS_INSTALL_ROOT`.

# Copyright and License Information

Unless otherwise specified, all content, including all source code files and
documentation files in this repository are:

Copyright (c) 2010-2018 LG Electronics, Inc.

Unless otherwise specified or set forth in the NOTICE file, 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.

SPDX-License-Identifier: Apache-2.0
18 changes: 18 additions & 0 deletions astyle_options
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
style=ansi
indent=tab=4
indent-switches
indent-namespaces
indent-col1-comments
break-blocks
pad-oper
pad-header
unpad-paren
align-pointer=name
align-reference=name
add-brackets
convert-tabs
close-templates
break-after-logical
max-code-length=80
lineend=linux

71 changes: 71 additions & 0 deletions include/internal/msgid.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Copyright (c) 2016-2018 LG Electronics, Inc.
//
// 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.
//
// SPDX-License-Identifier: Apache-2.0

#ifndef __NYX__MODULES__MESSAGE__LOG_H__
#define __NYX__MODULES__MESSAGE__LOG_H__

/** Utils*/
#define MSGID_NYX_MOD_GET_STRING_ERR "NYXUTIL_GET_STRING_ERR"
#define MSGID_NYX_MOD_GET_DOUBLE_ERR "NYXUTIL_GET_DOUBLE_ERR"
#define MSGID_NYX_MOD_GET_STRTOD_ERR "NYXUTIL_GET_STRTOD_ERR"
#define MSGID_NYX_MOD_SYSFS_ERR "NYXUTIL_SYSFS_ERR"
#define MSGID_NYX_MOD_GET_DIR_ERR "NYXUTIL_GET_DIR_ERR"

/** Battery*/
#define MSGID_NYX_MOD_UDEV_ERR "NYXBAT_UDEV_ERR"
#define MSGID_NYX_MOD_UDEV_MONITOR_ERR "NYXBAT_UDEV_MONITOR_ERR"
#define MSGID_NYX_MOD_UDEV_SUBSYSTEM_ERR "NYXBAT_UDEV_SUBSYSTEM_ERR"
#define MSGID_NYX_MOD_UDEV_RECV_ERR "NYXBAT_UDEV_RECV_ERR"
#define MSGID_NYX_MOD_BATT_OPEN_ALREADY_ERR "NYXBAT_OPEN_ALREADY_ERR"
#define MSGID_NYX_MOD_BATT_OPEN_ERR "NYXBAT_OPEN_ERR"
#define MSGID_NYX_MOD_BATT_OUT_OF_MEMORY "NYXBAT_OUT_OF_MEM"

/** Charger*/
#define MSGID_NYX_MOD_CHARG_ERR "NYXCHG_ERR"
#define MSGID_NYX_MOD_NETLINK_ERR "NYXCHG_NETLINK_ERR"
#define MSGID_NYX_MOD_CHR_SUB_ERR "NYXCHR_SUB_ERR"
#define MSGID_NYX_MOD_ENABLE_REV_ERR "NYXCHG_ENABLE_REV_ERR"
#define MSGID_NYX_MOD_CHARG_OPEN_ERR "NYXCHG_OPEN_ERR"
#define MSGID_NYX_MOD_CHARG_OUT_OF_MEMORY "NYXCHG_OUT_OF_MEM"

/** Device info generic*/
#define MSGID_NYX_MOD_OPEN_NDUID_ERR "NYXDEV_OPEN_NDUID_ERR"
#define MSGID_NYX_MOD_READ_NDUID_ERR "NYXDEV_READ_NDUID_ERR"
#define MSGID_NYX_MOD_WRITE_NDUID_ERR "NYXDEV_WRITE_NDUID_ERR"
#define MSGID_NYX_MOD_CHMOD_ERR "NYXDEV_CHMOD_ERR"
#define MSGID_NYX_MOD_MALLOC_ERR1 "NYXDEV_OOM1_ERR"
#define MSGID_NYX_MOD_MALLOC_ERR2 "NYXDEV_OOM2_ERR"
#define MSGID_NYX_MOD_URANDOM_ERR "NYXDEV_URANDOM_ERR"
#define MSGID_NYX_MOD_URANDOM_OPEN_ERR "NYXDEV_URANDOM_OPEN_ERR"
#define MSGID_NYX_MOD_MEMINFO_OPEN_ERR "NYXDEV_MEMINFO_OPEN_ERR"
#define MSGID_NYX_MOD_STORAGE_ERR "NYXDEV_STORAGE_ERR"
#define MSGID_NYX_MOD_DEV_INFO_OPEN_ERR "NYXDEV_INFO_OPEN_ERR"

/*Display lib open*/
#define MSGID_NYX_MOD_DISP_OPEN_ALREADY_ERR "NYXDIS_OPEN_ALREADY_ERR"
#define MSGID_NYX_MOD_DISP_OPEN_ERR "NYXDIS_OPEN_ERR"
#define MSGID_NYX_MOD_DISP_OUT_OF_MEMORY "NYXDIS_OUT_OF_MEM"

/*Security lib open*/
#define MSGID_NYX_MOD_SECU_OPEN_ERR "NYXSEC_OPEN_ERR"
#define MSGID_NYX_MOD_SECU_OUT_OF_MEMORY "NYXSEC_OUT_OF_MEM"

/*System */
#define MSGID_NYX_MOD_SYSTEM_OUT_OF_MEMORY "NYXSYS_OUT_OF_MEM"
#define MSGID_NYX_MOD_SYSTEM_OPEN_ERR "NYXSYS_OPEN_ERR"


#endif // __NYX__MODULES__MESSAGE__LOG_H__
84 changes: 84 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Copyright (c) 2010-2018 LG Electronics, Inc.
#
# 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.
#
# SPDX-License-Identifier: Apache-2.0

webos_machine_dep()
webos_machine_impl_dep()
webos_core_os_dep()

include(FindPkgConfig)

pkg_check_modules(GLIB2 REQUIRED glib-2.0)
include_directories(${GLIB2_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${GLIB2_CFLAGS_OTHER})

pkg_check_modules(NYXLIB REQUIRED nyx>=7.3)
include_directories(${NYXLIB_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${NYXLIB_CFLAGS_OTHER})

pkg_check_modules(LIBCRYPTO REQUIRED libcrypto)
include_directories(${LIBCRYPTO_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${LIBCRYPTO_CFLAGS_OTHER})

pkg_check_modules(GIO REQUIRED gio-2.0)
include_directories(${GIO_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${GIO_CFLAGS_OTHER})

if(NYXMOD_OW_BATTERY OR NYXMOD_OW_CHARGER)
pkg_check_modules(UDEV REQUIRED libudev)
include_directories(${UDEV_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${UDEV_CFLAGS_OTHER})
endif()

webos_add_linker_options(ALL --no-undefined --as-needed)
webos_add_compiler_flags(ALL -Wall -g -std=c99)
webos_add_compiler_flags(ALL -D_GNU_SOURCE=1)
webos_add_compiler_flags(DEBUG -O0 -DDEBUG -D_DEBUG)
webos_add_compiler_flags(RELEASE -DNDEBUG)

if(NYXMOD_OW_BATTERY)
add_subdirectory(battery)
endif()

if(NYXMOD_OW_CHARGER)
add_subdirectory(charger)
endif()

if(NYXMOD_OW_DEVICEINFO)
add_definitions(-DWEBOS_TARGET_MACHINE="${WEBOS_TARGET_MACHINE}")
add_definitions(-DDEVICEINFO_PRODUCT_NAME="${WEBOS_TARGET_MACHINE}")
add_subdirectory(device_info)
endif()

if(NYXMOD_OW_DISPLAY)
add_subdirectory(display)
endif()

if(NYXMOD_OW_SECURITY)
add_subdirectory(security)
endif()

if(NYXMOD_OW_SECURITY2)
add_subdirectory(security2)
endif()

if(NYXMOD_OW_SYSTEM)
add_subdirectory(system)
endif()

if(NYXMOD_OW_OSINFO)
# set(ENCRYPTION_KEY_TYPE "" CACHE STRING "Encryption key type")
add_subdirectory(os_info)
endif()
21 changes: 21 additions & 0 deletions src/battery/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) 2010-2018 LG Electronics, Inc.
#
# 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.
#
# SPDX-License-Identifier: Apache-2.0

include_directories(../utils)
webos_build_nyx_module(BatteryMain
SOURCES batterylib.c battery.c ../utils/utils.c
LIBRARIES ${GLIB2_LDFLAGS} ${PMLOG_LDFLAGS} ${NYXLIB_LDFLAGS} ${UDEV_LDFLAGS} -lrt -lpthread)
add_subdirectory(tests)
Loading

0 comments on commit 3cb9f78

Please sign in to comment.