dts: imx8mq-librem5: Set vibrator's PWM frequency to 100Hz
1Hz as used previously was way too long.
Note that feedbackd theme will have to be adjusted, as it was tuned to broken PWM and doesn't really make much sense with it fixed.
Merge request reports
Activity
Filter activity
A way to test:
#!/bin/env python3 import fcntl, struct, array, time from math import sqrt EVIOCRMFF = 0x40044581 EVIOCSFF = 0x40304580 class Vibrate: def __init__(self, file): self.ff_joy = open(file, "wb") def set_gain(self, gain): g = struct.pack('LLHHi', 0, 0, 0x15, 0x60, int(gain * 0xFFFF)); self.ff_joy.write(g) self.ff_joy.flush() def close(self): self.ff_joy.close() def new_effect(self, strong, weak, length, id = -1): effect = struct.pack('HhHHHHHxHH', 0x50, id, 0, 0, 0, length, 0, int(strong * 0xFFFF), int(weak * 0xFFFF)) a = array.array('h', effect) fcntl.ioctl(self.ff_joy, EVIOCSFF, a, True) return a[1] def play_efect(self, id): if type(id) == tuple or type(id) == list: ev_play = '' for i in id: ev_play = ev_play + struct.pack('LLHHi', 0, 0, 0x15, i, 1) else: ev_play = struct.pack('LLHHi', 0, 0, 0x15, id, 1) self.ff_joy.write(ev_play) self.ff_joy.flush() def stop_effect(self, id): if type(id) == tuple or type(id) == list: ev_stop = '' for i in id: ev_stop = ev_stop + struct.pack('LLHHi', 0, 0, 0x15, i, 0) else: ev_stop = struct.pack('LLHHi', 0, 0, 0x15, id, 0) self.ff_joy.write(ev_stop) self.ff_joy.flush() def forget_effect(self, id): if type(id) == tuple or type(id) == list: for i in id: fcntl.ioctl(self.ff_joy, EVIOCRMFF, i) else: fcntl.ioctl(self.ff_joy, EVIOCRMFF, id) f = Vibrate("/dev/input/by-path/platform-vibrator-event") p = f.new_effect(1.0, 1.0, 10000) f.set_gain(0.0) f.play_efect((p)) for i in [*range(101),*([100]*100),*range(100,0,-1)]: f.set_gain(pow(i / 100, 1)) time.sleep(0.03) f.stop_effect((p)) f.forget_effect((p)) f.set_gain(1.0)
mentioned in issue feedbackd-device-themes#5
added 98219 commits
-
040a5df2...e8fe8efa - 98218 commits from branch
Librem5:pureos/byzantium
- 9387da92 - dts: imx8mq-librem5: Set vibrator's PWM frequency to 100Hz
-
040a5df2...e8fe8efa - 98218 commits from branch
added 18857 commits
-
9387da92...8b8aac89 - 18856 commits from branch
Librem5:pureos/latest
- 54397d04 - dts: imx8mq-librem5: Set vibrator's PWM frequency to 100Hz
-
9387da92...8b8aac89 - 18856 commits from branch
Please register or sign in to reply