Did you know ... Search Documentation:
Pack sysfs -- prolog/sysfs.pl
PublicShow source

This module provides predicates to access the sysfs virtual file system in Linux. It allows developers to find the path to sysfs class directories and files in those directories. The predicates are designed to be flexible and can be used in various ways to access sysfs information.

author
- Roy Ratcliffe
version
- 1.0
license
- MIT
 sysfs_entry(+Class, -Entry, ?Entries:list) is nondet
True when Entry is a directory entry in the sysfs class Class, and Entries is the list of all nested directory entries in that class. For example, sysfs_entry(gpio, Entry, Entries) will unify Entry with each entry in the /sys/class/gpio directory, and Entries with the list of all nested entries in that directory.

Spans the sysfs virtual file system to find directory entries for a given class non-deterministically. Leaves a choice point even after finding an entry, so that backtracking can find all entries in the class.

Arguments:
Class- is the name of the sysfs class, such as gpio, block, net, etc.
Entry- is a directory entry in the specified class.
Entries- is the list of all nested directory entries in the specified class.
 sysfs_exported_with_time_limit(+File, -Abs, +Options:list) is semidet
True when File is a file in the sysfs virtual file system that is exported and accessible, and Abs is the absolute path of that file. The predicate will sleep for the specified delay time and retry until the time limit is reached.

This predicate amounts to absolute_file_name/3 with a time limit and delay time. It is useful for checking if a file in the sysfs virtual file system is exported and accessible, without blocking indefinitely.

Arguments:
File- is the name of the file to check.
Abs- is the absolute path of the file if it exists and is accessible.
Options- is a list of options to pass to absolute_file_name/3. If the file exists and is accessible, sysfs_exported_with_time_limit will succeed. If the file does not exist or is not accessible, it will sleep for the specified delay time and retry until the time limit is reached.