Functions

device_tree_get_compatibles (sysfs_root)

error_quark ()

init ()

svg_path_get_bounding_box (path, x1, x2, y1, y2)

timeout_add_seconds_once (priority, seconds, function, *data)

Details

Gm.device_tree_get_compatibles(sysfs_root)
Parameters:

sysfs_root (str) – Path where /sys is mounted. Defaults to /sys if None is passed.

Raises:

GLib.Error

Returns:

compatible machine types or None

Return type:

[str]

Read compatible machine types from sysfs_root/firmware/devicetree/base/compatible on Linux. If the path doesn’t exist or host is not Linux return None.

For debugging purposes GMOBILE_DT_COMPATIBLES can be set to a : separated list of compatibles which will be returned instead.

New in version 0.0.1.

Gm.error_quark()
Returns:

a #GQuark.

Return type:

int

Gets the GM Error Quark.

New in version 0.0.1.

Gm.init()

Call this function to initialize the library explicitly. This makes the embedded device information available.

New in version 0.0.1.

Gm.svg_path_get_bounding_box(path, x1, x2, y1, y2)
Parameters:
  • path (str) – An SVG path

  • x1 (int) – The lower x coordinate

  • x2 (int) – The upper x coordinate

  • y1 (int) – The lower y coordinate

  • y2 (int) – The upper x coordinate

Raises:

GLib.Error

Returns:

TRUE when parsing was successful, FALSE otherwise.

See https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths for path syntax introduction.

Return type:

bool

Returns the bounding box of an SVG path. As this is meant for display cutouts we operate on integer (whole pixel) values. When parsing fails, FALSE is returned and error contains the error information.

New in version 0.0.1.

Gm.timeout_add_seconds_once(priority, seconds, function, *data)
Parameters:
Returns:

the ID (greater than 0) of the event source.

Return type:

int

Sets a function to be called after a timeout with priority priority. Correctly calculates the timeout even when the system is suspended in between.

This internally creates a main loop source using GLib.timeout_source_new_seconds() and attaches it to the main loop context using GLib.Source.attach().

The timeout given is in terms of CLOCK_BOOTTIME time, it hence is also correct across suspend and resume. If that doesn’t matter use g_timeout_add_seconds_full instead.

Note that glib’s g_timeout_add_seconds() doesn’t take system suspend/resume into account: https://gitlab.gnome.org/GNOME/glib/-/issues/2739

New in version 0.0.1.