Here is a linux driver for the H340 leds
Page 8 of 8

Author:  MetalGeek [ Thu Apr 11, 2013 5:23 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

merelin wrote:
MetalGeek wrote:
First off thanks for all the work peeps have done on this program. I have mediasmartserver installed using merelin's ppa on ubuntu 12.04. My server has all 4 drive bays occupied with 1 boot drive and 3 drives in a raid 5. When my system boots, I have no individual drive lights, All I have are the single HD activity light. mediasmartserver is running with the --activity and --update-monitor.
The only way I can get my individual lights to turn on is to use --xmas which gives me purple drive lights but the stay on all the time.
scott@megalon:~$ sudo mediasmartserverd -v -v  --xmas
--- SystemVendor: "Acer" - ProductName: "Aspire easyStore H340" ---
Recognized SystemVendor: "Acer"
Recognized ProductName: "Aspire easyStore H340"
Found: Acer Aspire easyStore H340

If I run without the --xmas the lights go out and it just sits there waiting for something, I have to ctrl+c to kill the command. I've tried --activity and --update-monitor. Neither does anything besides --xmas. ](*,)

Please try mediasmartserver 0.5.5-1ubuntu1~quantal from my PPA and give me your feedback.

Sweet. :cheers: Loaded the quantal package and now it is working. Upon bootup, I have all 4 drive lights working and they flash with activity. The i light is dark which I'm assuming is correct.

Author:  alexandergeorg [ Sun Apr 14, 2013 7:17 am ]
Post subject:  Re: Here is a linux driver for the H340 leds

ABATAPA wrote:
alexandergeorg wrote:
created a small replacement PCB which is driven by a coldfire V1.

You will share the PCB schemes? Sure, many people (and myself) thought about it.

I asked my coallegue to do so; I think he'll follow up shortly. In the meantime, I got my daemon 90% finished.

The features are:
- [HW] all leds can be switched to blue, red or purple
- [HW] the brightness can be configured individually per led (to be developed)
- [HW] The chassis fan will be put on a duty cycle of 50% if no fan control command is issued for 15 sec (keeps my HDD's below 50 deg. Celsius)
- [SW] communication pipe to switch on the warning leds per drive
- [SW] temperature control of the HDD's which can control the fan
- [SW] user configurable command when the usb button is pressed; short-press/long-press tbd
- [SW] drive bay -> HDD mapping done on runtime, shamelessly stolen from mediasmartserverd ;-)

Author:  ABATAPA [ Mon Apr 15, 2013 9:58 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

alexandergeorg wrote:
I asked my coallegue to do so; I think he'll follow up shortly. In the meantime, I got my daemon 90% finished.

Thank you! We'll wait.

alexandergeorg wrote:
The features are:

Is it possible to turn off the HDD power by software, power up the drives with delay after system power up?
It may be necessary to reduce the starting current, or if the disk password is set by ATA Security, and the BIOS does not have an ATA Security extension and does not understand these discs, stopping with an error (as original H340 board).

Author:  hardwareguy [ Fri Apr 19, 2013 12:54 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

Hi there,

We'll wait.

Well, here I am :-)

So you are interested in the schematics, here they are.
File comment: Schematics
NAS-Front_schematics.pdf [158.86 KiB]
Downloaded 1514 times

Don't blame me because of the messy schematics - I was rather ill while I created this :-)

Is it possible to turn off the HDD power by software

Actually not, but it's really easy to include that.
My point is: It's a little risky. If you switch off the drives while the system needs them you'll have to do a resync off your raid. And maybe you loose all of your data ...

power up the drives with delay after system power up?

That's foreseen. It's configurable in the front software.

An issue is that it must not happen that the drive are switched off when the front got an update or an unexpected reset (nobody is perfect :-)
That's handled - so if the front gets powered there is a delay, if the front got a reset there is no delay and the several microseconds of interruption are short enough to keep the drives on.

if the disk password is set by ATA Security, and the BIOS does not have an ATA Security extension and does not understand these discs, stopping with an error (as original H340 board).

Does that mean that if the password is set you actually have to use hot plugging?

Well - the H340 backplane divides the power supply of the drives in 2 portions: Drive 1+2 and drive 3+4.
They are seperatly switchable by the controller.
So one could even think about starting only drive 1+2 for booting and switch on the other two drives lateron by a command from the linux system.

BTW - a nice thing with this replacement is the much exacter drive fan controlling.
The H340 has a temperature sensor on the backplane. This is used for controlling the fan. I think you can imagine how exact this temperature value matches the real HDD temperatures :-)
With Alex' system the HDD temperatures are read out and these values are used for defining the PWM for the fan.

To be honest - the used controller is real overkill for this project, but I use it in some other projects, too.
So why choose another one because of maybe 2 or 4 Euro?

Kind regards, the hardware guy.

Author:  ABATAPA [ Sun May 05, 2013 1:35 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

Can anybody tell about the CN3 connector on the backplane?
What are there more signals than power on drives?

What levels?

Author:  Comp1962 [ Sun May 05, 2013 7:00 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

I can't answer your question but maybe the service manual for the H340 may offer some info on this:

Author:  ABATAPA [ Sun May 05, 2013 9:43 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

Comp1962 wrote:
I can't answer your question but maybe the service manual for the H340 may offer some info on this:

Thanks, but there is only information for the end user, and no information about backplabe. We'll have to look at the live system.

Author:  hardwareguy [ Mon May 06, 2013 12:21 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

Hi there,

ABATAPA wrote:
Can anybody tell about the CN3 connector on the backplane?
What are there more signals than power on drives?

What levels?

That's rather easy:
there are 10 pins
- 3 times ground
- 1 not connected
- 2 times HDD switch
- 1 PWM for the FAN speed
- 1 rectangle coming from the FAN speed sensing
- 2 pins of a diode which is used for temperature measurement
All levels (not the diode, of corse) 5V.
0 = HDD off, 1 = HDD on.
The two FAN signals are from the 4-pin FAN, the sense includes a serial resistor.

Take a look into the schematic and you'll finde the pinning.

Kind regards
The hardwareguy.

Author:  verdel [ Fri May 31, 2013 1:22 am ]
Post subject:  Re: Here is a linux driver for the H340 leds

Hi! I have the same problem as MetalGeek. After sudo apt-get update && apt-get upgrade on Ubuntu Server 12.04 Mediasmartserver start, but doesn`t init HDD Led.

In the log there is no information like:
ADDED: '/sys/devices/pci0000:00/0000:00:1f.2 ...

With --xmas option all HDD LEDs turns on. Merelin advised to install package for quantal. It didn't help me.Can somebody help me to diagnose this problem?

Author:  verdel [ Fri May 31, 2013 3:03 am ]
Post subject:  Re: Here is a linux driver for the H340 leds

Now my HDD block devices has that path in the system:

Maybe this can help?

Author:  verdel [ Fri May 31, 2013 11:38 am ]
Post subject:  Re: Here is a linux driver for the H340 leds

Or excuse me for my questions. I found the solution. In the package on the ppa merlon there is no last patch from git. There is patch only in package for raring (maybe not, i based only on the date of release). I build mediasmartserverd from git source and all work perfect now.

Author:  rhb [ Tue Jun 11, 2013 1:12 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

[Post edited after having tried again]

First of all excuse my ignorance. I am new to Linux and I know nothing about programming.

I recently installed Ubuntu 12.10 desktop on my HP EX490 following the instructions on I have since been looking all over the internet trying to find a driver for the LED lights. I realize this thread is about the H340, but the mediasmartserverd driver supports the EX 485 as well, and this is the closest thing to a Linux driver for the EX 490 that I've been able to find.

Using Remote Desktop I started out by installing mediasmartserver_0.3-2ubuntu1_i386.deb by double clicking on it, and the software center gave me a warning (I don't remember exactly which one, but something about an unsound installation). I clicked proceed anyway, and it installed. Then using ssh to the terminal I started the service with smartserverd -D

This had the effect of stopping the activity light (the third light from the left) from blinking (blue) on and off all the time and it was now turned on all the time (again blue, and as it is supposed to be when the server is running). However I still did not have any drive lights. Using ssh to the terminal I then tried sudo mediasmartserverd -a to get the drive lights going. The terminal responded with Found: HP MediaSmart Server 48X and then immediately got back to the prompt again. However the drive lights didn't turn on.

After Googling around I discovered that a newer version of mediasmartserverd existed, and with Remote Desktop I removed the old one in the software center. I might have gotten another error message doing that, but I don't remember. I then tried to installed mediasmartserver_0.5.6-1ubuntu1~raring_i386.deb, by double clicking it, and it wouldn't install because of missing dependencies. I later realized that this file might only be for Ubuntu 13.04. So I tried to install mediasmartserver_0.5.5-1ubuntu1~quantal_i386.deb but again got an error message. In the end I reinstalled mediasmartserver_0.3-2ubuntu1_i386.deb by double clicking it, and then upgraded to mediasmartserver_0.5.5-1ubuntu1~quantal_i386.deb by double clicking it.

Using ssh I could start the service with smartserverd -D. The activity light now turns off. However using the command smartserverd -a causes the terminal to hang and I have to quit it using CTRL+C.

Will the mediasmartserverd work with an EX 490? Have I messed up my Ubuntu installation? Or am I missing something obvious?

Any help will be appreciated.

Author:  Schmitti [ Thu Apr 16, 2015 7:42 am ]
Post subject:  Re: Here is a linux driver for the H340 leds

Hello folks,

I've got a little problem with compiling the LED-modules for my Arch Linux running H340 home server.

It seems that I need to install a lib, but I don't know which one. Here's what I get when I try to compile the module.

[xxx@homeserver leds-h340-0.2]$ make
make -C /lib/modules/3.19.3-3-ARCH/build SUBDIRS=/srv/share/xxx/downloads/Acer_EasyStore_H340/leds-h340-0.2 modules
make[1]: Verzeichnis „/usr/lib/modules/3.19.3-3-ARCH/build“ wird betreten
  CC [M]  /srv/share/xxx/downloads/Acer_EasyStore_H340/leds-h340-0.2/leds-h340.o
/srv/share/xxx/downloads/Acer_EasyStore_H340/leds-h340-0.2/leds-h340.c: In Funktion »nas_led_blink_store«:
/srv/share/xxx/downloads/Acer_EasyStore_H340/leds-h340-0.2/leds-h340.c:475:2: Fehler: Implizite Deklaration der Funktion »strict_strtoul« [-Werror=implicit-function-declaration]
  ret = strict_strtoul(buf, 10, &blink_state);
/srv/share/xxx/downloads/Acer_EasyStore_H340/leds-h340-0.2/leds-h340.c: Auf höchster Ebene:
/srv/share/xxx/downloads/Acer_EasyStore_H340/leds-h340-0.2/leds-h340.c:559:1: schwerwiegender Fehler: Abhängigkeitsdatei »/srv/share/xxx/downloads/Acer_EasyStore_H340/leds-h340-0.2/.leds-h340.o.d« wird geöffnet: Keine Berechtigung
cc1: Einige Warnungen werden als Fehler behandelt
Kompilierung beendet.
scripts/ die Regel für Ziel „/srv/share/xxx/downloads/Acer_EasyStore_H340/leds-h340-0.2/leds-h340.o“ scheiterte
make[2]: *** [/srv/share/xxx/downloads/Acer_EasyStore_H340/leds-h340-0.2/leds-h340.o] Fehler 1
Makefile:1382: die Regel für Ziel „_module_/srv/share/xxx/downloads/Acer_EasyStore_H340/leds-h340-0.2“ scheiterte
make[1]: *** [_module_/srv/share/xxx/downloads/Acer_EasyStore_H340/leds-h340-0.2] Fehler 2
make[1]: Verzeichnis „/usr/lib/modules/3.19.3-3-ARCH/build“ wird verlassen
Makefile:5: die Regel für Ziel „default“ scheiterte
make: *** [default] Fehler 2

Sorry my output is German. Hopefully you'll understand the lines.

I'd be very happy for any help resolving my problem.

Anyway: Does anybody have a solution for the faulty ACPI problem when sending the H340 to sleep (suspend to RAM)? My Server goes to suspend but then immediately wake up.



Author:  boschtracer [ Wed Jan 26, 2022 9:02 am ]
Post subject:  Re: Here is a linux driver for the H340 leds

In case anyone is interested in keeping their MediaSmart Servers alive and is interested in doing so while running Ubuntu 20.04 Focal. I have the LEDs working.

1. For the EX47x - the module that is floating around this board still works under Ubuntu 20.04/Linux Kernel 5.4.0-96-generic. Probably works just fine under Jammy/Kernel 5.16 and any other kernel as well. Just find the EX47x-led module in this forum and follow the instruction to building modules outside the kernel tree: ... dules.html

EDIT: EX47x - module works with Impish (21.10) and kernel 5.13.0-28. Follow the out-of-tree instructions above.

2. For the EX49x - The mediasmartserverd (find the code here: It compiles and works under Ubuntu 20.04, however, the LEDs will not flash, they just light up. This has nothing to do with the functions of the LEDs, but rather, the way the activity algorithm is written. I have re-written the activity section (basically just changed how it parses the /sys/block/*/stat file) and am testing now. It's rudimentary and I know there is a better way to do this but I do not know how to get direct access to kernel/disk IO. I'm trying to reverse engineer iotop but the lack of comments and my lack of C skills makes this time-consuming. It works great with LVM and RAID mirroring..lights are blinky blinking away as I type this. I reset the signaling so writes produce blue, reads produce purple (red/blue together), and they are off otherwise. the --update-monitoring still works as well and I have confirmed it lights the system light when updates are available under Ubuntu 20.04.

If anyone is interested let me know and I'll post the new code or send it to you directly. Until I figure out a better way to do the IO monitoring, or I write an ex49x kernel module, I'm not going to publish just yet.

3. the h342 and h340 modules floating around here - you need to change the following on line 491 to get it to compile:
From this: ret = strict_strtoul(buf, 10, &blink_state);
To this: ret = kstrtoul(buf, 10, &blink_state);

I don't know if it will work after that as I do not have an h34x but I know it will compile following the instructions above for kernel module building. I was trying to see if the module would work with the EX495 as they use the same ICH9. On an EX495, compiling and modprob'ing causes a kernel panic due to a null pointer at initialization - I've traced it back to a return of the pci_register_driver(&nas_gpio_pci_driver). I'm assuming the PCI addresses are different between the EX495 and the H342 (obviously?) which is returning the NULL at init but cannot confirm as I don't have two EX495s and cannot I build a debug kernel that I can play with.

Hope there are others still keeping these boxes alive - they work great! Mine runs Prometheus/Grafana/Ansible to monitor my way-to-many raspberry pi's/odroids/le potato's.

Edit: FreeBSD - 13/12.3: Both boot and run fine with an AMD 1640-LE 2.6ghz uni-processor. 13-release will boot on the EX47x w/multi-processor ( tested with 3800+ (2ghz 35w version) and a BE-2350 (2.1ghz 45w) ) - gets about 3/4 of the way through the boot process and either hangs (if you have a VGA adapter it scrambles the screen and locks up) or just shuts the whole box down off (like you pulled the power cord). I have the BIOS flashed via the files/instructions listed in the forum in order to properly recognize the CPUs.
Edit: 2-11-2022 - This has something to do with drives > SATA 2.x in the EX47x. I can boot into 13-release but it is unstable, crashing after transfers etc. 12.3 (multi-processor, uniprocessor seams stable unless you *really* push it) is stable to a point. If you push the system too far it will crash. If you try to add a zfs mirror - it will crash hard and you'll need to break the mirror and remove the secondary drive from the pool in order to get the system to come back up.

Author:  boschtracer [ Sat Jan 29, 2022 12:48 pm ]
Post subject:  Re: Here is a linux driver for the H340 leds

*MEDIASMARTSERVERD Update* - It's been running for a couple of weeks now, and I don't see any leaks. Here is my updated version of the mediasmartserverd. If anyone has any thoughts or comments on how the activity monitoring section can be better handled, by all means, let me know. I am a 'code when needed' person, and I don't need to very often anymore, so my C++/C mindset is weak.

Things that I am working on as time permits:

1. The program core dumps when a new drive is added. This is big as you can hot-swap drives.
2. Set the bay light's brightness based on activity level - maybe?

Update February 11, 2022:

I have created a daemon for FreeBSD and the EX47x. I've attached it to this message. The tar file includes a binary. I *STRONGLY* suggest running 'gmake clean' and recompiling to ensure you have the necessary libraries and the versions match. You will need GMAKE and GCC to compile this at this time. It requires libcam and libdevstat to run. The binary should be copied to /usr/local/bin and the included .rc file should be copied (removing the .rc extension) to /usr/local/etc/rc.d/, "chmod 755 /usr/local/etc/rc.d/hpex47xled", and hpex47xled_enabled="YES" added to your /etc/rc.conf file. Once these steps are completed, running "service hpex47xled start" should bring up the monitor service. This version puts information into the messages file via syslog() - to see that it has started and what it's monitoring - just "tail -n <some number> -f /var/log/messages". If I get time - I'll create one of these for the EX49x series.

Any suggestions/recommendations will be greatly appreciated regarding C and better ways of writing.

The repository for this program can be found here:

EDIT: 04/02/2022 - the revised version of the EX47x for FreeBSD is on github - I *STRONGLY* recommend cloning or downloading the code from there and compiling it. I have made numerous fixes and added hotplug code from the EX49x codebase - not that it matters - the EX47x doesn't support hotplug... The revised version compiles natively - no gmake or gcc required. Also, it installs the hpex47xled to /usr/local/bin and the .rc file to /usr/local/etc/rc.d. Only manual thing needed is to add hpex47xled_enabled="YES" to your /etc/rc.conf file.

If you have struggled to install FreeBSD 12.3 or 13: First you MUST go through the steps to set the bios to 4(IDE)4(IDE) or FreeBSD will not recognize your drives *AT ALL*.

Instructions to perform this headless (Taken from this forum - you'll need to search):

1. Boot the MediaSmart and as soon as the light flashes red and blue, hit the Delete key to enter BIOS configuration
2. Press the Down Arrow three times and then press Return to select Integrated Peripherals
3. Press the Down Arrow once and press Return to select SiS On-Chip PCI
4. Press the Down Arrow eight times to select SiS Serial ATA Mode
5. Press PgDn once to select 4P(IDE)+4S(IDE) mode
6. Press F10 to save and Return to confirm

After this, you should use VMWare Fusion and mount a drive via USB, boot and attach the drive (won't let you just select it prior to turning on the VM), and follow the prompts. After installing FreeBSD on the external drive, open a shell prior to rebooting and then edit the /etc/rc.conf file to change the ethernet nic. I strongly suggest setting the adapter to static IP during the installation so you only have to change the following:

ifconfig_<whatever it comes up with during install - usually em0>="inet netmask" to ifconfig_sge0="inet netmask"

FreeBSD uses the SGE driver for the ex47x. After you modify the rc.conf and any other files you wish, just shut down the VM, grab the drive, stick it in a carrier and slap it into the EX47x's lowest drive bay (bay 1) and enjoy.

Let me know if I can be of further assistance.

EDIT: 2/17/2022 - the led-hpex47x module works great except the led API triggers *all* bays regardless of which bay actually has drive activity. I validated this by applying the 'disk-activity' trigger as default for all bays - low and behold, they all blink regardless of a drive present in the bay or not. So to get the same functionality as the mediasmartserverd and the FreeBSD hpex47xled daemon - I present the Ubuntu 20.04 and above version of the hpex47xled daemon. Please find the code available for download via github here - Clone, make && make install (as root). systemctl start hpex47xled.service && systemctl enable hpex47xled.service. Let me know if you have any issues. Also attached for those that don't want to use git.

EDIT: 2/18/2022 - hpex47xled for Linux - updated to reflect some issues I discovered. See attached hpex47xled_linux.tar.gz. The most recent version will always be available at

EDIT: 2/23/2022 - hpex47xled_linux is now threaded. One thread per disk. hpex47xled_linux now turns the bay lights off individually instead of all simultaneously. This should make for a more concise display. I'll be moving on to doing the same thing for the FreeBSD version.

Again - any questions/or if you see issues with the code/functionality - please reach out to me here or github.

EDIT: 3/31/2022 - Taken a while, but here you go - hpex49xled - LED monitoring service for HP Mediasmart Server EX49x (I'm assuming EX48x) FreeBSD 12.3 and above. Should work on any version that supports CAM, devstat, etc.

File: hpex49xled-freebsd.tar.gz

A few notes:

1. I can't thank the original programmers of the mediasmartserverd enough for all their efforts and code - I have ported the code for Acer Altos, H340 - H342 into this service. HOWEVER - I have not activated the code.
2. If you are using an H340 - H342 or Altos as supported in the Linux mediasmartserverd - Please compile and run the camtest program I included (just type make camtest) and send me the results here or as an issue on github. I can use that
information to ensure the path id, unit number, etc., align and are properly accounted for during initialization.
3. Hot-swap works - feel free to pull/add drives.
4. hpex49xled is threaded - one thread per disk. I am only looking at IDE devices, I am only looking for four devices, and I am only looking at the four devices in the enclosure. If adding external eSATA or USB drives causes an issue - please report it to me with some
trace information (like what camtest is telling you the box sees), and I'll track down the issue and fix the code.
5. after running 'make install' as root - you will need to add the following to the bottom of your /etc/rc.conf file: hpex49xled_enable="YES"

As always - The latest version will be available on github - ... /tree/main
You can reach me here or github with concerns, questions, suggestions, and issues. Please let me know if you see something that makes no sense/could be done better and can offer advice.

04/30/2022 - Updated the mediasmartserverd - changed read and write IO from int to uint64_t to avoid overflow.
- Tested on Ubuntu Jammy 22.04
- Bumped the version to 0.7.1 for the hell of it.
- Added code to detect the ex49x BIOS during initialization.
- Changed the code that handles activity - added resolution during extended reads and writes. The lights flicker a bit instead of just staying on.
- I have an idea on how to fix the core dump during hotswap. Work on that next in my C ported version of the daemon on github. I'll move the code after testing.

File comment: For FreeBSD 12.3 or 13
hpex47xled-0.01.tar.gz [20.59 KiB]
Downloaded 154 times
File comment: For EX47x Ubuntu 20.04 and above Linux. It will work just fine on others with udev.
hpex47xled_linux.tar.gz [7.43 KiB]
Downloaded 142 times
File comment: For EX47x Ubuntu 20.04 and above Linux. - Threaded version
hpex47xled_linux_threaded.tar.gz [8.18 KiB]
Downloaded 118 times
File comment: For EX49x and FreeBSD 12.3 and above. Should support any version with CAM, devstat etc. Thread and hot-plug support.
hpex49xled-freebsd-v101.tar.gz [14.34 KiB]
Downloaded 66 times
File comment: MediaSmart Server Daemon v0.7.1 - Ubuntu 20.04 and 22.04
mediasmartserverd-0.7.1.tar.gz [127.39 KiB]
Downloaded 57 times

Page 8 of 8 All times are UTC - 7 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group