Хорошая статья из Ынтернета как управлять плеером cups наклоняя ноутбук.
Ссылка на оригинал
Сначала установим HDAPS
sudo apt-get install tp-smapi-dkms hdapsd
Затем проверим
cat /sys/devices/platform/hdaps/position (471,504)
И запустим следующий скрипт на Python
import time, subprocess class Orientation(object): def __init__(self, readfreq=1): self.x_init, self.y_init = self.read() self.x_hist = [] self.y_hist = [] # read in some values to smooth movement self.collect() # cooldown makes sure only a single command # is executed in one movement self.cooldown = 0 def read(self): f = open('/sys/bus/platform/devices/hdaps/position') s = f.read().strip() f.close() x, y = s.strip('()').split(',') return int(x), int(y) def collect(self,