## AsSystemInfo

AsSystemInfo — Read information about the current OS and device.

## Functions

GQuark | as_system_info_error_quark ()
AsSystemInfo * | as_system_info_new ()
const gchar * | as_system_info_get_os_id ()
const gchar * | as_system_info_get_os_cid ()
const gchar * | as_system_info_get_os_name ()
const gchar * | as_system_info_get_os_version ()
const gchar * | as_system_info_get_os_homepage ()
const gchar * | as_system_info_get_kernel_name ()
const gchar * | as_system_info_get_kernel_version ()
gulong | as_system_info_get_memory_total ()
GPtrArray * | as_system_info_get_modaliases ()
const gchar * | as_system_info_modalias_to_syspath ()
gboolean | as_system_info_has_device_matching_modalias ()
gchar * | as_system_info_get_device_name_for_modalias ()
AsCheckResult | as_system_info_has_input_control ()
void | as_system_info_set_input_control ()
gulong | as_system_info_get_display_length ()
void | as_system_info_set_display_length ()
gchar * | as_get_current_distro_component_id ()

## Types and Values

#define | AS_TYPE_SYSTEM_INFO
struct | AsSystemInfoClass
enum | AsSystemInfoError
#define | AS_SYSTEM_INFO_ERROR
| AsSystemInfo

## Includes

    #include <appstream.h>

## Description

This class reads information about the current operating system and device that AppStream is running on. It can also be used by GUI toolkits to set data that we can not automatically determine in a toolkit-independent way, such as screen dimensions.

AppStream uses this information to verify component relations (as set in requires/recommends/supports etc. tags).

See also: AsComponent

## Functions

### as_system_info_error_quark ()

    GQuark
    as_system_info_error_quark (void);

#### Returns

An error quark.

Since: 0.16.0

### as_system_info_new ()

    AsSystemInfo *
    as_system_info_new (void);

Creates a new AsSystemInfo.

#### Returns

a AsSystemInfo.

[transfer full]

Since: 0.10

### as_system_info_get_os_id ()

    const gchar *
    as_system_info_get_os_id (AsSystemInfo *sysinfo);

Get the ID of the current operating system.

#### Parameters

sysinfo | a AsSystemInfo instance. |

#### Returns

the current OS ID.

### as_system_info_get_os_cid ()

    const gchar *
    as_system_info_get_os_cid (AsSystemInfo *sysinfo);

Get the AppStream component ID of the current operating system.

#### Parameters

sysinfo | a AsSystemInfo instance. |

#### Returns

the component ID of the current OS.

### as_system_info_get_os_name ()

    const gchar *
    as_system_info_get_os_name (AsSystemInfo *sysinfo);

Get the humen-readable name of the current operating system.

#### Parameters

sysinfo | a AsSystemInfo instance. |

#### Returns

the name of the current OS.

### as_system_info_get_os_version ()

    const gchar *
    as_system_info_get_os_version (AsSystemInfo *sysinfo);

Get the version string of the current operating system.

#### Parameters

sysinfo | a AsSystemInfo instance. |

#### Returns

the version of the current OS.

### as_system_info_get_os_homepage ()

    const gchar *
    as_system_info_get_os_homepage (AsSystemInfo *sysinfo);

Get the homepage URL of the current operating system.

#### Parameters

sysinfo | a AsSystemInfo instance. |

#### Returns

the homepage of the current OS.

### as_system_info_get_kernel_name ()

    const gchar *
    as_system_info_get_kernel_name (AsSystemInfo *sysinfo);

Get the name of the current kernel, e.g. "Linux"

#### Parameters

sysinfo | a AsSystemInfo instance. |

#### Returns

the current OS kernel name

### as_system_info_get_kernel_version ()

    const gchar *
    as_system_info_get_kernel_version (AsSystemInfo *sysinfo);

Get the version of the current kernel, e.g. "6.2.0-2"

#### Parameters

sysinfo | a AsSystemInfo instance. |

#### Returns

the current kernel version

### as_system_info_get_memory_total ()

    gulong
    as_system_info_get_memory_total (AsSystemInfo *sysinfo);

Get the current total amount of physical memory in MiB.

#### Parameters

sysinfo | a AsSystemInfo instance. |

#### Returns

the current total amount of usable memory in MiB

### as_system_info_get_modaliases ()

    GPtrArray *
    as_system_info_get_modaliases (AsSystemInfo *sysinfo);

Get a list of modaliases for all the hardware on this system that has them.

#### Parameters

sysinfo | a AsSystemInfo instance. |

#### Returns

a list of modaliases on the system.

[transfer none][element-type utf8]

### as_system_info_modalias_to_syspath ()

    const gchar *
    as_system_info_modalias_to_syspath (AsSystemInfo *sysinfo,
                                        const gchar *modalias);

Receive a path in /sys for the devices with the given modalias.

#### Parameters

sysinfo | a AsSystemInfo instance. |
modalias | the modalias value to resolve. |

#### Returns

the syspath, or `NULL` if none was found.

### as_system_info_has_device_matching_modalias ()

    gboolean
    as_system_info_has_device_matching_modalias
                                   (AsSystemInfo *sysinfo,
                                    const gchar *modalias_glob);

Check if there is a device on this system that matches the given modalias glob.

#### Parameters

sysinfo | a AsSystemInfo instance. |
modalias_glob | the modalias value to to look for, may contain wildcards. |

#### Returns

`TRUE` if a matching device was found.

### as_system_info_get_device_name_for_modalias ()

    gchar *
    as_system_info_get_device_name_for_modalias
                                   (AsSystemInfo *sysinfo,
                                    const gchar *modalias,
                                    gboolean allow_fallback,
                                    GError **error);

Return a human readable device name for the given modalias. Will return the modalias again if no device name could be found, and returns `NULL` on error. If `allow_fallback` is set to `FALSE`, this function will return `NULL` and error `AS_SYSTEM_INFO_ERROR_NOT_FOUND` in case no suitable description could be found.

#### Parameters

sysinfo | a AsSystemInfo instance. |
modalias | the modalias value to resolve (may contain wildcards). |
allow_fallback | fall back to low-quality data if no better information is available |
error | a GError |

#### Returns

a human-readable device name, or `NULL` on error.

### as_system_info_has_input_control ()

    AsCheckResult
    as_system_info_has_input_control (AsSystemInfo *sysinfo,
                                      AsControlKind kind,
                                      GError **error);

Test if the current system has a specific user input control method. Returns `AS_CHECK_RESULT_UNKNOWN` if we could not test for an input control method, `AS_CHECK_RESULT_ERROR` on error and `AS_CHECK_RESULT_FALSE` if the control was not found.

#### Parameters

sysinfo | a AsSystemInfo instance. |
kind | the AsControlKind to test for. |
error | a GError |

#### Returns

`AS_CHECK_RESULT_TRUE` if control was found

### as_system_info_set_input_control ()

    void
    as_system_info_set_input_control (AsSystemInfo *sysinfo,
                                      AsControlKind kind,
                                      gboolean found);

Explicitly mark a user input control as present or not present on this system.

#### Parameters

sysinfo | a AsSystemInfo instance. |
kind | the AsControlKind to set. |
found | `TRUE` if the control should be marked as found. |

### as_system_info_get_display_length ()

    gulong
    as_system_info_get_display_length (AsSystemInfo *sysinfo,
                                       AsDisplaySideKind side);

Get the current display length for the given side kind. If the display size is unknown, this function will return 0.

#### Parameters

sysinfo | a AsSystemInfo instance. |
side | the AsDisplaySideKind to select. |

#### Returns

the display size in logical pixels.

### as_system_info_set_display_length ()

    void
    as_system_info_set_display_length (AsSystemInfo *sysinfo,
                                       AsDisplaySideKind side,
                                       gulong value_dip);

Set the current display length for the given side kind. The size needs to be in device-independent pixels, see the AppStream documentation for more information: https://freedesktop.org/software/appstream/docs/chap-Metadata.htmltag-relations-display_length

#### Parameters

sysinfo | a AsSystemInfo instance. |
side | the AsDisplaySideKind to select. |
value_dip | the length value in device-independt pixels. |

### as_get_current_distro_component_id ()

    gchar *
    as_get_current_distro_component_id (void);

Returns the component-ID of the current distribution based on contents of the `/etc/os-release` file. This function is a shorthand for `as_distro_details_get_cid`

## Types and Values

### AS_TYPE_SYSTEM_INFO

    #define AS_TYPE_SYSTEM_INFO (as_system_info_get_type ())

### struct AsSystemInfoClass

    struct AsSystemInfoClass {
    	GObjectClass parent_class;
    };

### enum AsSystemInfoError

The error type.

#### Members

AS_SYSTEM_INFO_ERROR_FAILED | Generic failure |
AS_SYSTEM_INFO_ERROR_NOT_FOUND | Information was not found. |

### AS_SYSTEM_INFO_ERROR

    #define AS_SYSTEM_INFO_ERROR				as_system_info_error_quark ()

### AsSystemInfo

    typedef struct _AsSystemInfo AsSystemInfo;