---
name: "nutscan_add_option_to_device"
section: "3"
platform: "linux"
package: "nut"
version: "2.8.5-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/nutscan_add_option_to_device"
---

# nutscan\_add\_option\_to\_device(3)

Add option data to the specified device.

## NAME

nutscan\_add\_option\_to\_device, nutscan\_add\_commented\_option\_to\_device - Add option data to the specified device.

## SYNOPSIS

```
        #include <nut-scan.h>
        /* Add enabled option data to the specified device. */
        void nutscan_add_option_to_device(
                nutscan_device_t * device,
                char * option_name,
                char * value);
        /* Since libnutscan version 2.5.0:
         * Add option data to the specified device with an optional comment tag
         * for options suggested, but not currently enabled for actual use. */
        void nutscan_add_commented_option_to_device(
                nutscan_device_t * device,
                char * option_name,
                char * value,
                char * comment_tag);
```

## DESCRIPTION

The nutscan\_device\_t contains the following variables:

```
nutscan_device_type_t   type;
char *          driver;
char *          alt_driver_names;
char *          port;
nutscan_options_t       opt;
struct nutscan_device * prev;
struct nutscan_device * next;
```

This is a double linked list of devices. Each *device* is described by its type, its driver name, its port and any number of optional data.

The **nutscan\_add\_option\_to\_device()** adds an optional data in the given *device*. Optional data are made of an *option\_name* and an associated *value*, and optionally a *comment\_tag*. Copies of the *option\_name*, *value* and *comment\_tag* are stored in the *device*, so the caller can safely [**free**(3)](/free/3.md) all of the original strings used as arguments.

**Note**\

A non-NULL value of the *comment\_tag* makes the option not-enabled for current use. Depending on the output format, it may be either completely ignored, or rendered as a comment with this value as a prefix (a zero-length string "\\0" may be passed to have no prefix).

Such options and their values may be further sanity-checked and reported as warnings by **nutscan\_display\_sanity\_check()** dispatcher and its related methods which implement the logic of particular checks. This is used for example when generating an ups.conf file content suggestions with **nutscan\_display\_ups\_conf\_with\_sanity\_check()** method.

## NOTES

Technically, the function is currently defined in *nutscan-device.h* file.

## SEE ALSO

[**nutscan\_scan\_usb**(3)](/nutscan_scan_usb/3.md), [**nutscan\_scan\_xml\_http\_range**(3)](/nutscan_scan_xml_http_range/3.md), [**nutscan\_scan\_nut**(3)](/nutscan_scan_nut/3.md), [**nutscan\_scan\_avahi**(3)](/nutscan_scan_avahi/3.md), [**nutscan\_scan\_ipmi**(3)](/nutscan_scan_ipmi/3.md), [**nutscan\_scan\_snmp**(3)](/nutscan_scan_snmp/3.md), [**nutscan\_display\_sanity\_check**(3)](/nutscan_display_sanity_check/3.md), [**nutscan\_display\_sanity\_check\_serial**(3)](/nutscan_display_sanity_check_serial/3.md), [**nutscan\_display\_ups\_conf\_with\_sanity\_check**(3)](/nutscan_display_ups_conf_with_sanity_check/3.md), [**nutscan\_display\_ups\_conf**(3)](/nutscan_display_ups_conf/3.md), [**nutscan\_display\_parsable**(3)](/nutscan_display_parsable/3.md), [**nutscan\_new\_device**(3)](/nutscan_new_device/3.md), [**nutscan\_free\_device**(3)](/nutscan_free_device/3.md), [**nutscan\_add\_device\_to\_device**(3)](/nutscan_add_device_to_device/3.md)
