LUXINIT(3) Manual Page

  • Home
  • Back

  • luxinit(3) Library Functions Manual luxinit(3)

    luxinit, luxfreeinitialise and destroy a lux_t object

    library “liblux”

    #include <lux.h>

    luxinit(lux_t *disp);

    luxfree(lux_t *disp);

    The () function initialises the values of the lux_t structure pointed to by disp. Allocation of disp is left up to the user. All lux_t structures should be initialised with the luxinit() function before being used with any other library functions.

    The () function does the opposite of the luxinit() function, cleaning up all the resources used by the lux_t structure pointed to by disp. This function should be called for all lux_t structures that have been initialised by luxinit() after they are no longer required.

    The luxinit() function returns the file descriptor of the directory containing the backlight files located in /sys/class/backlight on success. On error, -1 is returned and errno is set to indicate the error.

    The luxfree() function returns no value.

    The following program initialises a new lux_t structure, uses it to set the display brightness to 100%, and then frees the resources used by the structure.

    #include <err.h>
    #include <stdlib.h>
    #include <lux.h>
    	lux_t disp;
    	if (luxinit(&disp) == -1)
    		err(EXIT_FAILURE, "luxinit");
    	luxsetp(&disp, 100.0);
    	return EXIT_SUCCESS;

    luxinit() can fail with any of the errors specified for fdopendir(), open(), openat(), or readdir().

    lux(3), luxdec(3), luxdecp(3), luxget(3), luxgetp(3), luxinc(3), luxincp(3), luxmax(3), luxset(3), luxsetp(3)

    Thomas Voss <[email protected]>

    August 7, 2023 Linux