{{{#!html

  1. Gateworks Utility Library
    1. Overview
    2. Requirements
      1. Exporting
      2. Registering
    3. Code Examples
    4. Attachments

Gateworks Utility Library

Overview

In order to provide users with easy access to the ventana family's low level linux functionality, Gateworks has composed a java library that exposes some simple methods for interacting with LEDs, GPIOs, PWMs, and hardware monitors that have been exported and registered in the android property system.

The source for the library is available on Github at Gateworks/android_packatges_apps_gateworksutil and the javadoc created api documentation can be found here.

Requirements

In order for the library to function as intended, all low level controllers must be both exported and registered prior to runtime.

Note that this is done by the Gateworks Android init script /device/gateworks/ventana/init.sh which is installed to /system/bin/init.sh and run as root on bootup for the standard resources on the various Ventana boards.

Exporting

Since the GateworksUtil library depends on access to the controller's associated sysfs structure, all GPIOs, PWMs, and LEDs must first be exported to userspace before they can be used. For further information on exporting see the following pages:

Registering

In addition, the low level controllers being used must also be registered in the Android System Property list. This can be done a number of ways:

  1. The command line tool setprop via setprop my.property value
  2. Modifying the /device/gateworks/ventana/init.sh script of the device to register a new controller
  3. With native C function property_get from system/core/include/cutils/properties.h
  4. With the java class android.os.SystemProperties (see Android Google Source)

*Note: the android.os.SystemProperties class is only accessible to the internal android source SDK.

For further information on registering see the Android Properties section of the Android OS Development page.

Code Examples

While the full source for the library is available on Github at Gateworks/android_packatges_apps_gateworksutil and the javadoc created api documentation can be found here sometimes a few simple examples can be extremely helpful.

Code snippets and notes:

Attachments

The file links below include the following: