linux-thinkpad / hdapsd Goto Github PK
View Code? Open in Web Editor NEWHDAPS daemon for IBM/Lenovo ThinkPads
Home Page: http://hdaps.sf.net
License: GNU General Public License v2.0
HDAPS daemon for IBM/Lenovo ThinkPads
Home Page: http://hdaps.sf.net
License: GNU General Public License v2.0
The documentation is installed both as README
and README.md
under @prefix@/doc/hdapsd
. They are two distinct copies, README
is not a symlink.
Let's have a config file, I think the following options should be implemented:
This issue may seem a bit loaded, touching on systemd, udev and configuration, but the problems are related and can only be solved together. I intend this issue to be a starting point for discussion on these observations.
I installed hdapsd
and found that:
In the followings I describe the issues involved and the proposed solutions.
#1. Behaviour
The installed udev rule causes all disks to be automatically protected by launching a daemon for each disk using [email protected]
. This happens for external disks too. Every time one is connected a new process is launched only to fail, as these disk do not support head unload on command (only via APM, as far as I know). There is no easy way of excluding disks.
I think this automatic behaviour has little value as most users have only one or two disks to protect, and manually adjusting settings (e.g. fine tuning --sensitivity
) is always desired.
Removing the udev rule turns off the automatic behaviour, however configuration still remains difficult. See the next section.
Required modifications:
hdapsd.rules
There is a built-in configuration system implemented with libconfig
, but it does not seem to be used (the configuration file is not installed either).
The only way to change settings is by overwriting parts or the whole service file in /etc/systemd/system/
. Users unfamiliar with systemd will find this difficult.
libconfig
The built-in libconfig
based configuration provides a simple way to modify setting in /etc/hdapsd.conf
. Since configuration specified this way applies to all protected disks, it is sufficient to run a single daemon process using hdapsd.service
, instead of one for each disk with [email protected]
.
Note that pidfile
, syslog
and background
should be removed from the configuration file as these have to be set in the service file for systemd to work properly. See systemd.service(5) for more.
Required modifications:
hdapsd.service
[email protected]
hdapsd.conf
to /etc
EnvironmentFile
Using the EnvironmentFile
option in the service file to read command line arguments to hdapsd
from a file and append them to ExecStart
. This is what smartd
does. See systemd.exec(5) for more.
/etc/conf.d/hdpasd
HDAPSD_ARGS='--sensitivity 40 --device=/dev/disk/by-id/ata-HTS541040G9AT00'
hdapsd.service (excerpt)
[Service]
EnvironmentFile=/etc/conf.d/hdpasd
ExecStart=/usr/sbin/hdapsd --pidfile --background --syslog $HDAPSD_ARGS
Required modifications:
hdapsd.service
[email protected]
/etc/conf.d
It is possible to overwrite a service file in part or entirely by adding a local configuration in /etc/systemd/system
.
/usr/lib/systemd/system/hdapsd.service (excerpt)
ExecStart=/usr/sbin/hdapsd --pidfile --background --syslog --adaptive
/etc/systemd/system/hdapsd.service (excerpt)
# The empty assignment resets the option, see systemd.exec(5)
ExecStart=
ExecStart=/usr/sbin/hdapsd --pidfile --background --syslog --sensitivity 40 --device /dev/sda
This technique can be used with [email protected]
as well to provide per disk configuration (if that is desired).
The configuration side of the issue really depends on the level of control you want to have (global and/or per disk configuration) and the preferred way of configuration (libconfig or environment file, and/or systemd).
On the behaviour side of the issue. If I'm wrong and there is a legitimate reason for keeping udev in the loop, some other solution have to be found for easing configuration and excluding disks.
I tried to be as concise as possible while still being clear about the approach of each proposed solution. Of course I would be happy to contribute code if you find that some of these modifications are necessary.
If you are still reading, thank you and give yourself a pat on the back!
Thank you for maintaining hdapsd
!
Arch ships a service file, that starts the service as a real service, with dependencies etc [1].
Our version, which came from Fedora (and is used in the AUR version of the package [2]), relies on activation by udev. This is IMHO cool (esp as it enables hotplug for new disks), but is confusing for users, as they cannot control hdapsd via systemctl.
[1] https://projects.archlinux.org/svntogit/community.git/tree/trunk/hdapsd.systemd?h=packages/hdapsd
[2] https://aur.archlinux.org/packages/hdapsd-git
Manpage vs help() vs readme? Are all uptodate in regards to the code
--force-rotational
is missing from the manpage
Hello, I'm getting this message every time I start the daemon:
Could not find a suitable interface
What's wrong? I'm using Ubuntu 14.04 on a HP Envy 17 Laptop (with HP 3D DriveGuard support).
I'm running hdapsd on ubuntu 17.04, version 1:20141203-1.
sudo strace hdapsd
shows this error:
open("/dev/input/event8", O_RDONLY) = -1 EPERM (Operation not permitted)
cat /proc/bus/input/devices
I: Bus=0019 Vendor=0000 Product=0000 Version=0000
N: Name="Acer BMA150 accelerometer"
P: Phys=wmi/input1
S: Sysfs=/devices/virtual/input/input11
U: Uniq=
H: Handlers=event8 js0
B: PROP=0
B: EV=9
B: ABS=7
Tried sudo rmmod joydev
but nothing changed except no "js0" in Handlers list
Any idea?
autogen.sh
passes an unrecognised option to configure
, resulting in a warning. See the last line of the output.
$ ./autogen.sh
...
configure: WARNING: unrecognised options: --enable-maintainer-mode
im not sure if i am doing something wrong but i dont have no one of this files
#define TOSHIBA_MOVEMENT_FILE "/sys/devices/platform/toshiba_haps/movement"
#define TOSHIBA_LEVEL_FILE "/sys/devices/platform/toshiba_haps/protection_level"
#define TOSHIBA_POSITION_FILE "/sys/devices/platform/toshiba_acpi/position"
but i have this other ones:
mercuriete@localhost /sys/devices/platform/TOS620A:00/firmware_node $ ls -l
total 0
lrwxrwxrwx 1 root root 0 sep 20 11:27 driver -> ../../../../bus/acpi/drivers/Toshiba HAPS
-r--r--r-- 1 root root 4096 sep 20 12:00 hid
-r--r--r-- 1 root root 4096 sep 20 12:00 modalias
-r--r--r-- 1 root root 4096 sep 20 12:00 path
lrwxrwxrwx 1 root root 0 sep 20 12:00 physical_node -> ../../../platform/TOS620A:00
drwxr-xr-x 2 root root 0 sep 20 12:00 power
-rw-r--r-- 1 root root 4096 sep 20 12:00 protection_level
--w------- 1 root root 4096 sep 20 12:00 reset_protection
-r--r--r-- 1 root root 4096 sep 20 12:00 status
lrwxrwxrwx 1 root root 0 sep 20 11:27 subsystem -> ../../../../bus/acpi
-rw-r--r-- 1 root root 4096 sep 20 12:00 uevent
i need some help because the driver is working because it writes to dmesg an event every time that i move the computer. and hdapsd starts automatically with systemd but then exits with code 255 after tries to load a lot of modules.
by the way, i compile toshiba_haps inside the kernel not as a module. i dont know if this could be the problem.
thanks for your work
edit: version of linux:
uname -a
Linux localhost 4.0.5-gentoo #17 SMP PREEMPT Tue Sep 8 21:37:19 WEST 2015 x86_64 Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz GenuineIntel GNU/Linux
I set up hdapsd and wanted to verify it is working.
For this I started it with --verbose
, kept something writing to the disk and let the device fall repeatedly (of course gently breaking it instead of letting it hit the floor).
Each time could hear the disk head move, then park as it entered free fall, then quickly start to move again, but this is the output I got:
Sat Mar 30 18:45:31 2019: Starting hdapsd
Sat Mar 30 18:45:31 2019: WARNING: You did not supply any devices to protect, trying autodetection.
Sat Mar 30 18:45:31 2019: Adding autodetected device: sdb
Sat Mar 30 18:45:31 2019: Trying INTERFACE_HDAPS
Sat Mar 30 18:45:31 2019: Trying INTERFACE_AMS
Sat Mar 30 18:45:31 2019: Trying INTERFACE_FREEFALL
Sat Mar 30 18:45:31 2019: Selected interface: FREEFALL
Sat Mar 30 18:45:31 2019: Uses hardware logic from /dev/freefall
disk: sdb
threshold: 15
read_method: hardware-logic
sampling_rate: 50
HW=1
Sat Mar 30 18:46:18 2019: parking
HW=1
HW=1
HW=1
HW=1
HW=1
HW=1
Running hdapsd without --verbose
and with --syslog
, as one would with a daemon, means I get no indication that the disk was parked after the first time, which hardly seems intentional.
Hi there! I'm using Linux Mint KDE 18.3 and I installed hdapsd on my HP Envy laptop from the repositories, however I'm really not sure if something is wrong. I'm sorry to bother you but I really don't know if this is working correctly.
Reading this wiki article
https://wiki.archlinux.org/index.php/Hard_Drive_Active_Protection_System
I have seen there is a hdaps-gl function (the article points to this github) but I can't seem to get it working. Issuing it as a terminal command gives a "no such command" response.
There doesn't seem to be a way to know if my HDD is being protected. All I can do is figure that it is working since there is a hdapsd daemon running.
However when I wanted to use a joystick I noticed I have trouble (Always detected as second joystick) because the laptop's built-in accelerometer always gets detected as the first joystick (js0), and I don't know what would happen to the HDD protection if I do some changes
(like this https://ubuntuforums.org/showthread.php?t=1595666
I want the accelerometer to always be something like js9)
maybe it will stop working?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.