Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <errno.h>
- #include <fcntl.h>
- #define LEDSYSFILE "/sys/class/leds/led1/brightness"
- int main(void) {
- int fd;
- ssize_t ret;
- char buf[1024];
- snprintf(buf, sizeof(buf), "%d\n", 1);
- fd = open(LEDSYSFILE, O_RDWR);
- if (fd < 0) {
- perror("open()");
- return -errno;
- }
- ret = write(fd, buf, strlen(buf));
- printf("write() returned: %d\n", ret);
- close(fd);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement