Well done, thanks. Managed to fix the HDD LED on my crappy DS107 running the latest totally unsupported DSM-4.0. Somehow setting the LED to green solid on boot in rc.local makes the junky scemd thing show disk activity perfectly fine. The status led can be manipulated as well, but that is more like cosmetics.
Relevant part of my /etc/rc.local:
- Code: Select all
# Set Status LED to solid green now that boot finished
printf "\\x38" > /dev/ttyS1
# And set internal HDD LED to solid green as well
[ -x /opt/local/bin/hddled_green_solid ] && /opt/local/bin/hddled_green_solid > /dev/null 2>&1
Basically nuked everything else from your sample source code, leaving just the following:
- Code: Select all
/* userland test for the synology /dev/ioctl interface */
/* (c) Alex Samorukov, samm@os2.kiev.ua */
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <linux/ioctl.h>
#include <unistd.h>
#include "synobios.h"
int main()
{
int syno_fd;
int ret, i;
DISKLEDSTATUS diskled;
// open ioctl api
syno_fd = open("/dev/synobios", O_RDONLY,0);
if (syno_fd == -1) {
printf("/dev/synobios open error\n");
exit(1);
}
// setting internal HDD LED to green
printf("Changing color of Internal HDD LED to Solid Green\n");
diskled.status=DISK_LED_GREEN_SOLID;
diskled.diskno=1;
// setting led for hdd1
ioctl(syno_fd, SYNOIO_SET_DISK_LED, &diskled);
CPLDREG cpldreg;
ioctl(syno_fd, SYNOIO_GET_CPLD_REG, &cpldreg);
printf("CPLD regs: %x,%x,%x,%x\n",cpldreg.diskledctrl,cpldreg.diskpowerstate,cpldreg.modelnumber,cpldreg.fanstatus);
close(syno_fd);
return 0;
}
and compiled with the optware toolchain, just simple
- Code: Select all
gcc syno_test.c -o /opt/local/bin/hddled_green_solid
