/* * uledmon.c * * This program creates a new userspace LED class device and monitors it. A * timestamp and brightness value is printed each time the brightness changes. * * Usage: uledmon * * is the name of the LED class device to be created. Pressing * CTRL+C will exit. */ #include #include #include #include #include #include int main(int argc, char const *argv[]) { struct uleds_user_dev uleds_dev; int fd, ret; int brightness; struct timespec ts; if (argc != 2) { fprintf(stderr, "Requires argument\n"); return 1; } strncpy(uleds_dev.name, argv[1], LED_MAX_NAME_SIZE); uleds_dev.max_brightness = 100; fd = open("/dev/uleds", O_RDWR); if (fd == -1) { perror("Failed to open /dev/uleds"); return 1; } ret = write(fd, &uleds_dev, sizeof(uleds_dev)); if (ret == -1) { perror("Failed to write to /dev/uleds"); close(fd); return 1; } while (1) { ret = read(fd, &brightness, sizeof(brightness)); if (ret == -1) { perror("Failed to read from /dev/uleds"); close(fd); return 1; } clock_gettime(CLOCK_MONOTONIC, &ts); printf("[%ld.%09ld] %u\n", ts.tv_sec, ts.tv_nsec, brightness); } close(fd); return 0; } packet-loop-back net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2016-10-21 16:40:05 +0800
committerMark Brown <broonie@kernel.org>2016-10-24 17:49:14 +0100
commite98d5fef8556f1da7f903fd1908feed84bb0f90d (patch)
tree95a1268df894d6150ee31f5e97cbcb0c0ab32cc4 /net/mac80211
parent1001354ca34179f3db924eb66672442a173147dc (diff)
regulator: tps6507x: Drop pointless static qualifier for *reg_data variable
There is no need to use static for this local variable. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'net/mac80211')