Преглед изворни кода

Remove trailing whitespaces

Removing the trailing whitespaces, that can be quite annoying for
people who use editors which show them. Additionally, it is a good
practice to avoid them.

Signed-off-by: Leonid Bloch <lb.workbox@gmail.com>
Leonid Bloch пре 4 година
родитељ
комит
a9b957917f
11 измењених фајлова са 197 додато и 197 уклоњено
  1. 21
    21
      DOCUMENTATION.md
  2. 2
    2
      README.md
  3. 2
    2
      src/helpers.c
  4. 2
    2
      src/helpers.h
  5. 13
    13
      src/impl/razer.c
  6. 2
    2
      src/impl/razer.h
  7. 30
    30
      src/impl/sysfs.c
  8. 2
    2
      src/impl/sysfs.h
  9. 1
    1
      src/impl/util.h
  10. 117
    117
      src/light.c
  11. 5
    5
      src/light.h

+ 21
- 21
DOCUMENTATION.md Прегледај датотеку

@@ -10,28 +10,28 @@ We use 4 spaces for indentation. We have an empty line at the top and bottom of
10 10
 
11 11
 The following two sources should be clear enough examples of our coding style:
12 12
 
13
-### Header files 
13
+### Header files
14 14
 
15 15
 ```c
16
-    
16
+
17 17
     #pragma once
18
-    
18
+
19 19
     #include <stdbool.h>
20 20
     #include <stdint.h>
21 21
     #include <stdfoo.h> /* foo_type_t */
22
-    
23
-    
22
+
23
+
24 24
     typedef struct _some_struct_t some_struct_t;
25
-    struct _some_struct_t 
25
+    struct _some_struct_t
26 26
     {
27 27
         uint64_t    id;
28 28
         foo_type_t  my_foo_thing;
29 29
         foo_type_t  *my_foo_ptr;
30 30
     }
31
-    
31
+
32 32
     /* Describe what the purpose of this function is, what it does with/to foo_struct, and what it returns. */
33 33
     bool do_some_stuff(some_struct_t *foo_struct);
34
-    
34
+
35 35
 ```
36 36
 
37 37
 ### Source files
@@ -52,25 +52,25 @@ static void _increment_one(uint64_t *out_value)
52 52
 bool do_some_stuff(some_struct_t *foo_struct)
53 53
 {
54 54
     _increment_one(foo_struct->id);
55
-    
55
+
56 56
     if(foo_struct->id > 33)
57 57
     {
58 58
         return false;
59 59
     }
60
-    
60
+
61 61
     if(foo_struct->my_foo_ptr != NULL)
62 62
     {
63 63
         free(foo_struct->my_foo_ptr);
64 64
     }
65
-    
65
+
66 66
     foo_struct->my_foo_ptr = malloc(sizeof(foo_type_t));
67
-    
67
+
68 68
     return true;
69 69
 }
70 70
 
71 71
 ```
72 72
 
73
-## Implementing an enumerator 
73
+## Implementing an enumerator
74 74
 
75 75
 Implementing your own devices through an enumerator is pretty easy. The required steps are as follows:
76 76
 
@@ -84,14 +84,14 @@ In the header, you need to first do a `#pragma once` (obviously), then `#include
84 84
 
85 85
 ```c
86 86
 
87
-#pragma once 
87
+#pragma once
88 88
 
89 89
 #include "light.h"
90 90
 
91 91
 // Implementation of the foo enumerator
92 92
 // Enumerates devices for quacking ducks
93 93
 
94
-// Device target data 
94
+// Device target data
95 95
 struct _impl_foo_data_t
96 96
 {
97 97
     int32_t internal_quack_id;
@@ -125,20 +125,20 @@ The job of the enumerator is to identify/enumerate a bunch of different devices
125 125
 bool impl_foo_init(light_device_enumerator_t *enumerator)
126 126
 {
127 127
     /* Lets create a single device, with a single target, for simplicity */
128
-    
128
+
129 129
     /* Create a new device called new_device_name, we dont need any userdata so pass NULL to the device_data parameter */
130 130
     light_device_t *new_device = light_create_device(enumerator, "new_device_name", NULL)
131
-    
132
-    /* Setup userdata specific to the target we will create*/ 
131
+
132
+    /* Setup userdata specific to the target we will create*/
133 133
     /* Useful to for example reference an ID in a third-party API or likewise */
134 134
     /* NOTE: The userdata will be free()'d automatically on exit, so you do not need to free it yourself */
135 135
     impl_foo_data_t *custom_data = malloc(sizeof(impl_foo_data_t));
136 136
     custom_data->internal_quack_id = 333;
137
-    
138
-    
137
+
138
+
139 139
     /* Create a new device target called new_target_name, and pass in the functions and userdata that we just allocated */
140 140
     light_create_device_target(new_device, "new_target_name", impl_foo_set, impl_foo_get, impl_foo_getmax, impl_foo_command, custom_data)
141
-    
141
+
142 142
     /* Return true because we didnt get any errors! */
143 143
     return true;
144 144
 }

+ 2
- 2
README.md Прегледај датотеку

@@ -71,7 +71,7 @@ Usage
71 71
 -----
72 72
 
73 73
 Usage follows the following pattern, where options are optional and the neccesity of value depends on the options used
74
-    
74
+
75 75
     light [options] <value>
76 76
 
77 77
 ### Command options
@@ -96,7 +96,7 @@ Without any extra options, the command will operate on the device called `sysfs/
96 96
 
97 97
 ### Extra options
98 98
 
99
-These can be mixed, combined and matched after convenience. 
99
+These can be mixed, combined and matched after convenience.
100 100
 
101 101
 * `-r` Raw mode, values (printed and interpreted from commandline) will be treated as integers in the controllers native range, instead of in percent.
102 102
 * `-v <verbosity>` Specifies the verbosity level. 0 is default and prints nothing. 1 prints only errors, 2 prints only errors and warnings, and 3 prints both errors, warnings and notices.

+ 2
- 2
src/helpers.c Прегледај датотеку

@@ -7,7 +7,7 @@
7 7
 #include <sys/types.h>
8 8
 #include <dirent.h>
9 9
 #include <errno.h> // errno
10
-#include <libgen.h> // dirname 
10
+#include <libgen.h> // dirname
11 11
 
12 12
 
13 13
 bool light_file_read_uint64(char const *filename, uint64_t *val)
@@ -142,7 +142,7 @@ int light_mkpath(char *dir, mode_t mode)
142 142
     char *tempdir = strdup(dir);
143 143
     light_mkpath(dirname(tempdir), mode);
144 144
     free(tempdir);
145
-    
145
+
146 146
     return mkdir(dir, mode);
147 147
 }
148 148
 

+ 2
- 2
src/helpers.h Прегледај датотеку

@@ -9,10 +9,10 @@
9 9
 /* Clamps x(value) between y(min) and z(max) in a nested ternary operation */
10 10
 #define LIGHT_CLAMP(val, min, max) (val < min ? light_log_clamp_min(min) : (val > max ? light_log_clamp_max(max) : val))
11 11
 
12
-/* Verbosity levels: 
12
+/* Verbosity levels:
13 13
 * 0 - No output
14 14
 * 1 - Errors
15
-* 2 - Errors, warnings 
15
+* 2 - Errors, warnings
16 16
 * 3 - Errors, warnings, notices
17 17
 */
18 18
 typedef enum {

+ 13
- 13
src/impl/razer.c Прегледај датотеку

@@ -12,13 +12,13 @@ static void _impl_razer_add_target(light_device_t *device, char const *name, cha
12 12
     impl_razer_data_t *target_data = malloc(sizeof(impl_razer_data_t));
13 13
     snprintf(target_data->brightness, sizeof(target_data->brightness), "/sys/bus/hid/drivers/razerkbd/%s/%s", device->name, filename);
14 14
     target_data->max_brightness = max_brightness;
15
-    
15
+
16 16
     // Only add targets that actually exist, as we aren't fully sure exactly what targets exist for a given device
17 17
     if(light_file_exists(target_data->brightness))
18 18
     {
19 19
         light_create_device_target(device, name, impl_razer_set, impl_razer_get, impl_razer_getmax, impl_razer_command, target_data);
20 20
     }
21
-    else 
21
+    else
22 22
     {
23 23
         LIGHT_WARN("razer: couldn't add target %s to device %s, the file %s doesn't exist", name, device->name, filename);
24 24
         // target_data will not be freed automatically if we dont add a device target with it as userdata, so free it here
@@ -33,7 +33,7 @@ static void _impl_razer_add_device(light_device_enumerator_t *enumerator, char c
33 33
 
34 34
     // Setup a target to backlight
35 35
     _impl_razer_add_target(new_device, "backlight", "matrix_brightness", 255);
36
-    
36
+
37 37
     // Setup targets to different possible leds
38 38
     _impl_razer_add_target(new_device, "game_led", "game_led_state", 1);
39 39
     _impl_razer_add_target(new_device, "macro_led", "macro_led_state", 1);
@@ -45,16 +45,16 @@ static void _impl_razer_add_device(light_device_enumerator_t *enumerator, char c
45 45
 
46 46
 bool impl_razer_init(light_device_enumerator_t *enumerator)
47 47
 {
48
-    // Iterate through the led controllers and create a device_target for each controller 
48
+    // Iterate through the led controllers and create a device_target for each controller
49 49
     DIR *razer_dir;
50 50
     struct dirent *curr_entry;
51
-    
51
+
52 52
     if((razer_dir = opendir("/sys/bus/hid/drivers/razerkbd/")) == NULL)
53 53
     {
54
-        // Razer driver isnt properly installed, so we cant add devices in this enumerator 
54
+        // Razer driver isnt properly installed, so we cant add devices in this enumerator
55 55
         return true;
56 56
     }
57
-    
57
+
58 58
     while((curr_entry = readdir(razer_dir)) != NULL)
59 59
     {
60 60
         // Skip dot entries
@@ -62,12 +62,12 @@ bool impl_razer_init(light_device_enumerator_t *enumerator)
62 62
         {
63 63
             continue;
64 64
         }
65
- 
65
+
66 66
         _impl_razer_add_device(enumerator, curr_entry->d_name);
67 67
     }
68
-    
68
+
69 69
     closedir(razer_dir);
70
-    
70
+
71 71
     return true;
72 72
 }
73 73
 
@@ -85,7 +85,7 @@ bool impl_razer_set(light_device_target_t *target, uint64_t in_value)
85 85
         LIGHT_ERR("failed to write to razer device");
86 86
         return false;
87 87
     }
88
-    
88
+
89 89
     return true;
90 90
 }
91 91
 
@@ -98,7 +98,7 @@ bool impl_razer_get(light_device_target_t *target, uint64_t *out_value)
98 98
         LIGHT_ERR("failed to read from razer device");
99 99
         return false;
100 100
     }
101
-    
101
+
102 102
     return true;
103 103
 }
104 104
 
@@ -107,7 +107,7 @@ bool impl_razer_getmax(light_device_target_t *target, uint64_t *out_value)
107 107
     impl_razer_data_t *data = (impl_razer_data_t*)target->device_target_data;
108 108
 
109 109
     *out_value = data->max_brightness;
110
-    
110
+
111 111
     return true;
112 112
 }
113 113
 

+ 2
- 2
src/impl/razer.h Прегледај датотеку

@@ -1,12 +1,12 @@
1 1
 
2
-#pragma once 
2
+#pragma once
3 3
 
4 4
 #include "light.h"
5 5
 
6 6
 // Implementation of the razer enumerator
7 7
 // Enumerates devices for the openrazer driver https://github.com/openrazer/openrazer
8 8
 
9
-// Device target data 
9
+// Device target data
10 10
 struct _impl_razer_data_t
11 11
 {
12 12
     char brightness[NAME_MAX];

+ 30
- 30
src/impl/sysfs.c Прегледај датотеку

@@ -12,16 +12,16 @@ static bool _impl_sysfs_init_leds(light_device_enumerator_t *enumerator)
12 12
     // Create a new backlight device
13 13
     light_device_t *leds_device = light_create_device(enumerator, "leds", NULL);
14 14
 
15
-    // Iterate through the led controllers and create a device_target for each controller 
15
+    // Iterate through the led controllers and create a device_target for each controller
16 16
     DIR *leds_dir;
17 17
     struct dirent *curr_entry;
18
-    
18
+
19 19
     if((leds_dir = opendir("/sys/class/leds")) == NULL)
20 20
     {
21 21
         LIGHT_ERR("failed to open leds controller directory for reading");
22 22
         return false;
23 23
     }
24
-    
24
+
25 25
     while((curr_entry = readdir(leds_dir)) != NULL)
26 26
     {
27 27
         // Skip dot entries
@@ -29,18 +29,18 @@ static bool _impl_sysfs_init_leds(light_device_enumerator_t *enumerator)
29 29
         {
30 30
             continue;
31 31
         }
32
-        
33
-        // Setup the target data 
32
+
33
+        // Setup the target data
34 34
         impl_sysfs_data_t *dev_data = malloc(sizeof(impl_sysfs_data_t));
35 35
         snprintf(dev_data->brightness, sizeof(dev_data->brightness), "/sys/class/leds/%s/brightness", curr_entry->d_name);
36 36
         snprintf(dev_data->max_brightness, sizeof(dev_data->max_brightness), "/sys/class/leds/%s/max_brightness", curr_entry->d_name);
37
-        
38
-        // Create a new device target for the controller 
37
+
38
+        // Create a new device target for the controller
39 39
         light_create_device_target(leds_device, curr_entry->d_name, impl_sysfs_set, impl_sysfs_get, impl_sysfs_getmax, impl_sysfs_command, dev_data);
40 40
     }
41
-    
41
+
42 42
     closedir(leds_dir);
43
-    
43
+
44 44
     return true;
45 45
 }
46 46
 
@@ -49,20 +49,20 @@ static bool _impl_sysfs_init_backlight(light_device_enumerator_t *enumerator)
49 49
     // Create a new backlight device
50 50
     light_device_t *backlight_device = light_create_device(enumerator, "backlight", NULL);
51 51
 
52
-    // Iterate through the backlight controllers and create a device_target for each controller 
52
+    // Iterate through the backlight controllers and create a device_target for each controller
53 53
     DIR *backlight_dir;
54 54
     struct dirent *curr_entry;
55
-    
55
+
56 56
     // Keep track of the best controller, and create an autodevice from that
57 57
     char best_controller[NAME_MAX];
58 58
     uint64_t best_value = 0;
59
-    
59
+
60 60
     if((backlight_dir = opendir("/sys/class/backlight")) == NULL)
61 61
     {
62 62
         LIGHT_ERR("failed to open backlight controller directory for reading");
63 63
         return false;
64 64
     }
65
-    
65
+
66 66
     while((curr_entry = readdir(backlight_dir)) != NULL)
67 67
     {
68 68
         // Skip dot entries
@@ -70,15 +70,15 @@ static bool _impl_sysfs_init_backlight(light_device_enumerator_t *enumerator)
70 70
         {
71 71
             continue;
72 72
         }
73
-        
74
-        // Setup the target data 
73
+
74
+        // Setup the target data
75 75
         impl_sysfs_data_t *dev_data = malloc(sizeof(impl_sysfs_data_t));
76 76
         snprintf(dev_data->brightness, sizeof(dev_data->brightness), "/sys/class/backlight/%s/brightness", curr_entry->d_name);
77 77
         snprintf(dev_data->max_brightness, sizeof(dev_data->max_brightness), "/sys/class/backlight/%s/max_brightness", curr_entry->d_name);
78
-        
79
-        // Create a new device target for the controller 
78
+
79
+        // Create a new device target for the controller
80 80
         light_create_device_target(backlight_device, curr_entry->d_name, impl_sysfs_set, impl_sysfs_get, impl_sysfs_getmax, impl_sysfs_command, dev_data);
81
-        
81
+
82 82
         // Read the max brightness to get the best one
83 83
         uint64_t curr_value = 0;
84 84
         if(light_file_read_uint64(dev_data->max_brightness, &curr_value))
@@ -90,32 +90,32 @@ static bool _impl_sysfs_init_backlight(light_device_enumerator_t *enumerator)
90 90
             }
91 91
         }
92 92
     }
93
-    
93
+
94 94
     closedir(backlight_dir);
95
-    
95
+
96 96
     // If we found at least one usable controller, create an auto target mapped to that controller
97 97
     if(best_value > 0)
98 98
     {
99
-        // Setup the target data 
99
+        // Setup the target data
100 100
         impl_sysfs_data_t *dev_data = malloc(sizeof(impl_sysfs_data_t));
101 101
         snprintf(dev_data->brightness, sizeof(dev_data->brightness), "/sys/class/backlight/%s/brightness", best_controller);
102 102
         snprintf(dev_data->max_brightness, sizeof(dev_data->max_brightness), "/sys/class/backlight/%s/max_brightness", best_controller);
103
-        
104
-        // Create a new device target for the controller 
103
+
104
+        // Create a new device target for the controller
105 105
         light_create_device_target(backlight_device, "auto", impl_sysfs_set, impl_sysfs_get, impl_sysfs_getmax, impl_sysfs_command, dev_data);
106 106
     }
107
-    
107
+
108 108
     return true;
109 109
 }
110 110
 
111 111
 bool impl_sysfs_init(light_device_enumerator_t *enumerator)
112 112
 {
113
-    // Create a device for the backlight 
113
+    // Create a device for the backlight
114 114
     _impl_sysfs_init_backlight(enumerator);
115
-    
115
+
116 116
     // Create devices for the leds
117 117
     _impl_sysfs_init_leds(enumerator);
118
-    
118
+
119 119
     return true;
120 120
 }
121 121
 
@@ -133,7 +133,7 @@ bool impl_sysfs_set(light_device_target_t *target, uint64_t in_value)
133 133
         LIGHT_ERR("failed to write to sysfs device");
134 134
         return false;
135 135
     }
136
-    
136
+
137 137
     return true;
138 138
 }
139 139
 
@@ -146,7 +146,7 @@ bool impl_sysfs_get(light_device_target_t *target, uint64_t *out_value)
146 146
         LIGHT_ERR("failed to read from sysfs device");
147 147
         return false;
148 148
     }
149
-    
149
+
150 150
     return true;
151 151
 }
152 152
 
@@ -159,7 +159,7 @@ bool impl_sysfs_getmax(light_device_target_t *target, uint64_t *out_value)
159 159
         LIGHT_ERR("failed to read from sysfs device");
160 160
         return false;
161 161
     }
162
-    
162
+
163 163
     return true;
164 164
 }
165 165
 

+ 2
- 2
src/impl/sysfs.h Прегледај датотеку

@@ -1,12 +1,12 @@
1 1
 
2
-#pragma once 
2
+#pragma once
3 3
 
4 4
 #include "light.h"
5 5
 
6 6
 // Implementation of the sysfs enumerator
7 7
 // Enumerates devices for backlights and leds
8 8
 
9
-// Device target data 
9
+// Device target data
10 10
 struct _impl_sysfs_data_t
11 11
 {
12 12
     char brightness[NAME_MAX];

+ 1
- 1
src/impl/util.h Прегледај датотеку

@@ -1,5 +1,5 @@
1 1
 
2
-#pragma once 
2
+#pragma once
3 3
 
4 4
 #include "light.h"
5 5
 

+ 117
- 117
src/light.c Прегледај датотеку

@@ -20,25 +20,25 @@
20 20
 
21 21
 static void _light_add_enumerator_device(light_device_enumerator_t *enumerator, light_device_t *new_device)
22 22
 {
23
-    // Create a new device array 
23
+    // Create a new device array
24 24
     uint64_t new_num_devices = enumerator->num_devices + 1;
25 25
     light_device_t **new_devices = malloc(new_num_devices * sizeof(light_device_t*));
26
-    
26
+
27 27
     // Copy old device array to new one
28 28
     for(uint64_t i = 0; i < enumerator->num_devices; i++)
29 29
     {
30 30
         new_devices[i] = enumerator->devices[i];
31 31
     }
32
-    
32
+
33 33
     // Set the new device
34 34
     new_devices[enumerator->num_devices] = new_device;
35
-    
35
+
36 36
     // Free the old devices array, if needed
37 37
     if(enumerator->devices != NULL)
38 38
     {
39 39
         free(enumerator->devices);
40 40
     }
41
-    
41
+
42 42
     // Replace the devices array with the new one
43 43
     enumerator->devices = new_devices;
44 44
     enumerator->num_devices = new_num_devices;
@@ -46,25 +46,25 @@ static void _light_add_enumerator_device(light_device_enumerator_t *enumerator,
46 46
 
47 47
 static void _light_add_device_target(light_device_t *device, light_device_target_t *new_target)
48 48
 {
49
-    // Create a new targets array 
49
+    // Create a new targets array
50 50
     uint64_t new_num_targets = device->num_targets + 1;
51 51
     light_device_target_t **new_targets = malloc(new_num_targets * sizeof(light_device_target_t*));
52
-    
52
+
53 53
     // Copy old targets array to new one
54 54
     for(uint64_t i = 0; i < device->num_targets; i++)
55 55
     {
56 56
         new_targets[i] = device->targets[i];
57 57
     }
58
-    
58
+
59 59
     // Set the new target
60 60
     new_targets[device->num_targets] = new_target;
61
-    
61
+
62 62
     // Free the old targets array, if needed
63 63
     if(device->targets != NULL)
64 64
     {
65 65
         free(device->targets);
66 66
     }
67
-    
67
+
68 68
     // Replace the targets array with the new one
69 69
     device->targets= new_targets;
70 70
     device->num_targets = new_num_targets;
@@ -103,7 +103,7 @@ static uint64_t _light_get_min_cap(light_context_t *ctx)
103 103
     {
104 104
         return 0;
105 105
     }
106
-    
106
+
107 107
     return minimum_value;
108 108
 }
109 109
 
@@ -116,7 +116,7 @@ static light_device_enumerator_t* _light_find_enumerator(light_context_t *ctx, c
116 116
             return ctx->enumerators[e];
117 117
         }
118 118
     }
119
-    
119
+
120 120
     return NULL;
121 121
 }
122 122
 
@@ -129,7 +129,7 @@ static light_device_t* _light_find_device(light_device_enumerator_t *en, char co
129 129
             return en->devices[d];
130 130
         }
131 131
     }
132
-    
132
+
133 133
     return NULL;
134 134
 }
135 135
 
@@ -142,7 +142,7 @@ static light_device_target_t* _light_find_target(light_device_t * dev, char cons
142 142
             return dev->targets[t];
143 143
         }
144 144
     }
145
-    
145
+
146 146
     return NULL;
147 147
 }
148 148
 
@@ -158,7 +158,7 @@ static bool _light_raw_to_percent(light_device_target_t *target, uint64_t inraw,
158 158
         double max_value_d = (double)max_value;
159 159
         double percent = light_percent_clamp((inraw_d / max_value_d) * 100.0);
160 160
         *outpercent = percent;
161
-        
161
+
162 162
         return true;
163 163
 }
164 164
 
@@ -175,7 +175,7 @@ static bool _light_percent_to_raw(light_device_target_t *target, double inpercen
175 175
     double target_value_d = max_value_d * (light_percent_clamp(inpercent) / 100.0);
176 176
     uint64_t target_value = LIGHT_CLAMP((uint64_t)target_value_d, 0, max_value);
177 177
     *outraw = target_value;
178
-    
178
+
179 179
     return true;
180 180
 }
181 181
 
@@ -188,9 +188,9 @@ static void _light_print_usage()
188 188
         "  -H, -h      Show this help and exit\n"
189 189
         "  -V          Show program version and exit\n"
190 190
         "  -L          List available devices\n"
191
-        
191
+
192 192
         "  -A          Increase brightness by value\n"
193
-        "  -U          Decrease brightness by value\n" 
193
+        "  -U          Decrease brightness by value\n"
194 194
         "  -T          Multiply brightness by value (can be a non-whole number, ignores raw mode)\n"
195 195
         "  -S          Set brightness to value\n"
196 196
         "  -G          Get brightness\n"
@@ -224,7 +224,7 @@ static bool _light_set_context_command(light_context_t *ctx, LFUNCCOMMAND new_cm
224 224
         LIGHT_WARN("a command was already set. ignoring.");
225 225
         return false;
226 226
     }
227
-    
227
+
228 228
     ctx->run_params.command = new_cmd;
229 229
     return true;
230 230
 }
@@ -233,20 +233,20 @@ static bool _light_parse_arguments(light_context_t *ctx, int argc, char** argv)
233 233
 {
234 234
     int32_t curr_arg = -1;
235 235
     int32_t log_level = 0;
236
-    
236
+
237 237
     char ctrl_name[NAME_MAX];
238 238
     bool need_value = false;
239 239
     bool need_float_value = false;
240 240
     bool need_target = true; // default cmd is get brightness
241 241
     bool specified_target = false;
242 242
     snprintf(ctrl_name, sizeof(ctrl_name), "%s", "sysfs/backlight/auto");
243
-    
243
+
244 244
     while((curr_arg = getopt(argc, argv, "HhVGSLMNPAUTOIv:s:r")) != -1)
245 245
     {
246 246
         switch(curr_arg)
247 247
         {
248 248
             // Options
249
-            
249
+
250 250
             case 'v':
251 251
                 if (sscanf(optarg, "%i", &log_level) != 1)
252 252
                 {
@@ -254,14 +254,14 @@ static bool _light_parse_arguments(light_context_t *ctx, int argc, char** argv)
254 254
                     _light_print_usage();
255 255
                     return false;
256 256
                 }
257
-                
257
+
258 258
                 if (log_level < 0 || log_level > 3)
259 259
                 {
260 260
                     fprintf(stderr, "-v argument must be between 0 and 3.\n\n");
261 261
                     _light_print_usage();
262 262
                     return false;
263 263
                 }
264
-                
264
+
265 265
                 light_loglevel = (light_loglevel_t)log_level;
266 266
                 break;
267 267
             case 's':
@@ -271,7 +271,7 @@ static bool _light_parse_arguments(light_context_t *ctx, int argc, char** argv)
271 271
             case 'r':
272 272
                 ctx->run_params.raw_mode = true;
273 273
                 break;
274
-            
274
+
275 275
             // Commands
276 276
             case 'H':
277 277
             case 'h':
@@ -335,7 +335,7 @@ static bool _light_parse_arguments(light_context_t *ctx, int argc, char** argv)
335 335
     {
336 336
         _light_set_context_command(ctx, light_cmd_get_brightness);
337 337
     }
338
-    
338
+
339 339
     if(need_target)
340 340
     {
341 341
         light_device_target_t *curr_target = light_find_device_target(ctx, ctrl_name);
@@ -346,13 +346,13 @@ static bool _light_parse_arguments(light_context_t *ctx, int argc, char** argv)
346 346
                 fprintf(stderr, "We couldn't find the specified device target at the path \"%s\". Use -L to find one.\n\n", ctrl_name);
347 347
                 return false;
348 348
             }
349
-            else 
349
+            else
350 350
             {
351 351
                 fprintf(stderr, "No backlight controller was found, so we could not decide an automatic target. The current command will have no effect. Please use -L to find a target and then specify it with -s.\n\n");
352 352
                 curr_target = light_find_device_target(ctx, "util/test/dryrun");
353 353
             }
354 354
         }
355
-        
355
+
356 356
         ctx->run_params.device_target = curr_target;
357 357
     }
358 358
 
@@ -386,16 +386,16 @@ static bool _light_parse_arguments(light_context_t *ctx, int argc, char** argv)
386 386
                 _light_print_usage();
387 387
                 return false;
388 388
             }
389
-            
389
+
390 390
             percent_value = light_percent_clamp(percent_value);
391
-            
391
+
392 392
             uint64_t raw_value = 0;
393 393
             if(!_light_percent_to_raw(ctx->run_params.device_target, percent_value, &raw_value))
394 394
             {
395 395
                 LIGHT_ERR("failed to convert from percent to raw for device target");
396 396
                 return false;
397 397
             }
398
-            
398
+
399 399
             ctx->run_params.value = raw_value;
400 400
         }
401 401
     }
@@ -411,7 +411,7 @@ static bool _light_parse_arguments(light_context_t *ctx, int argc, char** argv)
411 411
     }
412 412
 
413 413
     return true;
414
-    
414
+
415 415
 }
416 416
 
417 417
 
@@ -440,7 +440,7 @@ light_context_t* light_initialize(int argc, char **argv)
440 440
     else
441 441
     {
442 442
         char *xdg_conf = getenv("XDG_CONFIG_HOME");
443
-        
443
+
444 444
         if (xdg_conf != NULL)
445 445
         {
446 446
             snprintf(new_ctx->sys_params.conf_dir, sizeof(new_ctx->sys_params.conf_dir), "%s/light", xdg_conf);
@@ -450,7 +450,7 @@ light_context_t* light_initialize(int argc, char **argv)
450 450
             snprintf(new_ctx->sys_params.conf_dir, sizeof(new_ctx->sys_params.conf_dir), "%s/.config/light", getenv("HOME"));
451 451
         }
452 452
     }
453
-    
453
+
454 454
     // Make sure the configuration folder exists, otherwise attempt to create it
455 455
     int32_t rc = light_mkpath(new_ctx->sys_params.conf_dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
456 456
     if (rc && errno != EEXIST)
@@ -458,7 +458,7 @@ light_context_t* light_initialize(int argc, char **argv)
458 458
         LIGHT_WARN("couldn't create configuration directory");
459 459
         return false;
460 460
     }
461
-    
461
+
462 462
     // Create the built-in enumerators
463 463
     light_create_enumerator(new_ctx, "sysfs", &impl_sysfs_init, &impl_sysfs_free);
464 464
     light_create_enumerator(new_ctx, "util", &impl_util_init, &impl_util_free);
@@ -480,7 +480,7 @@ light_context_t* light_initialize(int argc, char **argv)
480 480
         LIGHT_ERR("failed to parse arguments");
481 481
         return NULL;
482 482
     }
483
-    
483
+
484 484
     return new_ctx;
485 485
 }
486 486
 
@@ -491,7 +491,7 @@ bool light_execute(light_context_t *ctx)
491 491
         LIGHT_ERR("run parameters command was null, can't execute");
492 492
         return false;
493 493
     }
494
-    
494
+
495 495
     return ctx->run_params.command(ctx);
496 496
 }
497 497
 
@@ -501,42 +501,42 @@ void light_free(light_context_t *ctx)
501 501
     {
502 502
         LIGHT_WARN("failed to free all enumerators");
503 503
     }
504
-    
504
+
505 505
     free(ctx);
506 506
 }
507 507
 
508 508
 light_device_enumerator_t * light_create_enumerator(light_context_t *ctx, char const * name, LFUNCENUMINIT init_func, LFUNCENUMFREE free_func)
509 509
 {
510
-    // Create a new enumerator array 
510
+    // Create a new enumerator array
511 511
     uint64_t new_num_enumerators = ctx->num_enumerators + 1;
512 512
     light_device_enumerator_t **new_enumerators = malloc(new_num_enumerators * sizeof(light_device_enumerator_t*));
513
-    
513
+
514 514
     // Copy old enumerator array to new one
515 515
     for(uint64_t i = 0; i < ctx->num_enumerators; i++)
516 516
     {
517 517
         new_enumerators[i] = ctx->enumerators[i];
518 518
     }
519
-    
519
+
520 520
     // Allocate the new enumerator
521 521
     new_enumerators[ctx->num_enumerators] = malloc(sizeof(light_device_enumerator_t));
522 522
     light_device_enumerator_t *returner = new_enumerators[ctx->num_enumerators];
523
-    
523
+
524 524
     returner->devices = NULL;
525 525
     returner->num_devices = 0;
526 526
     returner->init = init_func;
527 527
     returner->free = free_func;
528 528
     snprintf(returner->name, sizeof(returner->name), "%s", name);
529
-    
529
+
530 530
     // Free the old enumerator array, if needed
531 531
     if(ctx->enumerators != NULL)
532 532
     {
533 533
         free(ctx->enumerators);
534 534
     }
535
-    
535
+
536 536
     // Replace the enumerator array with the new one
537 537
     ctx->enumerators = new_enumerators;
538 538
     ctx->num_enumerators = new_num_enumerators;
539
-    
539
+
540 540
     // Return newly created device
541 541
     return returner;
542 542
 }
@@ -552,7 +552,7 @@ bool light_init_enumerators(light_context_t *ctx)
552 552
             success = false;
553 553
         }
554 554
     }
555
-    
555
+
556 556
     return success;
557 557
 }
558 558
 
@@ -562,30 +562,30 @@ bool light_free_enumerators(light_context_t *ctx)
562 562
     for(uint64_t i = 0; i < ctx->num_enumerators; i++)
563 563
     {
564 564
         light_device_enumerator_t * curr_enumerator = ctx->enumerators[i];
565
-        
565
+
566 566
         if(!curr_enumerator->free(curr_enumerator))
567 567
         {
568 568
             success = false;
569 569
         }
570
-        
570
+
571 571
         if(curr_enumerator->devices != NULL)
572 572
         {
573 573
             for(uint64_t d = 0; d < curr_enumerator->num_devices; d++)
574 574
             {
575 575
                 light_delete_device(curr_enumerator->devices[d]);
576 576
             }
577
-            
577
+
578 578
             free(curr_enumerator->devices);
579 579
             curr_enumerator->devices = NULL;
580 580
         }
581
-        
581
+
582 582
         free(curr_enumerator);
583 583
     }
584
-    
584
+
585 585
     free(ctx->enumerators);
586 586
     ctx->enumerators = NULL;
587 587
     ctx->num_enumerators = 0;
588
-    
588
+
589 589
     return success;
590 590
 }
591 591
 
@@ -598,11 +598,11 @@ bool light_split_target_path(char const *in_path, light_target_path_t *out_path)
598 598
         LIGHT_WARN("invalid path passed to split_target_path");
599 599
         return false;
600 600
     }
601
-    
601
+
602 602
     size_t size = end - begin;
603 603
     strncpy(out_path->enumerator, begin, size);
604 604
     out_path->enumerator[size] = '\0';
605
-    
605
+
606 606
     begin = end + 1;
607 607
     end = strstr(begin, "/");
608 608
     if(end == NULL)
@@ -610,13 +610,13 @@ bool light_split_target_path(char const *in_path, light_target_path_t *out_path)
610 610
         LIGHT_WARN("invalid path passed to split_target_path");
611 611
         return false;
612 612
     }
613
-    
613
+
614 614
     size = end - begin;
615 615
     strncpy(out_path->device, begin, size);
616 616
     out_path->device[size] = '\0';
617
-    
617
+
618 618
     strcpy(out_path->target, end + 1);
619
-    
619
+
620 620
     return true;
621 621
 }
622 622
 
@@ -628,7 +628,7 @@ light_device_target_t* light_find_device_target(light_context_t *ctx, char const
628 628
         LIGHT_WARN("light_find_device_target needs a path in the format of \"enumerator/device/target\", the following format is not recognized:  \"%s\"", name);
629 629
         return NULL;
630 630
     }
631
-    
631
+
632 632
     /*
633 633
     Uncomment to debug the split function
634 634
     printf("enumerator: %s %u\ndevice: %s %u\ntarget: %s %u\n",
@@ -636,30 +636,30 @@ light_device_target_t* light_find_device_target(light_context_t *ctx, char const
636 636
             new_path.device, strlen(new_path.device),
637 637
             new_path.target, strlen(new_path.target));
638 638
     */
639
-    
640
-    // find a matching enumerator 
641
-    
639
+
640
+    // find a matching enumerator
641
+
642 642
     light_device_enumerator_t *enumerator = _light_find_enumerator(ctx, new_path.enumerator);
643 643
     if(enumerator == NULL)
644 644
     {
645 645
         LIGHT_WARN("no such enumerator, \"%s\"", new_path.enumerator);
646 646
         return NULL;
647 647
     }
648
-    
648
+
649 649
     light_device_t *device = _light_find_device(enumerator, new_path.device);
650 650
     if(device == NULL)
651 651
     {
652 652
         LIGHT_WARN("no such device, \"%s\"", new_path.device);
653 653
         return NULL;
654 654
     }
655
-    
655
+
656 656
     light_device_target_t *target = _light_find_target(device, new_path.target);
657 657
     if(target == NULL)
658 658
     {
659 659
         LIGHT_WARN("no such target, \"%s\"", new_path.target);
660 660
         return NULL;
661 661
     }
662
-    
662
+
663 663
     return target;
664 664
 }
665 665
 
@@ -687,12 +687,12 @@ bool light_cmd_list_devices(light_context_t *ctx)
687 687
             for(uint64_t target = 0; target < curr_device->num_targets; target++)
688 688
             {
689 689
                 light_device_target_t *curr_target = curr_device->targets[target];
690
-                
690
+
691 691
                 printf("\t%s/%s/%s\n", curr_enumerator->name, curr_device->name, curr_target->name);
692 692
             }
693 693
         }
694 694
     }
695
-    
695
+
696 696
     return true;
697 697
 }
698 698
 
@@ -704,21 +704,21 @@ bool light_cmd_set_brightness(light_context_t *ctx)
704 704
         LIGHT_ERR("didn't have a valid target, programmer mistake");
705 705
         return false;
706 706
     }
707
-    
708
-    
707
+
708
+
709 709
     uint64_t mincap = _light_get_min_cap(ctx);
710 710
     uint64_t value = ctx->run_params.value;
711 711
     if(mincap > value)
712 712
     {
713 713
         value = mincap;
714 714
     }
715
-    
715
+
716 716
     if(!target->set_value(target, value))
717 717
     {
718 718
         LIGHT_ERR("failed to write to target");
719 719
         return false;
720 720
     }
721
-    
721
+
722 722
     return true;
723 723
 }
724 724
 
@@ -730,19 +730,19 @@ bool light_cmd_get_brightness(light_context_t *ctx)
730 730
         LIGHT_ERR("didn't have a valid target, programmer mistake");
731 731
         return false;
732 732
     }
733
-    
733
+
734 734
     uint64_t value = 0;
735 735
     if(!target->get_value(target, &value))
736 736
     {
737 737
         LIGHT_ERR("failed to read from target");
738 738
         return false;
739 739
     }
740
-    
740
+
741 741
     if(ctx->run_params.raw_mode)
742 742
     {
743 743
         printf("%" PRIu64 "\n", value);
744 744
     }
745
-    else 
745
+    else
746 746
     {
747 747
         double percent = 0.0;
748 748
         if(!_light_raw_to_percent(target, value, &percent))
@@ -752,7 +752,7 @@ bool light_cmd_get_brightness(light_context_t *ctx)
752 752
         }
753 753
         printf("%.2f\n", percent);
754 754
     }
755
-    
755
+
756 756
     return true;
757 757
 }
758 758
 
@@ -764,20 +764,20 @@ bool light_cmd_get_max_brightness(light_context_t *ctx)
764 764
         LIGHT_ERR("didn't have a valid target, programmer mistake");
765 765
         return false;
766 766
     }
767
-    
767
+
768 768
     if(!ctx->run_params.raw_mode)
769 769
     {
770 770
         printf("100.0\n");
771 771
         return true;
772 772
     }
773
-    
773
+
774 774
     uint64_t max_value = 0;
775 775
     if(!target->get_max_value(target, &max_value))
776 776
     {
777 777
         LIGHT_ERR("failed to read from device target");
778 778
         return false;
779 779
     }
780
-    
780
+
781 781
     printf("%" PRIu64 "\n", max_value);
782 782
     return true;
783 783
 }
@@ -786,7 +786,7 @@ bool light_cmd_set_min_brightness(light_context_t *ctx)
786 786
 {
787 787
     char target_path[NAME_MAX];
788 788
     _light_get_target_path(ctx, target_path, sizeof(target_path));
789
-    
789
+
790 790
     // Make sure the target folder exists, otherwise attempt to create it
791 791
     int32_t rc = light_mkpath(target_path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
792 792
     if (rc && errno != EEXIST)
@@ -794,16 +794,16 @@ bool light_cmd_set_min_brightness(light_context_t *ctx)
794 794
         LIGHT_ERR("couldn't create target directory for minimum brightness");
795 795
         return false;
796 796
     }
797
-    
797
+
798 798
     char target_filepath[NAME_MAX];
799 799
     _light_get_target_file(ctx, target_filepath, sizeof(target_filepath), "minimum");
800
-    
800
+
801 801
     if(!light_file_write_uint64(target_filepath, ctx->run_params.value))
802 802
     {
803 803
         LIGHT_ERR("couldn't write value to minimum file");
804 804
         return false;
805 805
     }
806
-    
806
+
807 807
     return true;
808 808
 }
809 809
 
@@ -819,19 +819,19 @@ bool light_cmd_get_min_brightness(light_context_t *ctx)
819 819
         {
820 820
             printf("0\n");
821 821
         }
822
-        else 
822
+        else
823 823
         {
824 824
             printf("0.00\n");
825 825
         }
826 826
 
827 827
         return true;
828 828
     }
829
-    
829
+
830 830
     if(ctx->run_params.raw_mode)
831 831
     {
832 832
         printf("%" PRIu64 "\n", minimum_value);
833 833
     }
834
-    else 
834
+    else
835 835
     {
836 836
         double minimum_d = 0.0;
837 837
         if(!_light_raw_to_percent(ctx->run_params.device_target, minimum_value, &minimum_d))
@@ -839,10 +839,10 @@ bool light_cmd_get_min_brightness(light_context_t *ctx)
839 839
             LIGHT_ERR("failed to convert value from raw to percent for device target");
840 840
             return false;
841 841
         }
842
-        
842
+
843 843
         printf("%.2f\n", minimum_d);
844 844
     }
845
-    
845
+
846 846
     return true;
847 847
 }
848 848
 
@@ -854,41 +854,41 @@ bool light_cmd_add_brightness(light_context_t *ctx)
854 854
         LIGHT_ERR("didn't have a valid target, programmer mistake");
855 855
         return false;
856 856
     }
857
-    
857
+
858 858
     uint64_t value = 0;
859 859
     if(!target->get_value(target, &value))
860 860
     {
861 861
         LIGHT_ERR("failed to read from target");
862 862
         return false;
863 863
     }
864
-    
864
+
865 865
     uint64_t max_value = 0;
866 866
     if(!target->get_max_value(target, &max_value))
867 867
     {
868 868
         LIGHT_ERR("failed to read from target");
869 869
         return false;
870 870
     }
871
-    
871
+
872 872
     value += ctx->run_params.value;
873
-    
873
+
874 874
     uint64_t mincap = _light_get_min_cap(ctx);
875 875
     if(mincap > value)
876 876
     {
877 877
         value = mincap;
878 878
     }
879
-    
880
-    
879
+
880
+
881 881
     if(value > max_value)
882 882
     {
883 883
         value = max_value;
884 884
     }
885
-    
885
+
886 886
     if(!target->set_value(target, value))
887 887
     {
888 888
         LIGHT_ERR("failed to write to target");
889 889
         return false;
890 890
     }
891
-    
891
+
892 892
     return true;
893 893
 }
894 894
 
@@ -900,23 +900,23 @@ bool light_cmd_sub_brightness(light_context_t *ctx)
900 900
         LIGHT_ERR("didn't have a valid target, programmer mistake");
901 901
         return false;
902 902
     }
903
-    
903
+
904 904
     uint64_t value = 0;
905 905
     if(!target->get_value(target, &value))
906 906
     {
907 907
         LIGHT_ERR("failed to read from target");
908 908
         return false;
909 909
     }
910
-    
910
+
911 911
     if(value > ctx->run_params.value)
912 912
     {
913 913
         value -= ctx->run_params.value;
914 914
     }
915
-    else 
915
+    else
916 916
     {
917 917
         value = 0;
918 918
     }
919
-    
919
+
920 920
     uint64_t mincap = _light_get_min_cap(ctx);
921 921
     if(mincap > value)
922 922
     {
@@ -928,7 +928,7 @@ bool light_cmd_sub_brightness(light_context_t *ctx)
928 928
         LIGHT_ERR("failed to write to target");
929 929
         return false;
930 930
     }
931
-    
931
+
932 932
     return true;
933 933
 }
934 934
 
@@ -957,7 +957,7 @@ bool light_cmd_mul_brightness(light_context_t *ctx)
957 957
 
958 958
     uint64_t old_value = value;
959 959
     value *= ctx->run_params.float_value;
960
- 
960
+
961 961
     // Check that we actually de/increase value
962 962
     if(value == old_value)
963 963
     {
@@ -991,7 +991,7 @@ bool light_cmd_save_brightness(light_context_t *ctx)
991 991
 {
992 992
     char target_path[NAME_MAX];
993 993
     _light_get_target_path(ctx, target_path, sizeof(target_path));
994
-    
994
+
995 995
     // Make sure the target folder exists, otherwise attempt to create it
996 996
     int32_t rc = light_mkpath(target_path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
997 997
     if (rc && errno != EEXIST)
@@ -999,7 +999,7 @@ bool light_cmd_save_brightness(light_context_t *ctx)
999 999
         LIGHT_ERR("couldn't create target directory for save brightness");
1000 1000
         return false;
1001 1001
     }
1002
-    
1002
+
1003 1003
     char target_filepath[NAME_MAX];
1004 1004
     _light_get_target_file(ctx, target_filepath, sizeof(target_filepath), "save");
1005 1005
 
@@ -1009,13 +1009,13 @@ bool light_cmd_save_brightness(light_context_t *ctx)
1009 1009
         LIGHT_ERR("couldn't read from device target");
1010 1010
         return false;
1011 1011
     }
1012
-    
1012
+
1013 1013
     if(!light_file_write_uint64(target_filepath, curr_value))
1014 1014
     {
1015 1015
         LIGHT_ERR("couldn't write value to savefile");
1016 1016
         return false;
1017 1017
     }
1018
-    
1018
+
1019 1019
     return true;
1020 1020
 }
1021 1021
 
@@ -1030,19 +1030,19 @@ bool light_cmd_restore_brightness(light_context_t *ctx)
1030 1030
         LIGHT_ERR("couldn't read value from savefile");
1031 1031
         return false;
1032 1032
     }
1033
-    
1033
+
1034 1034
     uint64_t mincap = _light_get_min_cap(ctx);
1035 1035
     if(mincap > saved_value)
1036 1036
     {
1037 1037
         saved_value = mincap;
1038 1038
     }
1039
-    
1039
+
1040 1040
     if(!ctx->run_params.device_target->set_value(ctx->run_params.device_target, saved_value))
1041 1041
     {
1042 1042
         LIGHT_ERR("couldn't write saved value to device target");
1043 1043
         return false;
1044 1044
     }
1045
-    
1045
+
1046 1046
     return true;
1047 1047
 }
1048 1048
 
@@ -1053,11 +1053,11 @@ light_device_t *light_create_device(light_device_enumerator_t *enumerator, char
1053 1053
     new_device->targets = NULL;
1054 1054
     new_device->num_targets = 0;
1055 1055
     new_device->device_data = device_data;
1056
-    
1056
+
1057 1057
     snprintf(new_device->name, sizeof(new_device->name), "%s", name);
1058
-    
1058
+
1059 1059
     _light_add_enumerator_device(enumerator, new_device);
1060
-    
1060
+
1061 1061
     return new_device;
1062 1062
 }
1063 1063
 
@@ -1067,17 +1067,17 @@ void light_delete_device(light_device_t *device)
1067 1067
     {
1068 1068
         light_delete_device_target(device->targets[i]);
1069 1069
     }
1070
-    
1070
+
1071 1071
     if(device->targets != NULL)
1072 1072
     {
1073 1073
         free(device->targets);
1074 1074
     }
1075
-    
1075
+
1076 1076
     if(device->device_data != NULL)
1077 1077
     {
1078 1078
         free(device->device_data);
1079 1079
     }
1080
-    
1080
+
1081 1081
     free(device);
1082 1082
 }
1083 1083
 
@@ -1090,11 +1090,11 @@ light_device_target_t *light_create_device_target(light_device_t *device, char c
1090 1090
     new_target->get_max_value = getmaxfunc;
1091 1091
     new_target->custom_command = cmdfunc;
1092 1092
     new_target->device_target_data = target_data;
1093
-    
1093
+
1094 1094
     snprintf(new_target->name, sizeof(new_target->name), "%s", name);
1095
-    
1095
+
1096 1096
     _light_add_device_target(device, new_target);
1097
-    
1097
+
1098 1098
     return new_target;
1099 1099
 }
1100 1100
 
@@ -1104,6 +1104,6 @@ void light_delete_device_target(light_device_target_t *device_target)
1104 1104
     {
1105 1105
         free(device_target->device_target_data);
1106 1106
     }
1107
-    
1107
+
1108 1108
     free(device_target);
1109 1109
 }

+ 5
- 5
src/light.h Прегледај датотеку

@@ -70,7 +70,7 @@ typedef bool (*LFUNCCOMMAND)(light_context_t *);
70 70
 
71 71
 struct _light_context_t
72 72
 {
73
-    struct 
73
+    struct
74 74
     {
75 75
         LFUNCCOMMAND            command; // What command was issued
76 76
         // Only one of value and raw_value is populated; which one depends on the command
@@ -82,15 +82,15 @@ struct _light_context_t
82 82
 
83 83
     struct
84 84
     {
85
-        char                    conf_dir[NAME_MAX]; // The path to the application cache directory 
85
+        char                    conf_dir[NAME_MAX]; // The path to the application cache directory
86 86
     } sys_params;
87
-    
87
+
88 88
     light_device_enumerator_t   **enumerators;
89 89
     uint64_t                    num_enumerators;
90 90
 };
91 91
 
92 92
 // The different available commands
93
-bool light_cmd_print_help(light_context_t *ctx); // H,h 
93
+bool light_cmd_print_help(light_context_t *ctx); // H,h
94 94
 bool light_cmd_print_version(light_context_t *ctx); // V
95 95
 bool light_cmd_list_devices(light_context_t *ctx); // L
96 96
 bool light_cmd_set_brightness(light_context_t *ctx); // S
@@ -135,7 +135,7 @@ light_device_target_t *light_create_device_target(light_device_t *device, char c
135 135
 void light_delete_device_target(light_device_target_t *device_target);
136 136
 
137 137
 typedef struct _light_target_path_t light_target_path_t;
138
-struct _light_target_path_t 
138
+struct _light_target_path_t
139 139
 {
140 140
     char enumerator[NAME_MAX];
141 141
     char device[NAME_MAX];