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.

#1 2009-05-27 23:55:13

balou1974
Member
Registered: 2009-05-13
Posts: 10

DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

Hi!

I have written a small daemon to control power-button and reset-button of DNS323 Rev B1.
You need the latest debian kernel of martin michlmayr, www.cyrius.com (debian kernel 2.6.30-rc6 experimental)
to use it.

Please see attachment.


Attachments:
Attachment Icon dns323d.c, Size: 4,116 bytes, Downloads: 616

Offline

 

#2 2009-07-27 11:40:13

rasto
Member
Registered: 2009-07-17
Posts: 17
Website

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

I was looking for this for months now. I had debian with latest kernel installed, but Led's and buttons didn't work...

Thanks mate

P.S: I've installed Debian on 1GB USB to be able to put my SATA disk to sleep.
When I use hdparm daemon for this I can see after timeout my disk goes to standby only (disk is still spinning)
Do You have idea, why is it not issuing hdparm -Y ?
It appears that hdparm sends -y

Thanks for this useful daemon.

Offline

 

#3 2009-07-30 09:10:23

rasto
Member
Registered: 2009-07-17
Posts: 17
Website

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

balou1974 wrote:

Hi!

I have written a small daemon to control power-button and reset-button of DNS323 Rev B1.
You need the latest debian kernel of martin michlmayr, www.cyrius.com (debian kernel 2.6.30-rc6 experimental)
to use it.

Please see attachment.

I have installed latest experimental kernel, but it does not work.
Power led still blinks and it looks like process just exited.
Specifically after running I don't see dns323 forked process.
I ran strace on it and child exits.

clone(Process 5755 attached (waiting for parent)
Process 5755 resumed (parent 5754 ready)
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x40022608) = 5755
[pid  5755] setsid()                    = 5755
[pid  5755] close(1)                    = 0
[pid  5755] close(0)                    = 0
[pid  5755] close(2)                    = 0
[pid  5755] open("/sys/class/gpio/gpio3/value", O_WRONLY) = -1 ENOENT (No such file or directory)
[pid  5755] exit_group(1)               = ?
Process 5755 detached
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4001e000
write(1, "forked input daemon\n"..., 20forked input daemon
) = 20
exit_group(0)

Last edited by rasto (2009-07-30 09:11:15)

Offline

 

#4 2009-09-03 23:16:49

racerx
New member
Registered: 2009-07-31
Posts: 4

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

Hmmm, I agree that it doesnt work.

I have Martins latest kernel running and have compiled the script, get the "forked output" when I run it but it doesn't do anything. Not had a chance to look at it properly yet... has anyone else?

For the time being I have some tape over the LED to stop it iluminating the whole room at night as it flashes continually.

Dan

Offline

 

#5 2009-09-06 09:42:34

baarney
Member
From: Sydney
Registered: 2008-02-05
Posts: 29

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

Haven't tried the daemon, but this patch allows you to use the sys gpio interface to control the leds.

http://lists.arm.linux.org.uk/lurker/me … 4a.en.html

Haven't tried turning it off, but it certainly stops it blinking.

Cheers,

Barney

Offline

 

#6 2009-11-29 15:15:45

balou1974
Member
Registered: 2009-05-13
Posts: 10

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

Please follow Martin Michlmayr's installation guide first:

http://www.cyrius.com/debian/orion/d-li … stall.html

After installing debian install the following kernel (it won't work with any other!) and directly apply it with dpkg -i:

- download directly to you dns323:
  wget http://merkel.debian.org/~tbm/tmp/kerne … _armel.deb
- install kernel
  dpkg -i ./linux-image-2.6.30-trunk-orion5x_2.6.30-1dns323_armel.deb
-reboot

Now you should have the latest working kernel smile

- now install gcc
  apt-get install gcc
- download the attached dns323d.c to your dns323
- compile the daemon
  gcc dns323d.c

- Rename a.out to dns323d and copy it to /bin or /sbin...
  (binary needs to be executable!!! and rc.local, too!)

- Put a new line to your rc.local including /bin/dns323d or /sbin/dns323d
  (Don't forget to reboot after installing)

  Pressing powerbutton for 5 secs will powerdown

  Pressing resetbutton will reboot



Sorry for the delay! Have Fun! This whole thing was created for Hardware Rev. B1 and works just fine using a
Conceptronic CH3SNAS (DNS323 REV. B1).

Currently I am trying to create the latest testing kernel (2.6.32-rc8) because it includes hardware support
for orion5x-cesar-crypto-engine (currently running on my linkstation). I think I will need help from Martin again smile

Last edited by balou1974 (2009-12-01 10:20:01)


Attachments:
Attachment Icon dns323d.c, Size: 4,116 bytes, Downloads: 442

Offline

 

#7 2009-11-29 21:32:58

oxygen
Member
Registered: 2008-03-01
Posts: 320
Website

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

although i dont need it. keep up the work wink i really love debian on the dns323.

Offline

 

#8 2009-12-13 15:01:06

sumerset
Member
Registered: 2009-12-13
Posts: 6

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

hi,

I've tried the script on a ch3snas and it doesn't work.

When i execute the script manually i get a "forked input message" but when  i check the running processes there is no ch3snas (the name of the script)

Offline

 

#9 2009-12-13 15:35:20

balou1974
Member
Registered: 2009-05-13
Posts: 10

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

This is no script it is a not compiled C-program please follow my instruction carefully! It will ONLY work with the mentioned kernel and if it is compiled as destcribed. Other ways you wont reach any results! I  am using this combination for quite a long time and had no problems using it. Currently I am trying to compile the latest stable kernel for dns 323, but I need are a few debian patches and I don't know which smile

Last edited by balou1974 (2009-12-13 15:36:21)

Offline

 

#10 2009-12-13 21:26:15

sumerset
Member
Registered: 2009-12-13
Posts: 6

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

yes i know. i followed your instructions carefully.

the kernel that i'm currently using is  2.6.30-2-orion5x

Offline

 

#11 2009-12-14 20:31:26

balou1974
Member
Registered: 2009-05-13
Posts: 10

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

Well that is the wrong kernel you need:

linux-image-2.6.30-trunk-orion5x_2.6.30-1dns323_armel.deb

Offline

 

#12 2009-12-15 02:43:05

sumerset
Member
Registered: 2009-12-13
Posts: 6

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

By the way does anyone uses a web manager like webmin?

If yes please state which.

I've tried installing webmin but when setup.sh is run the installation hangs with: "Running postinstall scripts"

Does anyone have a solution?

Offline

 

#13 2009-12-17 08:36:48

oxygen
Member
Registered: 2008-03-01
Posts: 320
Website

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

no, it's just a waste of resources

Offline

 

#14 2009-12-22 09:09:13

balou1974
Member
Registered: 2009-05-13
Posts: 10

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

New Kernel + new Daemon:

Kernel - http://merkel.debian.org/~tbm/tmp/kerne … _armel.deb

Daemon - see Attachment !!!!



The new Kernel is running really well!!! Try it out Marvell Cesar-Crypto is supported, too !!!

Last edited by balou1974 (2009-12-22 09:11:05)


Attachments:
Attachment Icon dns323d.c, Size: 3,397 bytes, Downloads: 557

Offline

 

#15 2010-03-12 19:59:45

netventure
Member
Registered: 2010-03-12
Posts: 9

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

balou1974 wrote:

New Kernel + new Daemon:

Kernel - http://merkel.debian.org/~tbm/tmp/kerne … _armel.deb

Daemon - see Attachment !!!!

Thanks balou1974,

I've tried this kernel and it associated daemon but it still doesn't work. Holding the power button does not shutdown the machine. Is there something I'm missing here?

--NV

Offline

 

#16 2010-03-13 12:57:13

balou1974
Member
Registered: 2009-05-13
Posts: 10

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

Well, did you create a startup-script for the daemon? other ways it won't start and work ... you should see entries in the syslog if it is started (and dont forget the script and daemon needs rights for execution).

Last edited by balou1974 (2010-03-13 12:58:27)

Offline

 

#17 2010-03-13 19:52:06

netventure
Member
Registered: 2010-03-12
Posts: 9

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

I added +x permissions, moved it to /sbin, owner is root:root and it's starting automatically from /etc/rc.local.

I can see that the process is running but I don't see any syslog entries. I strace'd it and see that it's opened /dev/input/event0 for read.

If i'm supposed to see a call to syslog() or openlog() when stracing, then that's not happening.

--NV

Offline

 

#18 2010-03-14 01:17:45

balou1974
Member
Registered: 2009-05-13
Posts: 10

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

I wonder what is wrong, maybe I will write a little debug version for you to see what is wrong.
I am using it many month and it worked without any problems... maybe a different hardware revision or something like that.

ANOTHER HINT: What happens if you press the hidden reset button?

In syslog you should see:

"forked input daemon" OR "unable to fork"

and if a button is pressed you should see

"Power button pressed for 5 seconds. Executing poweroff now..." or "Softreset button pressed. Executing reboot now..."

Last edited by balou1974 (2010-03-14 01:27:51)

Offline

 

#19 2010-03-17 18:16:10

netventure
Member
Registered: 2010-03-12
Posts: 9

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

My DNS323 is a B1 with 2x 1TB Seagate HDDs. The led is continuously blinking and pressing the button doesn't result in anything until 2 days ago:

I rebooted the 323 using the reboot command and after that it booted up and the LED stayed on! There were no "forked" messages in syslog but on pressing the power button for 5 seconds, it did a proper shutdown. By proper shutdown, I mean the device completely switching off power - no leds, no disk, nothing.

I booted it up again and saw this in syslog:
DNS323d[1298]: Power button pressed for 5 seconds. Executing poweroff now...

At the moment, the power button doesn't work at all. It only worked that one time.

The reset button seems to be working fine though: I tried it several times and it does a normal reboot with this line in syslog:

DNS323d[1287]: Softreset button pressed. Executing reboot now...

--NV

PS: Shutting down the 323 from the shell does not switch off the unit for me. I'm hoping that a working daemon will fix that for me.

Last edited by netventure (2010-03-17 18:26:11)

Offline

 

#20 2010-03-18 11:56:14

Kai
Member
Registered: 2009-05-30
Posts: 27

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

You may check if the input device exists on your system and all associated drivers are loaded correctly (which they should if you have the right kernel)

Try #cat /dev/input/event0 | hexdump -C
and press a button (for example the power button)

This should give you some lines of output if it works.

You can also check /sys/class/input/event0/dev which contains the device major and minor number. And also look at  /proc/bus/input/devices.

Let us see where this gets us..

Offline

 

#21 2010-03-18 12:12:23

Kai
Member
Registered: 2009-05-30
Posts: 27

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

If you want to actualy see a bit more sophisticated output of what the device is doing use evtest (hey, you are running debian now #apt-get install evtest ..cool isn't it)

#evtest /dev/input/event0 will list supported keys and you can test them.  (be prepared that while testing and pressing some buttons that they actualy do what they suppose to..i.e power off)

Offline

 

#22 2010-03-18 18:40:25

netventure
Member
Registered: 2010-03-12
Posts: 9

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

Kai wrote:

If you want to actualy see a bit more sophisticated output of what the device is doing use evtest (hey, you are running debian now #apt-get install evtest ..cool isn't it)

Thanks. Looks like the evtest binary is part of the 'joystick' package in lenny.

Kai wrote:

#evtest /dev/input/event0 will list supported keys and you can test them.  (be prepared that while testing and pressing some buttons that they actualy do what they suppose to..i.e power off)

Here's what I see:

Code:

# evtest /dev/input/event0
Input driver version is 1.0.0
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "gpio-keys"
Supported events:
  Event type 0 (Sync)
  Event type 1 (Key)
    Event code 116 (Power)
    Event code 408 (Restart)
Testing ... (interrupt to exit)
Event: time 1268925919.105836, type 1 (Key), code 408 (Restart), value 1
Event: time 1268925919.105858, -------------- Report Sync ------------
Event: time 1268925919.289475, type 1 (Key), code 408 (Restart), value 0
Event: time 1268925919.289490, -------------- Report Sync ------------

I tried both buttons (Power-116 and Restart-408) but as the text above shows, only the restart button was detected.

The restart button works of course (how else would I power on the box?) and it works with the D-Link stock firmware - so it's not a hardware issue.

This is the input config, though I can't make much of it:

Code:

# /sys/devices/platform/gpio-keys/input/input0# cat /sys/class/input/event0/dev
13:64

# cat /proc/bus/input/devices
I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="gpio-keys"
P: Phys=gpio-keys/input0
S: Sysfs=/devices/platform/gpio-keys/input/input0
U: Uniq=
H: Handlers=kbd event0
B: EV=3
B: KEY=1000000 0 0 0 0 0 0 0 0 100000 0 0 0

Offline

 

#23 2010-03-18 18:59:41

netventure
Member
Registered: 2010-03-12
Posts: 9

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

On this topic, how can  I get a shutdown command to power of the device? It currently doesn't power off when I give a shutdown from an ssh terminal.

Offline

 

#24 2010-03-22 11:24:17

Kai
Member
Registered: 2009-05-30
Posts: 27

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

netventure wrote:

On this topic, how can  I get a shutdown command to power of the device? It currently doesn't power off when I give a shutdown from an ssh terminal.

Well, usualy with this kernel a simple #poweroff  will shutdown the machine and power it down. As your device seem to have issues with this the problem seem related. I think it was something about GPIO flags needed to be set in a specific way in order for the device to power down proberly (specific for the revision B - that is exactaly - plus a few other things - this kernel was patched for)

Running out of ideas what to do on your devices as I'm not very familiar with the internals of this. You might want to contact Martin Michlmayer directly - the guy who developed this and backported this patch into this kernel). He might have the right knowledge to trace down what goes wrong.

According to the kernel changelog the fix now went in one of the latest kernel revision (available in squeeze)
http://packages.debian.org/changelogs/p … /changelog

I have updated my device from lenny to squeeze and it works fine but haven't tried the latest kernel yet (but will do an report)

Offline

 

#25 2010-06-16 18:30:03

netventure
Member
Registered: 2010-03-12
Posts: 9

Re: DNS323d GPIO/LED daemon for DNS323 Rev B1 (Debian)

It's been quite a while since the last post.

I upgraded 2 months ago to squeeze and still see the same issue all along. But today, my DNS-323 booted up with the power light in a "steady on" state. I haven't tried pressing the power button to see if it would shutdown normally fearing that the next boot will leave the led in a "blinking" state. Any suggestions on what to check for while it's running in the ideal state?

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB