My blog posts about synology NAS internals

Questions that don't fit in any category below may go here
Forum rules
Please note the disclaimer before modifying your Synology Product.

My blog posts about synology NAS internals

Postby samm_cz » Fri Apr 13, 2012 9:50 pm

Hi,

I did 2 blog posts about Synology device i own - DS207. I think that at least some of the information is relevant for other models. Now i am also working on another post - about /dev/synobios ioctl interface (with usage examples), hibernation and replacing scemd with self-written daemon. I would be glad to see your comments. My blog url is http://smallhacks.wordpress.com/tag/ds207/ . Comments are welcome :)
samm_cz
I'm New!
I'm New!
 
Posts: 5
Joined: Fri Apr 13, 2012 9:43 pm

Re: My blog posts about synology NAS internals

Postby samm_cz » Tue Apr 17, 2012 1:31 pm

I added another article about direct manipulation with /dev/synobios and /dev/ttyS0 attached devices - see http://smallhacks.wordpress.com/2012/04 ... -devttys1/ .
samm_cz
I'm New!
I'm New!
 
Posts: 5
Joined: Fri Apr 13, 2012 9:43 pm

Re: My blog posts about synology NAS internals

Postby banneduser » Tue May 01, 2012 8:36 pm

samm_cz wrote:I added another article about direct manipulation with /dev/synobios and /dev/ttyS0 attached devices - see http://smallhacks.wordpress.com/2012/04 ... -devttys1/ .


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. :P

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


8) :lol:
banneduser
Beginner
Beginner
 
Posts: 21
Joined: Wed Apr 11, 2012 4:34 pm


Return to General Mods

Who is online

Users browsing this forum: No registered users and 2 guests