Cosmetic change to apply code formatting

:Release Notes:
All source code is now formatted in a consistent manner, including
applying the tabs to indent, spaces to align convention.

:Detailed Notes:
The code formatting program 'Artistic Style' was used to clean up
any inconsistent formatting prior to making subsequent changes in
the code.

The applied options are available in the new file 'astyle_options'.

:Testing Performed:
- Checked output of git diff -w -b --ignore-balnk-lines
- Check component still compiles
- With 'ignore whitespace=all' set, scrubbed gerrit code review

:QA Notes:

:Issues Addressed:
[GF-36641] Apply Artistic Style with standard options to nyx-modules

Open-webOS-DCO-1.0-Signed-off-by: Keith Derrick <keith.derrick@lge.com>

Change-Id: If0c0c9eb1127620189a87827e6e2ca067a0d4f82
Reviewed-on: https://g2g.palm.com/3339
Reviewed-by: Build Verification
Reviewed-by: Martin Jansa <Martin.Jansa@lge.com>
Tested-by: Martin Jansa <Martin.Jansa@lge.com>
Reviewed-by: Keith Derrick <keith.derrick@lge.com>
Implement query for NYX_OS_INFO_WEBOS_PRERELEASE

:Release Notes:
The OSInfo module now returns a build-provided value for the
NYX_OS_INFO_WEBOS_PRERELEASE query.

:Detailed Notes:
Each <distro>.conf will make an assignment to WEBOS_DISTRO_PRERELEASE
variable. When it's unset (i.e., "" has been assigned to it), the
NYX_OS_INFO_WEBOS_PRERELEASE query should return ""; otherwise, it
should return its value.

:Testing Performed:
Tested query with and without WEBOS_DISTRO_PRERELEASE set before
building nyx-modules.

:QA Notes:

:Issues Addressed:
[GF-2855] nyx-modules: Replace NYX_OS_INFO_WEBOS_PRERELEASE with a real
          value

Open-webOS-DCO-1.0-Signed-off-by: Keith Derrick <keith.derrick@lge.com>

Change-Id: I2e5601265ead260ebb9b0e8c1635730cc452ca0e
Reviewed-on: https://g2g.palm.com/3340
Reviewed-by: Build Verification
Reviewed-by: Keith Derrick <keith.derrick@lge.com>
Tested-by: Keith Derrick <keith.derrick@lge.com>
Reviewed-by: Martin Jansa <Martin.Jansa@lge.com>
Tested-by: Martin Jansa <Martin.Jansa@lge.com>
Remove parameter from nyx_system_erase_partition()

:Release Notes:
The nyx_system_erase_partition method API has changed to avoid buffer
overflow errors.

This API change takes nyx-lib (and its modules) to v6.0.0 .

:Detailed Notes:
The nyx_system_erase_partition method had an "error message" parameter
of type `char *`. The original intent was to return an error message
through the pointer. However, without a buffer length parameter, there
is simply no safe way to implement that.

Alternatives were to either change it a 'char **' and return a
dynamically allocated buffer (which raises the possibility of memory
leaks), add a buffer length parameter (which seems a bit unnecessary
overhead for an unlikley error condition), or simply delete the
parameter from the API.

As the method already has an error code return value, the third option
was taken.

:Testing Performed:
Currently, nothing is using this method, so the only testing required
is clean compilation.

:QA Notes:

:Issues Addressed:
[GF-37730] Provide implementation of Nyx System module to support
           factory reset

Open-webOS-DCO-1.0-Signed-off-by: Keith Derrick <keith.derrick@lge.com>
Change-Id: Icd9be116e99255da89dd1d504555fa2913971e50
Reviewed-on: https://g2g.palm.com/3562
Reviewed-by: Build Verification
Reviewed-by: Herb Kuta <herb.kuta@lge.com>
Reviewed-by: Keith Derrick <keith.derrick@lge.com>
Tested-by: Keith Derrick <keith.derrick@lge.com>
keys: split out common key handling code from emulator module

It makes no sense to have the same code in more than one module so we're splitting out the
common input device handling code and just put the specific key handling into module
specific code section.

Open-webOS-DCO-1.0-Signed-off-by: Simon Busch <morphis@gravedo.de>
keys: add device specific implementation

For real target devices there is only a small subset of keys we're able to use. This is
known handled and mapped within a device specific implementation which is separated from
the emulator one.

Open-webOS-DCO-1.0-Signed-off-by: Simon Busch <morphis@gravedo.de>
touchpanel: make emulator implementation common for every device

Open-webOS-DCO-1.0-Signed-off-by: Simon Busch <morphis@gravedo.de>
touchpanel: build module for every device when selected

Open-webOS-DCO-1.0-Signed-off-by: Simon Busch <morphis@gravedo.de>
system: use a flat directory structure to have same code for all machines

If there need to be specific implementations for different machines then this should be
separated from the main module code which should mostly be the same for all needed
implementations.

Open-webOS-DCO-1.0-Signed-off-by: Simon Busch <morphis@gravedo.de>
battery: split out common file handling methods into separate source file

Having common functionality separated from the specific ones makes it easier to implement
for a target device which is not the emulator. Both can still share the same common
functionality.

Open-webOS-DCO-1.0-Signed-off-by: Simon Busch <morphis@gravedo.de>
battery: add a device specific implementation

The implementation is based on the common linux power supply interface and is detected
changes to the current status with processing uevents due to the use of libudev.

Open-webOS-DCO-1.0-Signed-off-by: Simon Busch <morphis@gravedo.de>
charger: split out common module functionality

With splitting out common module functionality we're now able to add different
implementations for the charger module. For target emulator machines this is still the
same dummy implementation as before.

Open-webOS-DCO-1.0-Signed-off-by: Simon Busch <morphis@gravedo.de>
charger: add a device implementation for charger status detection

The device implementation is based on the common linux power supply interface and is per
default enabled to detect changes for AC and USB chargers. It's using libudev to detect
a changed charger status.

Open-webOS-DCO-1.0-Signed-off-by: Simon Busch <morphis@gravedo.de>
machine: add support for the tuna machine

Open-webOS-DCO-1.0-Signed-off-by: Simon Busch <morphis@gravedo.de>
system: rtc: correctly deal with glib io watches and channels

This fixes a rather serios problem with rtc poll handling. When a watch is added to the
glib mainloop it references internally a file descriptor to pass it later to the poll
function (see poll(2)). Every watch gets an id which should be used by the user to refer
to the watch whenever needed. When the io channel is destroyed the watch should be remove
from the mainloop as well. If this isn't done probably by the user it will cause the
internal list of fds which are passed to the poll function to exceed the maximum of 256.
This finally results in poll returning EINVAL as error code.

2012-11-09T19:24:24.809509Z [5146] tuna user.warning sleepd: poll(2) failed due to:
Invalid argument.

GLib doesn't handle this very well and will take 100% CPU usage when this occurs.

This patch adds the correct removal of the watch from the glib mainloop when it's not
needed anymore. Furthermore the watch isn't added again when it or the channel is still
valid.

Open-webOS-DCO-1.0-Signed-off-by: Simon Busch <morphis@gravedo.de>
machine: add support for the grouper device

Open-WebOS-DCO-1.0-Signed-Off-By: Simon Busch <morphis@gravedo.de>
als_tuna: add implementation of the ambient light sensor of the tuna device

Open-webOS-DCO-1.0-Signed-off-by: Simon Busch <morphis@gravedo.de>
led_controller: initial code for a common led controller module

The current implementation only provides support for setting the backlight brightness and
disabling/enabling the backlight when needed. Further effect implementation is missing.

The implementation internally uses udev to determine the backlight device of the system.

Open-webOS-DCO-1.0-Signed-off-by: Simon Busch <morphis@gravedo.de>
tests: add simple test application for the led_controller module

Open-webOS-DCO-1.0-Signed-off-by: Simon Busch <morphis@gravedo.de>
led_controller: return proper callback status when set brightness operation fails

Open-webOS-DCO-1.0-Signed-off-by: Simon Busch <morphis@gravedo.de>
haptics_timedoutput: implementation based on a linux timedoutput class device

Open-webOS-DCO-1.0-Signed-off-by: Simon Busch <morphis@gravedo.de>