---
name: "egd_open"
section: "3"
platform: "linux"
package: "libeegdev-dev"
version: "0.2-10"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/egd_open"
---

# egd\_open(3)

Open an EEG device

## NAME

egd\_open - Open an EEG device

## SYNOPSIS

**#include \<eegdev.h\>**

**struct eegdev\* egd\_open(const char\*** *devstring***);**\

## DESCRIPTION

**egd\_open**() opens a EEG device according to the *devstring* description. If *devstring* is NULL, the first device supported by the library will be opened.

The *devstring* argument specifies the type of EEG device required to be opened and the parameters parameters which the system should be configured with (overriding defaults settings). The syntax of the string is defined in [**eegdev-open-options**(5)](/eegdev-open-options/5.md).

The syntax may change in future releases and programs should not rely on it to configure the device. It is provided only to users of the programs to select the EEG acquisition device and configure it. Programs using the eegdev library should pass the string provided by the users untouched.

*devstring* is not the only way to provides configuration information about the device to open. The configuration is read from the configuration files. The final values of the settings provided to the opening function are defined (and overriden) in the following order:

- \*

  default values

- \*

  shared configuration file

- \*

  device specific configuration file

- \*

  *devstring*

This order indicates that a setting value specified in *devstring* will always override any setting value defined by other mean.

## RETURN VALUE

The function returns a pointer to the opened EEG device in case of success. Otherwise NULL is returned *errno* is set accordingly.

## ERRORS

**egd\_open**() will fail if:

- **ENOSYS**

  the device part of *devstring* does not refer to a device supported by any of the installed eegdev plugin modules.

- **EINVAL**

  one of the option specified in *devstring* is unknown.

- **ENODEV**

  The specified device is not connected.

- **EBUSY**

  The specified device is already in use.

- **ECHILD**

  The specified device needs an auxiliary child process whose executable file cannot be found.

## ENVIRONMENT

- **EEGDEV\_PLUGINS\_DIR**

  This variable controls which folder should be search to find plugin modules. If unset, they will be searched in the subfolder **eegdev** of the installation folder of the libraries.

- **EEGDEV\_CONF\_DIR**

  This variable controls which folder should be search to find the configuration files. If unset, they will be searched in **/etc/eegdev**.

## SEE ALSO

[**egd\_close**(3)](/egd_close/3.md), [**eegdev-open-options**(5)](/eegdev-open-options/5.md)
