aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Mykyta Holubakha <hilobakho@gmail.com>2016-06-22 13:48:57 +0300
committerGravatar Mykyta Holubakha <hilobakho@gmail.com>2016-06-22 13:48:57 +0300
commitc9140d1e5070dae2746d3b70c0390075bd5380f6 (patch)
treef59d358261da4ab6d5ce3f1ef17377c7f2675378
parent4a474de96b61c44793598870953e203fb624a8bd (diff)
default device is the first
-rw-r--r--brightnessctl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/brightnessctl.c b/brightnessctl.c
index f3f939d..635d1a8 100644
--- a/brightnessctl.c
+++ b/brightnessctl.c
@@ -13,7 +13,6 @@
static char *path = "/sys/class";
static char *classes[] = { "backlight", "leds", NULL };
-static char *default_device = "acpi_video0";
static char *run_dir = "/tmp/brightnessctl";
@@ -150,7 +149,7 @@ int main(int argc, char **argv) {
if (p.list) {
return list_devices(devs);
}
- dev_name = p.device ? p.device : default_device;
+ dev_name = p.device;
if (argc == 0)
p.operation = GET;
else switch (argv[0][0]) {
@@ -235,6 +234,8 @@ int parse_value(struct value *val, char *str) {
struct device *find_device(struct device **devs, char *name) {
struct device *dev;
+ if (!name)
+ return *devs;
while ((dev = *(devs++)))
if (!strcmp(dev->id, name))
return dev;