egd_get_cap man page
egd_get_cap — Query various information about the device capabilities
int egd_get_cap(const struct eegdev* dev, int cap, void* val);
egd_get_cap() returns the information about the capability specified by cap of the recording device referenced by dev by the mean of the pointer val.
The type of pointer passed through val is dependent on the requested capability cap which can be one the following (The expected type pointed by val is provided in parenthesis):
- EGD_CAP_FS (int)
Sampling frequency that is currently set. The same value is returned by the function.
- EGD_CAP_TYPELIST (const int*)
Array of sensor types sampled by the device terminated by -1. These values became valid as argument for egd_sensor_name(3) when opening the device dev if they were not yet before. The number of elements in the array (excluding the -1 element) is provided by the return value of the function.
- EGD_CAP_DEVTYPE (const char*)
Null terminated string describing the type of the recording device (Manufacturer and model if dev refers to actual hardware). The length of string (excluding the null character) is provided by the return value of the function.
- EGD_DEVID (const char*)
Null-terminated string describing the model of the recording device (or an unique identifier of the resource). The length of string (excluding the null character) is provided by the return value of the function.
In case of success, the function returns a positive value depending on the requested capability. Otherwise, -1 is returned and errno is set accordingly.
egd_get_cap() will fail if:
dev is NULL, cap is not valid value or val is NULL while cap is not EGD_CAP_FS.