MediaSmartServer.net
http://www.mediasmartserver.net/forums/

Here is a linux driver for the H340 leds
http://www.mediasmartserver.net/forums/viewtopic.php?f=23&t=7720
Page 3 of 9

Author:  nop [ Mon Sep 06, 2010 12:13 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

Hi there. I just registered to bring this a little further!

I am Stefan, kind of a hardware fetishist (http://www.onderka.com) and I recently bought a HP Data Vault X312 (German X300 series with 2x1TB) to replace my Synology DS410 - I just had to get back to X86 Hardware.

Quickly soldered a VGA cable, plugged in 4x 1TB, netbooted Debian and was set.

Short intermission:

I cannnot access the BIOS so far, like many other MSS hackers, USB is just disabled until POST is done. It will however fully work as soon as the Debian net-installer starts! Just zero your drives' partition table & boot sectors, so the X312 boots via PXE.

My machine never booted WHS here at my house, so I didn't see what LEDs HP built into it until I compiled mediasmartserverd just minutes ago ;)

This is what I can tell you so far:

root@monster /usr/src/mediasmartserverd # lspci
Code:
00:00.0 Host bridge: Intel Corporation N10 Family DMI Bridge (rev 02)
00:02.0 VGA compatible controller: Intel Corporation N10 Family Integrated Graphics Controller (rev 02)
00:02.1 Display controller: Intel Corporation N10 Family Integrated Graphics Controller (rev 02)
00:1a.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 02)
00:1a.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 (rev 02)
00:1a.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 (rev 02)
00:1a.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 (rev 02)
00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 (rev 02)
00:1c.5 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 6 (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 92)
00:1f.0 ISA bridge: Intel Corporation 82801IR (ICH9R) LPC Interface Controller (rev 02)
00:1f.2 SATA controller: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA AHCI Controller (rev 02)
00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 02)
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)


root@monster /usr/src/mediasmartserverd # sensors-detect
Quote:
Driver `coretemp':
* Chip `Intel Atom thermal sensor' (confidence: 9)

Driver `dme1737':
* ISA bus, address 0xa00
Chip `SMSC SCH5127 Super IO' (confidence: 9)


root@monster /usr/src/mediasmartserverd # ./mediasmartserverd --debug -v -v
Code:
LedHpEx48X: Device 0x86
Found: HP MediaSmart Server 48X
ADDED: '/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0' (scsi)
 scsi_host: '/sys/devices/pci0000:00/0000:00:1f.2/host0' (scsi)
 scsi_host_parent: '/sys/devices/pci0000:00/0000:00:1f.2' (pci)
 sysnum: 0
ADDED: '/sys/devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0' (scsi)
 scsi_host: '/sys/devices/pci0000:00/0000:00:1f.2/host1' (scsi)
 scsi_host_parent: '/sys/devices/pci0000:00/0000:00:1f.2' (pci)
 sysnum: 1
ADDED: '/sys/devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0' (scsi)
 scsi_host: '/sys/devices/pci0000:00/0000:00:1f.2/host2' (scsi)
 scsi_host_parent: '/sys/devices/pci0000:00/0000:00:1f.2' (pci)
 sysnum: 2
ADDED: '/sys/devices/pci0000:00/0000:00:1f.2/host3/target3:0:0/3:0:0:0' (scsi)
 scsi_host: '/sys/devices/pci0000:00/0000:00:1f.2/host3' (scsi)
 scsi_host_parent: '/sys/devices/pci0000:00/0000:00:1f.2' (pci)
 sysnum: 3


The X300 has the LEDs horizontally 1 to 4 left to right:

Image

./mediasmartserverd --xmas

1 white, 2 somewhat pink, 3 white, 4 somewhat pink - static, no movement.

./mediasmartserverd --brightness 9 --light-show 1

freaky color show

./mediasmartserverd --brightness 9 --light-show 2

4 -> 3 -> 2 -> 1 (right to left blue)

./mediasmartserverd --brightness 9 --light-show 3

1 -> 2 -> 3 -> 4 (left to right blue)

./mediasmartserverd --brightness 9 --light-show 6

4 -> 3 -> 2 -> 1 (right to left red)

./mediasmartserverd --brightness 9 --light-show 7

1 -> 2 -> 3 -> 4 (left to right red)

./mediasmartserverd --brightness 9 --light-show 8

Knight Rider (red)

./mediasmartserverd --brightness 9 --light-show 9

All red

./mediasmartserverd --brightness 9 --light-show 10

4 -> 3 -> 2 -> 1 (right to left white)

./mediasmartserverd --brightness 9 --light-show 11

1 -> 2 -> 3 -> 4 (left to right white)

./mediasmartserverd --brightness 9 --light-show 12

Knight Rider (white)

./mediasmartserverd --brightness 9 --light-show 12

Like "xmas"

./mediasmartserverd --brightness 9 --light-show 16

Knight Rider (blue)

Verification of mappings (4 -> 1, down) and colors (2=blue, 6=red) is also ok:

./mediasmartserverd --brightness 9 --light-show 2

-> blue LEDs descending (top to bottom)

./mediasmartserverd --brightness 9 --light-show 6

-> red LEDs descending (top to bottom)

What is still fuxx0red:

"--brightness X" does not change anything, all LEDs are full throttle. And I cannot see any disk activity, maybe related. Is it supposed to show disk activity via brightness? I guess yes, but the docs are rather sparse ;)

The 3 on the left, power, lan and health are always steady blue - Power and lan from boot on, health used to always blink before running mediasmartserverd for the first time.

Is there anything I can do to help development? I have basic C/Cpp skills, but I am mainly a hardware- and PHP-guy.

I am willing to trade a PHP Web-UI for Linux on Mediasmart/Data Vault servers in for functional, programmable LEDs.

In the works: http://www.onderka.com/2010/09/05/work- ... interface/

Stefan

Author:  yakuza [ Mon Sep 06, 2010 1:38 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

Welcome, Stefan, thanks for sharing your experience and I hope you're able to get the LEDs working on your server.

Author:  nop [ Mon Sep 06, 2010 2:54 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

Thanks. Let's see where this leads.

@admins:

Could you rename this thread to "Linux LED driver for Acer H340, Lenovo D400, HP Media Smart EX and Data Vault X300 series" or similar?

Edit: Pulled the HP Data Vault X300 Series "WNAS.sys" out of my Drive0-Backup, maybe that helps:

Attachments:
WNAS.sys_hp_x300.zip [7.59 KiB]
Downloaded 810 times

Author:  muelly2 [ Fri Sep 17, 2010 2:29 am ]
Post subject:  Re: Here is a linux driver for the H340 leds

Hallo adaption,

adaptation wrote:
muelly2 wrote:
If I run with --xmas, all lights turn on. So I assume a glitch with "sysnum"?


Try modifying the Set method in led_acerh340.h to offset the sysnum:


I already tampered with this, but it seems to be a "custom fix", since the numbering will change whatever USB devices are installed or BIOS setting choosen. This is due to udev putting all under scsi devices. I fizzeled around with udev, trying other inquiry methods but till now no luck...
...

adaptation wrote:
Can you also please verify the LED mappings by using the --light-show argument:
Code:
# blue LEDs descending (top to bottom)
sudo ./mediasmartserverd --brightness 9 --light-show 2

# red LEDs descending (top to bottom)
sudo ./mediasmartserverd --brightness 9 --light-show 6


Where the ordering is controlled by that same header file (see the mapping for LEDs enum)


I tried this with unmodified driver and it works as expected (i.e. blue or red lights flashing from up to down.

Btw.: I had my first disk going away and mdraid was able to fix it after insertion of an replacement disk. It took 1 day, but it worked! Linux just runs like hell... :D

Many thanks again and best regards,
Mülly

Author:  K. Hendrik [ Sun Oct 24, 2010 6:44 am ]
Post subject:  Re: Here is a linux driver for the H340 leds

Is the h340 driver (kernel module) suitable for the h341???
and is it still actively developed? it would be nice to have the kernel module controll all the led's

Author:  luceth [ Tue Oct 26, 2010 6:46 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

Just purchased an H340 - what a slick little piece of hardware. Installed Ubuntu Maverick, then came looking for LED drivers.

I too wanted the bay LEDs to serve as activity lights for the individual drives. Thanks to @alexandergeorg and @adaptation, the hard part (figuring out how to turn the LEDs on and off) was done. A couple of hours of hacking on mediasmartserverd resulted in the attached patch, which adds this functionality. Download the mediasmartserverd code, apply this patch, build, and run with the "-a" or "--activity" flag.

The idea of the patch is pretty simple. For each block device, there's an entry in the /sys tree called "stat". The output looks like:
Code:
brian@pluto:~$ cat /sys/block/sdb/stat
3291773 59785407 504702189 36047860  1490983 14628433 128832376  8207650        4  7706390 44254270


The 9th entry ("4") is the number of I/O requests in the device's queue at the time the pseudo-file was opened. It serves as a stand-in for disk activity. I simply modified @adaptation's device monitor to wake up 10 times per second, read this value, and if it's >0 flip the LED color. It's not too expensive; top shows 1% CPU usage.

I would also note one other change I made; as is clear earlier in the thread, the mapping from device index to LED index changes based on the devices in the system. I made that mapping explicit in a patch to the top of device_monitor.cpp; if the right LEDs aren't lighting up, tweak the array so that the device index (reported as mediasmartserverd starts up) maps to the right LED.

Is this the "right" (ie, event-driven) way to do this? No, that would require kernel hacking that is beyond my ken. It misses short events (small reads, mainly). Is it the prettiest code? No, but you should have seen the first version. :P I leave this here in an "it works for me" state, hoping that it will be useful to others.

Attachments:
File comment: Patch to make the bay lights work as activity lights.
activity.patch.txt [10.93 KiB]
Downloaded 792 times

Author:  luceth [ Tue Oct 26, 2010 7:24 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

One more note on the above patch: for those of you whose mapping is off (ie, the wrong lights are blinking), running "mediasmartserverd -v -v" can help you figure out what the right drive->led mapping should be.

Author:  luceth [ Sat Oct 30, 2010 11:50 am ]
Post subject:  Re: Here is a linux driver for the H340 leds

luceth wrote:
A couple of hours of hacking on mediasmartserverd resulted in the attached patch, which adds this functionality. Download the mediasmartserverd code, apply this patch, build, and run with the "-a" or "--activity" flag.


With my particular hardware/OS combo, the disk-->led mapping changes not only when I change hardware, but WHENEVER I RESTART THE SERVER. Sheesh.

However, the devnode ("/dev/sda", etc) remains stable. So, version 2 of the above patch uses that for the mapping. This might work as-is for your setup, or you might need to tweak the top of device_monitor.cpp to make the right leds light up.

Attachments:
File comment: Version 2 of the patch to use the drive bay LEDs as activity lights.
activity-v2.patch.txt [12.55 KiB]
Downloaded 892 times

Author:  muelly2 [ Mon Nov 01, 2010 2:13 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

luceth wrote:
With my particular hardware/OS combo, the disk-->led mapping changes not only when I change hardware, but WHENEVER I RESTART THE SERVER. Sheesh.

Thats strange... For me it remains constant.

Nice job!
Since you showed me what to fiddle, I will try to mod it to reflect my raid-setup, include S.M.A.R.T etc... :wink:

Thanks again,
Muelly

Author:  merelin [ Wed Jan 19, 2011 7:02 am ]
Post subject:  Re: Here is a linux driver for the H340 leds

Guys,

First of all, thank you all for the great work!
On my Acer Aspire easyStore H340 everything seems to work fine.
Should you are interested in a deb file for Ubuntu Maverick i386, please find it attached.

Thank you.

Attachments:
mediasmartserver_0.1-1ubuntu1_i386.deb.tar.gz [30.5 KiB]
Downloaded 853 times

Author:  vinhdizzo [ Wed Jan 19, 2011 7:40 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

merelin wrote:
Guys,

First of all, thank you all for the great work!
On my Acer Aspire easyStore H340 everything seems to work fine.
Should you are interested in a deb file for Ubuntu Maverick i386, please find it attached.

Thank you.

@Merelin I had the old driver from bitbucket, but I opted for yours since it's newer. What are the differences? I noticed that all 4 lights on my NAS are lighted even though only 3 hdd are installed. Error?

Author:  merelin [ Thu Jan 20, 2011 12:27 am ]
Post subject:  Re: Here is a linux driver for the H340 leds

vinhdizzo wrote:
@Merelin I had the old driver from bitbucket, but I opted for yours since it's newer. What are the differences? I noticed that all 4 lights on my NAS are lighted even though only 3 hdd are installed. Error?


@vinhdizzo First of all I personally did not introduce any changes to the driver code. All I did is took a driver code from the repo: https://bitbucket.org/adaptation/medias ... /wiki/Home, applied "activity-v2.patch.txt" from luceth, compiled it, added init.d stuff and packaged into a deb. Did I miss anything? How did you build the old version? Did it show the HDD activity? Can you provide me with sources?

Author:  vinhdizzo [ Thu Jan 20, 2011 10:47 am ]
Post subject:  Re: Here is a linux driver for the H340 leds

merelin wrote:
vinhdizzo wrote:
@vinhdizzo First of all I personally did not introduce any changes to the driver code. All I did is took a driver code from the repo: https://bitbucket.org/adaptation/medias ... /wiki/Home, applied "activity-v2.patch.txt" from luceth, compiled it, added init.d stuff and packaged into a deb. Did I miss anything? How did you build the old version? Did it show the HDD activity? Can you provide me with sources?


I compiled as of last July I believed, using the method described on bitbucket (exactly). I have an Acer H340. Before, the "i" LED would signal when the system was in use. Only 2 out of 4 bay LED worked (even though I had 3 drives).

I just removed my init from /etc/rc.local, installed your .deb file, and I get this now. I know it isn't a big issue, but I just want to get it working as it should. How does your LED look like? Number of bay LEDs lighted only for existing drives? Blink when there is activity? (my bay LEDs do not blink).

Author:  vinhdizzo [ Sat Jan 22, 2011 4:03 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

I monitored by server again, and I apologize, Bay LED's do blink (red). However, all 4 blue bay LED's are on when only 3 disks are inserted. Thanks.

Author:  merelin [ Mon Feb 07, 2011 2:46 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

Guys,

As you have probably noticed mediasmartserver_0.1-1ubuntu1_i386.deb.tar.gz suffers from incorrect bay index detection - the issue luceth described as "disk->led mapping" issue.
Needless to say this forced me to introduce changes to the driver code itself.
The corrected version mediasmartserver_0.2-1ubuntu1_i386.deb.tar.gz is attached.
It works fine on my Acer Aspire easyStore H340. Should you decide to give it a try please reply if it works on your box.

Thank you.

Attachments:
mediasmartserver_0.2-1ubuntu1_i386.deb.tar.gz [26.94 KiB]
Downloaded 796 times

Page 3 of 9 All times are UTC - 7 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/