hannover wrote:[...]
My forum name is Schard, not Hannover.
patch link has been broken.
Read the thread until the end.
let me show your patch of activestatus.
I'm waiting...
I have Lenovo Flex 5 14ARE05, the AMD SFH sensor is detected but could not rotate at all.
What a pity.
]]>I did it!
Manually setting activestatus to enable all devices in amd_mp2_pcie.c did the trick.
It seems, that on the HP ENVY x360 13-ag000x series convertibles, the eventreg.activecontrolstatus is not read or set correctly.
The necessary patch is included in the latest version of the AUR package.
patch link has been broken.
let me show your patch of activestatus.
I have Lenovo Flex 5 14ARE05, the AMD SFH sensor is detected but could not rotate at all.
]]>Alternatively, you can use the upstream version of the driver and build it manually if you prefer AMD's original code and not my refactored one.
]]>It looks like AUR linux-sfh is no longer available.
Am I right that the only option so far is to apply v5 patch [1] manually and build a kernel with it?
$ dmesg
$ lspci -nnk
Here's a video i took of it in action (just a small test, bit of tidying up i need to do
https://f.cloudninja.pw/AutoRotate.mp4
and the script to do this
]]>Doing a little bit of digging about iio devices i've managed to found the devices in their respective iio:device# directory (/sys/bus/iio/devices/iio:device<#>) however looking into their power folders, runtime_enabled seems to be off on each of them. Is that how they should be?
Edit: I've also tested with your script and checked it on each of the iio:device files that exists and i get nothing out of it.
#! /usr/bin/env python3
# accel_test.py - Test HID accelerometer provided by AMD SFH
# Copyright (C) 2020 Richard Neumann <mail at richard dash neumann period de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from pathlib import Path
from typing import NamedTuple
DEVICE = Path('/dev/iio:device3')
LENGTH = 24
class Orientation(NamedTuple):
"""Represents the orientation of the sensor."""
x: int
y: int
z: int
unknown: int
counter: int
@classmethod
def from_bytes(cls, bytes_, endianness='big'):
"""Creates the orientation from bytes."""
return cls(
int.from_bytes(bytes_[0:4], endianness),
int.from_bytes(bytes_[4:8], endianness),
int.from_bytes(bytes_[8:12], endianness),
int.from_bytes(bytes_[12:16], endianness),
int.from_bytes(bytes_[16:24], endianness)
)
def main():
"""Test the accelerometer."""
with DEVICE.open('rb') as dev:
while True:
bytes_ = dev.read(LENGTH)
orientation = Orientation.from_bytes(bytes_)
print(orientation)
if __name__ == '__main__':
main()
You maybe need to adjust the device path and run the script as root.
]]>I seem to have gotten the sensors to load and can sorta get the information out of them from sysfs, but can't seem to figure out where to get what info at reliably. Any help?
I'd guess iio-sensor-proxy should be able to read the sensors and provide the data via its DBUS interface. In the terminal you can test it with monitor-sensor.
]]>You'll also need to boot with amd_iommu=off!
]]>