Bug 555298 - hdapsd fails to find sampling_rate on T60
Summary: hdapsd fails to find sampling_rate on T60
Keywords:
Status: CLOSED CANTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: hdapsd
Version: 12
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Tomasz Torcz
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-01-14 11:04 UTC by Robert de Rooy
Modified: 2010-07-16 22:43 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-01-28 14:11:48 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Robert de Rooy 2010-01-14 11:04:57 UTC
Description of problem:
Maanually loading the hdaps kernel module and starting hdapsd I get the following failure;

Jan 14 11:52:09 t60 kernel: hdaps: inverting axis (3) readings.
Jan 14 11:52:09 t60 kernel: hdaps: LENOVO ThinkPad T60 detected.
Jan 14 11:52:09 t60 kernel: input: hdaps as /devices/platform/hdaps/input/input9
Jan 14 11:52:09 t60 kernel: hdaps: driver successfully loaded.

# hdapsd
Thu Jan 14 11:57:46 2010: Starting hdapsd
Thu Jan 14 11:57:46 2010: WARNING: You did not supply any devices to protect, trying autodetection.
Thu Jan 14 11:57:46 2010: Adding autodetected device: sda
Thu Jan 14 11:57:46 2010: Selected interface: HDAPS
Thu Jan 14 11:57:47 2010: WARNING: Could not find hdaps input device (No such file or directory). You may be using an incompatible version of the hdaps module. Falling back to reading the position from sysfs (uses more power).
Use '-y' to silence this warning.
Thu Jan 14 11:57:47 2010: Could not open /sys/devices/platform/hdaps/sampling_rate: No such file or directory.
Do you have the hdaps module loaded?

Passing the -y option does not help either

# hdapsd -y
Thu Jan 14 11:54:08 2010: Starting hdapsd
Thu Jan 14 11:54:08 2010: WARNING: You did not supply any devices to protect, trying autodetection.
Thu Jan 14 11:54:08 2010: Adding autodetected device: sda
Thu Jan 14 11:54:08 2010: Selected interface: HDAPS
Thu Jan 14 11:54:08 2010: Could not open /sys/devices/platform/hdaps/sampling_rate: No such file or directory.
Do you have the hdaps module loaded?

ls -l /sys/devices/platform/hdaps/
total 0
-rw-r--r--. 1 root root 4096 2010-01-14 11:54 calibrate
drwxr-xr-x. 3 root root    0 2010-01-14 11:52 input
-rw-r--r--. 1 root root 4096 2010-01-14 11:54 invert
-r--r--r--. 1 root root 4096 2010-01-14 11:54 keyboard_activity
-r--r--r--. 1 root root 4096 2010-01-14 11:54 modalias
-r--r--r--. 1 root root 4096 2010-01-14 11:54 mouse_activity
-r--r--r--. 1 root root 4096 2010-01-14 11:52 position
drwxr-xr-x. 2 root root    0 2010-01-14 11:54 power
lrwxrwxrwx. 1 root root    0 2010-01-14 11:52 subsystem -> ../../../bus/platform
-r--r--r--. 1 root root 4096 2010-01-14 11:54 temp1
-r--r--r--. 1 root root 4096 2010-01-14 11:54 temp2
-rw-r--r--. 1 root root 4096 2010-01-14 11:52 uevent
-r--r--r--. 1 root root 4096 2010-01-14 11:54 variance

[root@t60 robert]# fgrep "" /sys/devices/platform/hdaps/*
/sys/devices/platform/hdaps/calibrate:(0,-3)
/sys/devices/platform/hdaps/invert:3
/sys/devices/platform/hdaps/keyboard_activity:0
/sys/devices/platform/hdaps/modalias:platform:hdaps
/sys/devices/platform/hdaps/mouse_activity:0
/sys/devices/platform/hdaps/position:(0,-3)
/sys/devices/platform/hdaps/temp1:0
/sys/devices/platform/hdaps/temp2:0
/sys/devices/platform/hdaps/uevent:MODALIAS=platform:hdaps
/sys/devices/platform/hdaps/variance:(0,0)

Version-Release number of selected component (if applicable):
kernel-2.6.32.3-24.fc12.x86_64
hdapsd-20090401-4.fc12.x86_64

How reproducible:
every time

Steps to Reproduce:
1. modprobe hdaps
2. hdapsd
3.
  
Actual results:
hdapsd fails

Expected results:
hdapsd to work

Additional info:

Comment 1 Robert de Rooy 2010-01-14 11:28:20 UTC
I also tried a T41.

# rpm -q kernel hdapsd
kernel-2.6.32.3-24.fc12.i686
hdapsd-20090401-4.fc12.i686

# modprobe hdaps
# dmesg |grep hdaps
hdaps: inverting axis (0) readings.
hdaps: IBM ThinkPad T41 detected.
hdaps: initial latch check good (0x01).
hdaps: device successfully initialized.
input: hdaps as /devices/platform/hdaps/input/input10
hdaps: driver successfully loaded.

# hdapsd
Thu Jan 14 12:17:59 2010: Starting hdapsd
Thu Jan 14 12:17:59 2010: WARNING: You did not supply any devices to protect, trying autodetection.
Thu Jan 14 12:17:59 2010: Could not read from /sys/block/sda/device/unload_heads: Operation not supported
Thu Jan 14 12:17:59 2010: Could not detect any devices.
Usage: hdapsd [OPTIONS]

   -d --device=<device>              <device> is likely to be hda or sda.
                                     Can be given multiple times
                                     to protect multiple devices.
   -f --force                        Force unloading heads, even if kernel thinks
                                     differently (on pre ATA7 drives).
                                     This only works when adding devices by hand (-d).
   -s --sensitivity=<sensitivity>    How sensitive hdapsd should be to movements.
                                     Defaults to 15, higher value means less
                                     sensitive.
   -a --adaptive                     Adaptive threshold (automatic increase
                                     when the built-in keyboard/mouse are used).
   -v --verbose                      Get verbose statistics.
   -b --background                   Run the process in the background.
   -p --pidfile[=<pidfile>]          Create a pid file when running
                                     in background.
                                     If <pidfile> is not specified,
                                     it's set to /var/run/hdapsd.pid.
   -t --dry-run                      Don't actually park the drive.
   -y --poll-sysfs                   Force use of sysfs interface to
                                     accelerometer.
   -l --syslog                       Log to syslog instead of stdout/stderr.

   -V --version                      Display version information and exit.
   -h --help                         Display this message and exit.

You can send SIGUSR1 to deactivate hdapsd for 8 seconds.

Send bugs, comments and suggestions to hdaps-devel.net

# hdapsd -d sda
Thu Jan 14 12:22:04 2010: Starting hdapsd
Thu Jan 14 12:22:04 2010: Selected interface: HDAPS
Thu Jan 14 12:22:04 2010: WARNING: Could not find hdaps input device (No such file or directory). You may be using an incompatible version of the hdaps module. Falling back to reading the position from sysfs (uses more power).
Use '-y' to silence this warning.
Thu Jan 14 12:22:04 2010: Could not open /sys/devices/platform/hdaps/sampling_rate: No such file or directory.
Do you have the hdaps module loaded?

Then moving the ThinkPad gives;
Thu Jan 14 12:22:23 2010: Could not write to /sys/block/sda/device/unload_heads.
Does your kernel/drive support IDLE_IMMEDIATE with UNLOAD?
Thu Jan 14 12:22:23 2010: parking
Thu Jan 14 12:22:23 2010: Could not write to /sys/block/sda/device/unload_heads.
Does your kernel/drive support IDLE_IMMEDIATE with UNLOAD?
Thu Jan 14 12:22:23 2010: Could not write to /sys/block/sda/device/unload_heads.
Does your kernel/drive support IDLE_IMMEDIATE with UNLOAD?
Thu Jan 14 12:22:23 2010: Could not write to /sys/block/sda/device/unload_heads.
Does your kernel/drive support IDLE_IMMEDIATE with UNLOAD?
Thu Jan 14 12:22:24 2010: Could not write to /sys/block/sda/device/unload_heads.
Does your kernel/drive support IDLE_IMMEDIATE with UNLOAD?
Thu Jan 14 12:22:24 2010: Could not write to /sys/block/sda/device/unload_heads.
Does your kernel/drive support IDLE_IMMEDIATE with UNLOAD?
Thu Jan 14 12:22:24 2010: Could not write to /sys/block/sda/device/unload_heads.
Does your kernel/drive support IDLE_IMMEDIATE with UNLOAD?
Thu Jan 14 12:22:24 2010: Could not write to /sys/block/sda/device/unload_heads.
Does your kernel/drive support IDLE_IMMEDIATE with UNLOAD?
Thu Jan 14 12:22:25 2010: Could not read from /sys/block/sda/device/unload_heads: Operation not supported
Thu Jan 14 12:22:25 2010: Could not write to /sys/block/sda/device/unload_heads.
Does your kernel/drive support IDLE_IMMEDIATE with UNLOAD?
Thu Jan 14 12:22:25 2010: un-parking

Comment 2 Tomasz Torcz 2010-01-15 22:30:07 UTC
It seems like a combination of two problems:

1) ThinkPad model not fully supported by in-kernel driver.

2) HDD may not support parking method used by Linux

Could you please download  http://sourceforge.net/projects/tpctl/files/tp_smapi/0.40/tp_smapi-0.40.tgz/download and compile & install it (doing "make HDAPS=1 install")? Fedora policies forbid packaging external modules and some disagreements in kernel community block tp_smapi inclusion ine kernel :/

Comment 3 Robert de Rooy 2010-01-19 14:16:49 UTC
I tried it on my T60, here is what I get;

thinkpad_ec: thinkpad_ec 0.40 loaded.
tp_smapi 0.40 loading...
tp_smapi successfully loaded (smapi_port=0xb2).
hdaps: LENOVO ThinkPad T60 detected, setting orientation 1
hdaps: initial mode latch is 0x05
hdaps: setting ec_rate=250, filter_order=2
hdaps: device successfully initialized.
input: ThinkPad HDAPS joystick emulation as /devices/virtual/input/input9
input: ThinkPad HDAPS accelerometer data as /devices/virtual/input/input10
hdaps: driver successfully loaded.

# hdapsd 
Tue Jan 19 14:47:24 2010: Starting hdapsd
Tue Jan 19 14:47:24 2010: WARNING: You did not supply any devices to protect, trying autodetection.
Tue Jan 19 14:47:24 2010: Adding autodetected device: sda
Tue Jan 19 14:47:24 2010: Selected interface: HDAPS
Tue Jan 19 14:47:24 2010: Selected HDAPS input device: /dev/input/event10
Tue Jan 19 14:47:28 2010: parking
Tue Jan 19 14:47:29 2010: un-parking

I have no idea what issue(s) are blocking tp_smapi from being upstreamed. But to me it seems that hdapsd in its current form in Fedora is next to useless as it fails on both old and newer ThinkPads.

As to the Fedora policies issue you mention, then how did the nouveau driver get included before it was upstream?
Is perhaps rpmfusion a (temporary) solution?

Comment 4 Robert de Rooy 2010-01-19 14:51:16 UTC
Here is what I get on the T41

thinkpad_ec: thinkpad_ec 0.40 loaded.
tp_smapi 0.40 loading...
tp_smapi successfully loaded (smapi_port=0xb2).
hdaps: initial mode latch is 0x01
hdaps: setting ec_rate=250, filter_order=2
hdaps: device successfully initialized.
input: ThinkPad HDAPS joystick emulation as /devices/virtual/input/input10
input: ThinkPad HDAPS accelerometer data as /devices/virtual/input/input11
hdaps: driver successfully loaded.

# hdapsd -d sda
Tue Jan 19 15:46:45 2010: Starting hdapsd
Tue Jan 19 15:46:45 2010: Selected interface: HDAPS
Tue Jan 19 15:46:45 2010: Selected HDAPS input device: /dev/input/event11
Tue Jan 19 15:47:10 2010: Could not write to /sys/block/sda/device/unload_heads.
Does your kernel/drive support IDLE_IMMEDIATE with UNLOAD?
Tue Jan 19 15:47:10 2010: parking
Tue Jan 19 15:47:10 2010: Could not write to /sys/block/sda/device/unload_heads.
Does your kernel/drive support IDLE_IMMEDIATE with UNLOAD?
Tue Jan 19 15:47:10 2010: Could not write to /sys/block/sda/device/unload_heads.
Does your kernel/drive support IDLE_IMMEDIATE with UNLOAD?
Tue Jan 19 15:47:11 2010: Could not read from /sys/block/sda/device/unload_heads: Operation not supported
Tue Jan 19 15:47:11 2010: Could not write to /sys/block/sda/device/unload_heads.
Does your kernel/drive support IDLE_IMMEDIATE with UNLOAD?
Tue Jan 19 15:47:11 2010: un-parking

# fgrep "" /sys/block/sda/device/*
fgrep: /sys/block/sda/device/delete: Permission denied
/sys/block/sda/device/device_blocked:0
/sys/block/sda/device/evt_media_change:0
/sys/block/sda/device/iocounterbits:32
/sys/block/sda/device/iodone_cnt:0xe60d
/sys/block/sda/device/ioerr_cnt:0x4d
/sys/block/sda/device/iorequest_cnt:0xe60d
/sys/block/sda/device/modalias:scsi:t-0x00
/sys/block/sda/device/model:HTS548080M9AT00 
/sys/block/sda/device/queue_depth:1
/sys/block/sda/device/queue_type:none
fgrep: /sys/block/sda/device/rescan: Permission denied
/sys/block/sda/device/rev:MG4O
/sys/block/sda/device/scsi_level:6
/sys/block/sda/device/state:running
/sys/block/sda/device/timeout:30
/sys/block/sda/device/type:0
/sys/block/sda/device/uevent:DEVTYPE=scsi_device
/sys/block/sda/device/uevent:DRIVER=sd
/sys/block/sda/device/uevent:MODALIAS=scsi:t-0x00
fgrep: /sys/block/sda/device/unload_heads: Operation not supported
/sys/block/sda/device/vendor:ATA

Comment 5 Tomasz Torcz 2010-01-28 14:11:48 UTC
Well, the situation is quite sad for many Thinkpad owners (me included) right know. In order to have disk protected, we must compile two pieces of code:
- tp_smapi
- hdapsd

I made hdapsd package available to reduce amount of work by 50%. It's not perfect, but still better.

As for matter with driver itself:
1. https://fedoraproject.org/wiki/KernelDriverPolicy  only allows drivers which are going to be merged upstream. There are some exceptions, but very hard to obtain. And NV driver you mentioned eventually got merged upstream.
2. Mergeability problem of tp_smapi lies in anonymity of author. See: http://lwn.net/Articles/194729/ and http://lwn.net/Articles/195643/ . Until this is solved (and newer tp_smapi with hdaps is merged in mainline kernel), Fedora won't carry legally dubious patch.

I believe akmod package carried by rpmfusion is only viable solution right know. I will investigate this later.


Note You need to log in before you can comment on or make changes to this bug.