Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toshiba_haps is now in /sys/devices/platform/TOS620A:00 #15

Open
mercuriete opened this issue Sep 20, 2015 · 13 comments
Open

toshiba_haps is now in /sys/devices/platform/TOS620A:00 #15

mercuriete opened this issue Sep 20, 2015 · 13 comments

Comments

@mercuriete
Copy link

mercuriete commented Sep 20, 2015

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 SMP PREEMPT Tue Sep 8 21:37:19 WEST 2015 x86_64 Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz GenuineIntel GNU/Linux

@mercuriete
Copy link
Author

sorry this driver is an ACPI driver and send an ACPI event.

the solution was this -> http://nathanielmnelson.com/node/24

using acpid instead hdapsd

then configure some files in /etc/acpi/events/

and that it.

this ticket can be closed :)

@evgeni
Copy link
Member

evgeni commented Oct 4, 2015

Hi,

good that it works for ya with the pure-ACPI method. Still, I would have expected it to work with hdapsd too, reading the HW decision from TOSHIBA_MOVEMENT_FILE.

Are you using the driver mentioned in the link, or the one in the kernel? https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/platform/x86/toshiba_haps.c

@evgeni
Copy link
Member

evgeni commented Feb 14, 2016

@mercuriete ping? :)

@klondi
Copy link

klondi commented Apr 7, 2016

@evgeni I have this problem too, and I'm using the driver provided by the kernel.

@klondi
Copy link

klondi commented Apr 7, 2016

Also documentation for this is available on https://www.kernel.org/doc/Documentation/laptops/toshiba_haps.txt

@evgeni
Copy link
Member

evgeni commented Apr 7, 2016

@klondi thanks for the heads up. what I am currently missing in the described API is a file that tells me "damn, park the heads, now". I guessed this is the "movement" file but the output of @mercuriete does not show it?

@klondi
Copy link

klondi commented Apr 7, 2016

@evgeni it should be an ACPI event usually when the event triggers you get these two events (from dmesg):
[673657.468709] toshiba_haps: Received event: 0x80
[673658.578680] toshiba_haps: Received event: 0x81

First one is park the heads now IIRC second is you can unpark them now if you want. I'm unsure though which event interface generates this as it is ACPI based.

Internet archive gives a hint on how this is handled by acpid though https://web.archive.org/web/20150218214553/http://nathanielmnelson.com/node/24

@klondi
Copy link

klondi commented Apr 7, 2016

@evgeni Some googling pointed me at the kacpimon tool and this tool returned this:

Kernel ACPI Event Monitor...
open for /proc/acpi/event: No such file or directory (2)
  (ACPI proc filesystem may not be present)
/dev/input/event0 (Lid Switch) opened successfully
/dev/input/event1 (Power Button) opened successfully
/dev/input/event10 (HDA Intel HDMI HDMI/DP,pcm=3) opened successfully
/dev/input/event11 (HDA Intel HDMI HDMI/DP,pcm=7) opened successfully
/dev/input/event12 (HDA Intel HDMI HDMI/DP,pcm=8) opened successfully
/dev/input/event13 (Toshiba WMI hotkeys) opened successfully
/dev/input/event2 (Power Button) opened successfully
/dev/input/event3 (Video Bus) opened successfully
/dev/input/event4 (Video Bus) opened successfully
/dev/input/event5 (AT Translated Set 2 keyboard) opened successfully
/dev/input/event6 (HDA Intel PCH Mic) opened successfully
/dev/input/event7 (HDA Intel PCH Headphone) opened successfully
/dev/input/event8 (TOSHIBA Web Camera - HD) opened successfully
/dev/input/event9 (SynPS/2 Synaptics TouchPad) opened successfully
Netlink ACPI Family ID: 20
Netlink ACPI Multicast Group ID: 7
netlink opened successfully
Press Escape to exit, or Ctrl-C if that doesn't work.
Input Layer:  Type: 4  Code: 4  Value: 28
Input Layer:  Type: 1  Code: 28  Value: 0
Input Layer:  Sync
netlink:  TOS620A:00 00000080 00000000
netlink:  TOS620A:00 00000081 00000000
netlink:  TOS620A:00 00000080 00000000
netlink:  TOS620A:00 00000081 00000000
netlink:  TOS620A:00 00000080 00000000
netlink:  TOS620A:00 00000081 00000000
netlink:  TOS620A:00 00000080 00000000
netlink:  TOS620A:00 00000081 00000000

So basically we need to listen on the netlink interface for event 80 and 81 for device TOS620A:00. The source code for how kacpimon does this is provided by acpid.

@mercuriete
Copy link
Author

Sorry for not answer! :(

I have working my toshiba sensors with acpid.
I dont recall exactly how i did it.

I created some files to tell acpid that on acpi event the hard disk should be stopped.
when i reach my home i will share my files.

By the way @evgeni i think its the acpi kernel driver.

@mercuriete
Copy link
Author

mercuriete commented May 26, 2016

Tutorial for get acpid working with the toshiba acpi driver.

dmesg output:

[ 4353.935442] toshiba_haps: Received event: 0x80
[ 4356.469527] toshiba_haps: Received event: 0x81

this means you have the acpi kernel driver working

so you have to install acpid and write some files in /etc/acpi/

i created 2 files, 1 file per event

/etc/acpi/events/toshiba_hdaps_unload

mercuriete@localhost /etc/acpi/events $ cat toshiba_hdaps_unload
event=TOS620A:00 00000080 00000000
action=echo 30000 > /sys/block/sda/device/unload_heads

/etc/acpi/events/toshiba_hdaps_load

mercuriete@localhost /etc/acpi/events $ cat toshiba_hdaps_load
event=TOS620A:00 00000081 00000000
action=echo 0 > /sys/block/sda/device/unload_heads

With this 2 files you will trigger an action whenever an event is triggered.

For logging all event if you dont know which event is what you want.

  1. stop the daemon (with systemd)
    sudo systemctl stop acpid

  2. start the daemon in console.

sudo acpid --debug --logevents

some output:

acpid: received netlink event " TOS620A:00 00000080 00000000"
acpid: received netlink event " TOS620A:00 00000081 00000000"

then you can copy this code and put it in your event file in /etc/acpi/events/

I dont know any practical way to know if you get all working.
what i did was:

  1. copy a big file that stress you hard drive
  2. open ksysguard to know the transfer rate of your disk
  3. shake your laptop
  4. now you will see the tranfer rate goes down to 0 Kb/s
  5. stop shaking your laptop
  6. then you will see the tranfer rate come back to full speed.

I hope this kind of tutorial was useful for someone that visit this page.

@evgeni
Copy link
Member

evgeni commented May 30, 2024

Yeah, I have no idea what I was reading when I wrote d24b7ad, but that movement file doesn't exist, so hdapsd can't work right now.

Does /sys/devices/platform/toshiba_acpi/position work for y'all?

@evgeni
Copy link
Member

evgeni commented May 30, 2024

@mercuriete
Copy link
Author

@evgeni Sorry for not anwering.
I muted all github notifications and today I read your comments.

I need to upgrade my old toshiba laptop but I can try to post
find /sys/devices/platform/toshiba_acpi

when I could.
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants