DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2008-02-11 23:53:23

jules
Member
Registered: 2008-01-26
Posts: 78

Power off, now. Maybe.

Hi all,
i've tried the poweroff and dns323-poweroff executable to turn off the box, but nothing happens ( dns323-poweroff says "still here?").
Looking at the dns323-poweroff src:

Code:

/*
  Power off DNS-323

  0x89f8 - read register
  0x89f9 - write register

  Uses an ioctl of the egiga0 network interface. This ultimately
  ends up in this macro:

  #define MV_REG_WRITE(offset, val)    \
          MV_MEMIO_LE32_WRITE((INTER_REGS_BASE | (offset)), (val))

  (defined in arch/arm/mach-mv88fxx81/Soc/ctrlEnv/mvCtrlEnvLib.h)

  To power off, offset must be 0x10100, and val 0x106.
*/

int main(int argc, char **argv)
{
        int fd;
        struct ifreq ifr;
        unsigned long off_data[2] = { 0x10100, 0x106 };
        const char *ifname = "egiga0";
        fd = socket(AF_INET, SOCK_DGRAM, 0);
        memset(&ifr, 0, sizeof(ifr));
        strcpy(ifr.ifr_name, ifname);
        ifr.ifr_data = (void *)off_data;
        if (ioctl(fd, 0x89f9, &ifr) == -1)
                perror("ioctl");
        printf("Still here?\n");
        exit(1);
}

This piece of code is a bit obscure... i've never used ioctl(), so reading the comment, i suppose that fonz is writing a structure in a "register" of egiga0 with the  sole aim to invoke that define using the struct parameters. Calling that define should result in sudden poweoff.
But nothing happens, maybe something changed between different hardware revisions?

Last edited by jules (2008-02-11 23:53:40)


CH3SNAS - Black Box Ed. • FW:1.03b6a • 2 x WD5000AAKS

Offline

 

#2 2008-02-12 09:40:08

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Power off, now. Maybe.

jules wrote:

This piece of code is a bit obscure...

Yes, powering off via a network interface control call is obscure, but it's the manufacturer's idea, not mine.
Please tell us your kernel version ("uname -a" in telnet).

Offline

 

#3 2008-02-12 21:59:31

jules
Member
Registered: 2008-01-26
Posts: 78

Re: Power off, now. Maybe.

fonz wrote:

Yes, powering off via a network interface control call is obscure, but it's the manufacturer's idea, not mine.
Please tell us your kernel version ("uname -a" in telnet).

Thanks for the fast reply, fonz (and also thanks for the awesome work you've done with the funplug).
Here is the uname string:
Linux mybox01 2.6.12.6-arm1 #29 Wed Jan 16 11:47:00 CST 2008 armv5tejl unknown

Given the fact that also the provided "poweroff" binary (i own a ch3snas but i think that this binary should be contained in the dns323 fw too) is unable to switch off the unit, can this issue be considered a bug of the mainline firmware? Is any user with a DNS323 with the latest firmware unable to poweroff his unit too?

Update: Running poweroff, and then dmesg, these new lines were added:

md: stopping all md devices.
md: md0 switched to read-only mode.
Synchronizing SCSI cache for disk sda:
Power down.

Strange, indeed.

Last edited by jules (2008-02-12 23:16:19)


CH3SNAS - Black Box Ed. • FW:1.03b6a • 2 x WD5000AAKS

Offline

 

#4 2008-02-13 13:26:43

orbitaudio
Member
From: Brisbane, Australia
Registered: 2008-01-23
Posts: 25

Re: Power off, now. Maybe.

Hmmm,

my uname -a is:
Linux nas-server 2.6.12.6-arm1 #32 Tue Jan 23 17:11:52 CST 2007 armv5tejl GNU/Linux

It appears we have different kernel build versions, although i'm confused as to how come i have #32 but at a date before yours.

Offline

 

#5 2008-02-13 13:45:59

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Power off, now. Maybe.

orbitaudio wrote:

Linux nas-server 2.6.12.6-arm1 #32 Tue Jan 23 17:11:52 CST 2007 armv5tejl GNU/Linux

Does dns323-poweroff work on your box?

Offline

 

#6 2008-02-13 13:49:17

orbitaudio
Member
From: Brisbane, Australia
Registered: 2008-01-23
Posts: 25

Re: Power off, now. Maybe.

fonz wrote:

orbitaudio wrote:

Linux nas-server 2.6.12.6-arm1 #32 Tue Jan 23 17:11:52 CST 2007 armv5tejl GNU/Linux

Does dns323-poweroff work on your box?

yup wink.  All your utilities work on my box (well i haven't tested the spindown one) and my chkbutton2 (reads the power button status via ioctl() to 0x89f8) all work on my box.

Offline

 

#7 2008-02-13 21:19:46

jules
Member
Registered: 2008-01-26
Posts: 78

Re: Power off, now. Maybe.

orbitaudio wrote:

yup wink.  All your utilities work on my box (well i haven't tested the spindown one) and my chkbutton2 (reads the power button status via ioctl() to 0x89f8) all work on my box.

I haven't set up a cc environment yet so i can't try to read the register as you are proposing, but your post confirms that with a newer build of the kernel (on the original dns323 i think) this issue is not present... maybe this bug has been fixed...
Anyway, i've posted a brief description of my little problem on the aroundmyroom blog too. I hope that the helpful guy over there will help me to sort this issue out.


CH3SNAS - Black Box Ed. • FW:1.03b6a • 2 x WD5000AAKS

Offline

 

#8 2008-02-14 00:11:22

orbitaudio
Member
From: Brisbane, Australia
Registered: 2008-01-23
Posts: 25

Re: Power off, now. Maybe.

hmmm, I wonder if I/O pinouts or even the method/driver for I/O has changed between revisions,

Offline

 

#9 2008-02-16 11:49:46

jules
Member
Registered: 2008-01-26
Posts: 78

Re: Power off, now. Maybe.

orbitaudio wrote:

hmmm, I wonder if I/O pinouts or even the method/driver for I/O has changed between revisions,

This is probable... but i just found out that the shutdown function of the webpanel works. So at least, shutting down the unit is possible, one day i'll find out how.


CH3SNAS - Black Box Ed. • FW:1.03b6a • 2 x WD5000AAKS

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB