Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 43542d84dc | |||
| 398146a0d8 | |||
|
|
b944ee8dec | ||
|
|
927160ba01 | ||
|
|
42dee2de78 | ||
|
|
61e36bed19 | ||
|
|
50412e0006 | ||
|
|
19d736bc84 | ||
|
|
db3036e85b | ||
|
|
26bd685296 | ||
|
|
fa187be8b0 | ||
|
|
bbce4dc8fe | ||
|
|
9c4425ff54 | ||
|
|
2e0ee84ca7 |
@ -1,6 +1,7 @@
|
|||||||
include(CMakeDependentOption)
|
|
||||||
cmake_minimum_required(VERSION 3.1)
|
|
||||||
project(rexbacklight)
|
project(rexbacklight)
|
||||||
|
cmake_minimum_required(VERSION 3.1)
|
||||||
|
include(CMakeDependentOption)
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
set(SCRIPT_DIR ${CMAKE_SOURCE_DIR}/scripts)
|
set(SCRIPT_DIR ${CMAKE_SOURCE_DIR}/scripts)
|
||||||
|
|
||||||
@ -23,7 +24,7 @@ if(PYTHONINTERP_FOUND)
|
|||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${GIT_VERSION_TMP_FILE}
|
OUTPUT ${GIT_VERSION_TMP_FILE}
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo "//File generated by CMake. Do not edit!" > ${GIT_VERSION_TMP_FILE}
|
COMMAND ${CMAKE_COMMAND} -E echo "//File generated by CMake. Do not edit!" > ${GIT_VERSION_TMP_FILE}
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo "#define GIT_TAG_NAME \"v1.5\"" > ${GIT_VERSION_TMP_FILE}
|
COMMAND ${CMAKE_COMMAND} -E echo "#define GIT_TAG_NAME \"v1.5.3\"" > ${GIT_VERSION_TMP_FILE}
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GIT_VERSION_TMP_FILE} ${GIT_VERSION_FILE}
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GIT_VERSION_TMP_FILE} ${GIT_VERSION_FILE}
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove ${GIT_VERSION_TMP_FILE}
|
COMMAND ${CMAKE_COMMAND} -E remove ${GIT_VERSION_TMP_FILE}
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
@ -34,7 +35,7 @@ elseif(UNIX)
|
|||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${GIT_VERSION_TMP_FILE}
|
OUTPUT ${GIT_VERSION_TMP_FILE}
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo "//File generated by CMake. Do not edit!" > ${GIT_VERSION_TMP_FILE}
|
COMMAND ${CMAKE_COMMAND} -E echo "//File generated by CMake. Do not edit!" > ${GIT_VERSION_TMP_FILE}
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo "#define GIT_TAG_NAME \"v1.5\"" > ${GIT_VERSION_TMP_FILE}
|
COMMAND ${CMAKE_COMMAND} -E echo "#define GIT_TAG_NAME \"v1.5.3\"" > ${GIT_VERSION_TMP_FILE}
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GIT_VERSION_TMP_FILE} ${GIT_VERSION_FILE}
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GIT_VERSION_TMP_FILE} ${GIT_VERSION_FILE}
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove ${GIT_VERSION_TMP_FILE}
|
COMMAND ${CMAKE_COMMAND} -E remove ${GIT_VERSION_TMP_FILE}
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
@ -61,8 +62,8 @@ endif()
|
|||||||
|
|
||||||
#locate rjp library requirements
|
#locate rjp library requirements
|
||||||
if(ENABLE_RESTORE_FILE)
|
if(ENABLE_RESTORE_FILE)
|
||||||
find_library(RJP_LIB rjp)
|
find_package(PkgConfig REQUIRED)
|
||||||
find_path(RJP_HEADER_DIR rjp.h)
|
pkg_check_modules(RJP REQUIRED rjp)
|
||||||
#temporary library (no actual library generated)
|
#temporary library (no actual library generated)
|
||||||
add_library(common_srcs OBJECT src/cmd.c src/common.c src/restore.c)
|
add_library(common_srcs OBJECT src/cmd.c src/common.c src/restore.c)
|
||||||
add_definitions("-DENABLE_RESTORE_FILE")
|
add_definitions("-DENABLE_RESTORE_FILE")
|
||||||
@ -80,8 +81,9 @@ if(BUILD_REXLEDCTL)
|
|||||||
target_compile_definitions(rexledctl PRIVATE REXLEDCTL) #define REXLEDCTL in C files
|
target_compile_definitions(rexledctl PRIVATE REXLEDCTL) #define REXLEDCTL in C files
|
||||||
target_link_libraries(rexledctl PRIVATE $<TARGET_OBJECTS:common_srcs>) #link with the common_srcs "library"
|
target_link_libraries(rexledctl PRIVATE $<TARGET_OBJECTS:common_srcs>) #link with the common_srcs "library"
|
||||||
if(ENABLE_RESTORE_FILE)
|
if(ENABLE_RESTORE_FILE)
|
||||||
target_link_libraries(rexledctl PRIVATE "${RJP_LIB}") #link with rjp
|
target_link_libraries(rexledctl PRIVATE "${RJP_LIBRARIES}") #link with rjp
|
||||||
target_include_directories(rexledctl PUBLIC "${RJP_HEADER_DIR}") #include rjp.h directory
|
target_include_directories(rexledctl PUBLIC "${RJP_INCLUDE_DIRS}") #include rjp.h directory
|
||||||
|
target_compile_options(rexledctl PUBLIC ${RJP_CFLAGS_OTHER})
|
||||||
endif()
|
endif()
|
||||||
install(TARGETS rexledctl RUNTIME DESTINATION bin)
|
install(TARGETS rexledctl RUNTIME DESTINATION bin)
|
||||||
if(INSTALL_UDEV_LED_RULE)
|
if(INSTALL_UDEV_LED_RULE)
|
||||||
@ -95,8 +97,9 @@ if(BUILD_REXBACKLIGHT)
|
|||||||
target_compile_definitions(rexbacklight PRIVATE REXBACKLIGHT)
|
target_compile_definitions(rexbacklight PRIVATE REXBACKLIGHT)
|
||||||
target_link_libraries(rexbacklight PRIVATE $<TARGET_OBJECTS:common_srcs>)
|
target_link_libraries(rexbacklight PRIVATE $<TARGET_OBJECTS:common_srcs>)
|
||||||
if(ENABLE_RESTORE_FILE)
|
if(ENABLE_RESTORE_FILE)
|
||||||
target_link_libraries(rexbacklight PRIVATE "${RJP_LIB}")
|
target_link_libraries(rexbacklight PRIVATE "${RJP_LIBRARIES}")
|
||||||
target_include_directories(rexbacklight PUBLIC "${RJP_HEADER_DIR}")
|
target_include_directories(rexbacklight PUBLIC "${RJP_INCLUDE_DIRS}")
|
||||||
|
target_compile_options(rexbacklight PUBLIC ${RJP_CFLAGS_OTHER})
|
||||||
endif()
|
endif()
|
||||||
install(TARGETS rexbacklight RUNTIME DESTINATION bin)
|
install(TARGETS rexbacklight RUNTIME DESTINATION bin)
|
||||||
if(INSTALL_UDEV_BACKLIGHT_RULE)
|
if(INSTALL_UDEV_BACKLIGHT_RULE)
|
||||||
|
|||||||
@ -7,9 +7,11 @@ I've also since added a program to control LED devices, rexledctl (best name I c
|
|||||||
|
|
||||||
Either program can be built alone or both together. This is configured using some cmake magic.
|
Either program can be built alone or both together. This is configured using some cmake magic.
|
||||||
|
|
||||||
Current version is 1.3.1 as of writing this, so if the version is much newer, remind me to update this readme.
|
Current version is 1.5.2 as of writing this, so if the version is much newer, remind me to update this readme.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
rexbacklight version v1.5.2
|
||||||
|
|
||||||
Usage: rexbacklight [argument] [options] [argument]
|
Usage: rexbacklight [argument] [options] [argument]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
@ -25,6 +27,8 @@ Options:
|
|||||||
print device names to stdout and exit
|
print device names to stdout and exit
|
||||||
--restore|-R
|
--restore|-R
|
||||||
reassign previously saved device values
|
reassign previously saved device values
|
||||||
|
--no-save|-N
|
||||||
|
do not write any data to the restore file
|
||||||
--help|-h
|
--help|-h
|
||||||
print this help message and exit
|
print this help message and exit
|
||||||
--version
|
--version
|
||||||
@ -38,7 +42,7 @@ Arguments:
|
|||||||
max
|
max
|
||||||
min
|
min
|
||||||
|
|
||||||
rexbacklight Copyright (C) 2018 rexy712
|
rexbacklight Copyright (C) 2018-2021 rexy712
|
||||||
This program comes with ABSOLUTELY NO WARRANTY.
|
This program comes with ABSOLUTELY NO WARRANTY.
|
||||||
This is free software, and you are welcome to redistribute it
|
This is free software, and you are welcome to redistribute it
|
||||||
under certain conditions; see the GNU GPLv3 for details.
|
under certain conditions; see the GNU GPLv3 for details.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
rexbacklight
|
rexbacklight
|
||||||
Copyright (C) 2018 rexy712
|
Copyright (C) 2018-2021 rexy712
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
rexbacklight
|
rexbacklight
|
||||||
Copyright (C) 2018 rexy712
|
Copyright (C) 2018-2021 rexy712
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
rexbacklight
|
rexbacklight
|
||||||
Copyright (C) 2018 rexy712
|
Copyright (C) 2018-2021 rexy712
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
rexbacklight
|
rexbacklight
|
||||||
Copyright (C) 2018 rexy712
|
Copyright (C) 2018-2021 rexy712
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
rexbacklight
|
rexbacklight
|
||||||
Copyright (C) 2018 rexy712
|
Copyright (C) 2018-2021 rexy712
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
rexbacklight
|
rexbacklight
|
||||||
Copyright (C) 2018 rexy712
|
Copyright (C) 2018-2021 rexy712
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
rexbacklight
|
rexbacklight
|
||||||
Copyright (C) 2018 rexy712
|
Copyright (C) 2018-2021 rexy712
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
rexbacklight
|
rexbacklight
|
||||||
Copyright (C) 2018 rexy712
|
Copyright (C) 2018-2021 rexy712
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -94,7 +94,7 @@ _Noreturn void usage(int exit_val){
|
|||||||
printf(" max\n");
|
printf(" max\n");
|
||||||
printf(" min\n");
|
printf(" min\n");
|
||||||
|
|
||||||
printf("\n%s Copyright (C) 2018 rexy712\n", executable_name());
|
printf("\n%s Copyright (C) 2018-2021 rexy712\n", executable_name());
|
||||||
printf("This program comes with ABSOLUTELY NO WARRANTY.\n");
|
printf("This program comes with ABSOLUTELY NO WARRANTY.\n");
|
||||||
printf("This is free software, and you are welcome to redistribute it\n");
|
printf("This is free software, and you are welcome to redistribute it\n");
|
||||||
printf("under certain conditions; see the GNU GPLv3 for details.\n");
|
printf("under certain conditions; see the GNU GPLv3 for details.\n");
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
rexbacklight
|
rexbacklight
|
||||||
Copyright (C) 2018 rexy712
|
Copyright (C) 2018-2021 rexy712
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -77,7 +77,7 @@ RJP_value* read_restore_file(const char* file){
|
|||||||
i = fread(file_contents, filesize, 1, fp);
|
i = fread(file_contents, filesize, 1, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
file_contents[filesize] = 0;
|
file_contents[filesize] = 0;
|
||||||
RJP_value* root = rjp_parse(file_contents);
|
RJP_value* root = rjp_parse(file_contents, RJP_PARSE_ALLOW_COMMENTS, NULL);
|
||||||
free(file_contents);
|
free(file_contents);
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
@ -93,8 +93,10 @@ static RJP_value* restore_file_handle(void){
|
|||||||
}
|
}
|
||||||
|
|
||||||
RJP_value* find_matching_json_device(const char* name, RJP_value* root){
|
RJP_value* find_matching_json_device(const char* name, RJP_value* root){
|
||||||
for(RJP_value* curr = rjp_get_member(root);curr;curr = rjp_next_member(curr)){
|
RJP_object_iterator it;
|
||||||
if(!strcmp(rjp_member_name(curr), name)){
|
rjp_init_object_iterator(&it, root);
|
||||||
|
for(RJP_value* curr = rjp_object_iterator_current(&it);curr;curr = rjp_object_iterator_next(&it)){
|
||||||
|
if(!strcmp(rjp_member_key(curr)->value, name)){
|
||||||
return curr;
|
return curr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,7 +116,7 @@ int restore_to_delta(struct arg_values* curr){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
curr->operation = OP_SET;
|
curr->operation = OP_SET;
|
||||||
curr->delta = rjp_value_dfloat(match);
|
curr->delta = rjp_get_float(match);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
void prep_restore(struct arg_values* a){
|
void prep_restore(struct arg_values* a){
|
||||||
@ -124,10 +126,12 @@ void prep_restore(struct arg_values* a){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void save_restore_file(struct string_array* devices, struct arg_values* args){
|
void save_restore_file(struct string_array* devices, struct arg_values* args){
|
||||||
|
RJP_object_iterator it;
|
||||||
RJP_value* rf = restore_file_handle();
|
RJP_value* rf = restore_file_handle();
|
||||||
if(!rf)
|
if(!rf)
|
||||||
rf = rjp_init_json();
|
rf = rjp_new_object();
|
||||||
for(RJP_value* mem = rjp_get_member(rf);mem;mem = rjp_next_member(mem)){
|
rjp_init_object_iterator(&it, rf);
|
||||||
|
for(RJP_value* mem = rjp_object_iterator_current(&it);mem;mem = rjp_object_iterator_next(&it)){
|
||||||
for(struct arg_values* curr = args->next, *prev = args;curr;prev = curr, curr = curr->next){
|
for(struct arg_values* curr = args->next, *prev = args;curr;prev = curr, curr = curr->next){
|
||||||
if(curr->operation != OP_SET || curr->flags & ARG_FLAG_NO_SAVE){
|
if(curr->operation != OP_SET || curr->flags & ARG_FLAG_NO_SAVE){
|
||||||
prev->next = curr->next;
|
prev->next = curr->next;
|
||||||
@ -135,8 +139,8 @@ void save_restore_file(struct string_array* devices, struct arg_values* args){
|
|||||||
curr = prev;
|
curr = prev;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(!strcmp(rjp_member_name(mem), curr->device)){
|
if(!strcmp(rjp_member_key(mem)->value, curr->device)){
|
||||||
rjp_set_value(mem, rjp_dfloat(curr->delta));
|
rjp_set_float(mem, curr->delta);
|
||||||
prev->next = curr->next;
|
prev->next = curr->next;
|
||||||
free(curr);
|
free(curr);
|
||||||
break;
|
break;
|
||||||
@ -144,12 +148,14 @@ void save_restore_file(struct string_array* devices, struct arg_values* args){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(struct arg_values* curr = args->next;curr;curr = curr->next){
|
for(struct arg_values* curr = args->next;curr;curr = curr->next){
|
||||||
if(curr->operation == OP_SET)
|
if(curr->operation == OP_SET){
|
||||||
rjp_add_member(rf, curr->device, 0, rjp_dfloat(curr->delta));
|
RJP_value* newmem = rjp_new_member(rf, curr->device, 0);
|
||||||
|
rjp_set_float(newmem, curr->delta);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
free_cmd_args(args);
|
free_cmd_args(args);
|
||||||
|
|
||||||
char* tmp = rjp_to_json(rf);
|
char* tmp = rjp_to_json(rf, RJP_FORMAT_NONE);
|
||||||
char* rfil = restore_file();
|
char* rfil = restore_file();
|
||||||
FILE* restf = fopen(rfil, "w");
|
FILE* restf = fopen(rfil, "w");
|
||||||
if(!restf){
|
if(!restf){
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
rexbacklight
|
rexbacklight
|
||||||
Copyright (C) 2018 rexy712
|
Copyright (C) 2018-2021 rexy712
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -63,6 +63,15 @@ const char* max_brightness_file(void){return "max_brightness";}
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//create a copy of a string and append a '/' character to the end
|
||||||
|
char* add_slash_to(const char* name, size_t namelen){
|
||||||
|
char* newname = malloc(namelen + 2);
|
||||||
|
memcpy(newname, name, namelen);
|
||||||
|
newname[namelen++] = '/';
|
||||||
|
newname[namelen] = 0;
|
||||||
|
return newname;
|
||||||
|
}
|
||||||
|
|
||||||
//Get a list of led/backlight devices in sysfs
|
//Get a list of led/backlight devices in sysfs
|
||||||
struct string_array get_device_sources(void){
|
struct string_array get_device_sources(void){
|
||||||
DIR* fd;
|
DIR* fd;
|
||||||
@ -162,6 +171,12 @@ void sleep_for(double time){
|
|||||||
nanosleep(&ts, NULL);
|
nanosleep(&ts, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void return_to_root_dir(void){
|
||||||
|
if(chdir(device_dir())){
|
||||||
|
io_error(IO_ERROR_OPEN, IO_ERROR_DIR, device_dir());
|
||||||
|
return_value = RETVAL_INVALID_DIR;
|
||||||
|
}
|
||||||
|
}
|
||||||
//update brightness incrementally over requested millisecond time interval
|
//update brightness incrementally over requested millisecond time interval
|
||||||
void fade_out(struct arg_values* arg){
|
void fade_out(struct arg_values* arg){
|
||||||
FILE* fd;
|
FILE* fd;
|
||||||
@ -177,8 +192,11 @@ void fade_out(struct arg_values* arg){
|
|||||||
start = get_time();
|
start = get_time();
|
||||||
fd = fopen(brightness_file(), "w+");
|
fd = fopen(brightness_file(), "w+");
|
||||||
if(!fd){
|
if(!fd){
|
||||||
io_error_3(IO_ERROR_OPEN, IO_ERROR_FILE, device_dir(), arg->device, brightness_file());
|
char* devname = add_slash_to(arg->device, strlen(arg->device));
|
||||||
|
io_error_3(IO_ERROR_OPEN, IO_ERROR_FILE, device_dir(), devname, brightness_file());
|
||||||
return_value = RETVAL_INVALID_FILE;
|
return_value = RETVAL_INVALID_FILE;
|
||||||
|
free(devname);
|
||||||
|
return_to_root_dir();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fprintf(fd, "%d", (int)value);
|
fprintf(fd, "%d", (int)value);
|
||||||
@ -201,18 +219,17 @@ void fade_out(struct arg_values* arg){
|
|||||||
}
|
}
|
||||||
fd = fopen(brightness_file(), "w+");
|
fd = fopen(brightness_file(), "w+");
|
||||||
if(!fd){
|
if(!fd){
|
||||||
io_error_3(IO_ERROR_OPEN, IO_ERROR_FILE, device_dir(), arg->device, brightness_file());
|
char* devname = add_slash_to(arg->device, strlen(arg->device));
|
||||||
|
io_error_3(IO_ERROR_OPEN, IO_ERROR_FILE, device_dir(), devname, brightness_file());
|
||||||
return_value = RETVAL_INVALID_FILE;
|
return_value = RETVAL_INVALID_FILE;
|
||||||
|
free(devname);
|
||||||
|
return_to_root_dir();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fprintf(fd, "%d", arg->act_delta);
|
fprintf(fd, "%d", arg->act_delta);
|
||||||
|
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
if(chdir(device_dir())){
|
return_to_root_dir();
|
||||||
io_error(IO_ERROR_OPEN, IO_ERROR_DIR, device_dir());
|
|
||||||
return_value = RETVAL_INVALID_DIR;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int prep_offset(struct arg_values* args){
|
int prep_offset(struct arg_values* args){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user