字體:小 中 大 | |
|
|
2020/12/15 16:24:05瀏覽55|回應0|推薦0 | |
#include #include #include #include #include #define LED_NODE "/sys/class/leds/status0:red:cpu0/brightness" int main(void){ int fd,i1; char cbuf[20]; printf("%s\n",LED_NODE); fd=open(LED_NODE,O_WRONLY); if (fd<0){ br=""> printf("!!! open file err\n"); return 1; } i1=snprintf(cbuf,sizeof(cbuf),"1"); write(fd, cbuf,i1); fsync(fd); sleep(1); i1=snprintf(cbuf,sizeof(cbuf),"0"); write(fd, cbuf,i1); fsync(fd); close(fd); return 0; } |
|
( 不分類|不分類 ) |