diff --git a/docs/reference/steam-runtime-tools.xml b/docs/reference/steam-runtime-tools.xml index 963177bdebe5c769905371e589a9864542b5bc1e..1eebb3f58343ae5973202ffd549c5248e2ff644b 100644 --- a/docs/reference/steam-runtime-tools.xml +++ b/docs/reference/steam-runtime-tools.xml @@ -12,7 +12,12 @@ </bookinfo> <chapter id="ch-sysinfo"> - <title>System information</title> + <title>General system information</title> + <xi:include href="xml/system-info.xml"/> + </chapter> + + <chapter id="ch-specific"> + <title>Specific system information</title> <xi:include href="xml/architecture.xml"/> <xi:include href="xml/library.xml"/> </chapter> diff --git a/steam-runtime-tools/glib-compat.h b/steam-runtime-tools/glib-compat.h index 51e3b08825a2d8ce3ac23c54b77c9a2daddf298f..8be74ceb731e7afe6064818d3ebee84ee4c4a2bc 100644 --- a/steam-runtime-tools/glib-compat.h +++ b/steam-runtime-tools/glib-compat.h @@ -1,3 +1,4 @@ +/*<private_header>*/ /* * Copyright © 2019 Collabora Ltd. * diff --git a/steam-runtime-tools/library-internal.h b/steam-runtime-tools/library-internal.h index 28761272dd9dca6b324cbd0a9acdd1924d6041a9..670071d63c81f041577ce47cd9e8a84385cff562 100644 --- a/steam-runtime-tools/library-internal.h +++ b/steam-runtime-tools/library-internal.h @@ -1,4 +1,4 @@ -/*< internal_header >*/ +/*<private_header>*/ /* * Copyright © 2019 Collabora Ltd. * diff --git a/steam-runtime-tools/system-info.c b/steam-runtime-tools/system-info.c index 4a6ae3f062b5b1169073d91f8fb72f91ea3dd45c..f460febb348ef5508ea9a6d9d3ff276fb9aba0c7 100644 --- a/steam-runtime-tools/system-info.c +++ b/steam-runtime-tools/system-info.c @@ -48,6 +48,17 @@ * * This is a reference-counted object: use g_object_ref() and * g_object_unref() to manage its lifecycle. + * + * The #SrtSystemInfo object is not thread-aware. It should be considered + * to be "owned" by the thread that created it. Only the thread that + * "owns" the #SrtSystemInfo may call its methods. + * Other threads may create their own parallel #SrtSystemInfo object and + * use that instead, if desired. + * + * Ownership can be transferred to other threads by an operation that + * implies a memory barrier, such as g_atomic_pointer_set() or + * g_object_ref(), but after this is done the previous owner must not + * continue to call methods. */ typedef enum @@ -202,6 +213,25 @@ srt_system_info_class_init (SrtSystemInfoClass *cls) g_object_class_install_properties (object_class, N_PROPERTIES, properties); } +/** + * srt_system_info_new: + * @expectations: (nullable) (type filename): Path to a directory + * containing details of the state that the system is expected to have + * + * Return a new #SrtSystemInfo. + * + * The @expectations directory should contain a subdirectory for each + * supported CPU architecture, named for the multiarch tuple as printed + * by `gcc -print-multiarch` in the Steam Runtime (in practice this means + * %SRT_ABI_I386 or %SRT_ABI_X86_64). + * + * The per-architecture directories may contain files whose names end with + * `.symbols`. Those files are interpreted as describing libraries that + * the runtime environment should support, in + * [deb-symbols(5)](https://manpages.debian.org/deb-symbols.5) format. + * + * Returns: (transfer full): A new #SrtSystemInfo. Free with g_object_unref() + */ SrtSystemInfo * srt_system_info_new (const char *expectations) { @@ -213,6 +243,32 @@ srt_system_info_new (const char *expectations) NULL); } +/** + * srt_system_info_can_run: + * @self: A #SrtSystemInfo object + * @multiarch_tuple: A multiarch tuple defining an ABI, as printed + * by `gcc -print-multiarch` in the Steam Runtime + * + * Check whether an executable for the given ABI can be run. + * + * For this check (and all similar checks) to work as intended, the + * contents of the `libsteam-runtime-tools-0-helpers:i386` package must + * be available in the same directory hierarchy as the + * `libsteam-runtime-tools-0` shared library, something like this: + * + * |[ + * any directory/ + * lib/ + * x86_64-linux-gnu/ + * libsteam-runtime-tools-0.so.0 + * libexec/ + * steam-runtime-tools-0/ + * i386-linux-gnu-* + * x86_64-linux-gnu-* + * ]| + * + * Returns: %TRUE if executables belonging to @multiarch_tuple can be run + */ gboolean srt_system_info_can_run (SrtSystemInfo *self, const char *multiarch_tuple) @@ -235,6 +291,17 @@ srt_system_info_can_run (SrtSystemInfo *self, return (abi->can_run == TRI_YES); } +/** + * srt_system_info_can_write_to_uinput: + * @self: a #SrtSystemInfo object + * + * Return %TRUE if the current user can write to `/dev/uinput`. + * This is required for the Steam client to be able to emulate gamepads, + * keyboards, mice and other input devices based on input from the + * Steam Controller or a remote streaming client. + * + * Returns: %TRUE if `/dev/uinput` can be opened for writing + */ gboolean srt_system_info_can_write_to_uinput (SrtSystemInfo *self) {