I send you many thanks
I had it in my archive and didn't realize it
the original source is credited to cyph
Code:
#include <linux/led.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
int main(int argc, char **argv) {
int led;
struct led_info li;
struct led_op lo;
int ret;
/* if(!argv[1]) {
printf("Usage: %s <color_code>\n", argv[0]);
printf("On e680 <color_code> should be 0-100\n", argv[0]);
return(0);
}
*/
led = open("/dev/led", O_RDWR);
/* if(led == -1) {
perror("cannot open led device: ");
return(0);
}
*/
ret = ioctl(led, LEDIOC_GETCOUNT);
// printf("%d LEDs detected\n", ret);
li.led_num = 0;
ioctl(led, LEDIOC_GETINFO_BY_NUM, &li);
// printf("Name : %s\n", li.name);
// printf("Type : %d\n", li.type);
lo.op = SET_LED;
strcpy(lo.name, li.name);
lo.op_info.bicolor.color = atoi(argv[1]);
ret = ioctl(led, LEDIOC_OP, &lo);
/* if(ret == -1) {
perror("LEDIOC_OP: ");
}
*/
return 0;
}
anyone willing to recompile the following for me?
I commented out some error check and some printf() statements
so the new compiled code will be a few bytes shorter