Purism

Purism

Beautiful, Secure, Privacy-Respecting Laptops, Tablets, PCs, and Phones
Purism

Beta Polish

In September, we prioritized fixes for the out-of-box experience on PureOS Crimson.  For the rest of the beta milestone, we are prioritizing work that benefits the most from user feedback.  That includes functionality that must account for device-to-device variations and that is strongly influenced by users’ individual preferences.

One feature that checks both of those boxes is haptic feedback on the Librem 5.  That is the small vibration you feel when you press keys on the soft keyboard, launch apps, and other similar actions.  Haptic feedback gives you an additional signal that your touches worked, since the touch screen itself does not move or click like buttons.

The state in Byzantium

PureOS Byzantium did have haptic feedback, but it was not without issues.  Occasionally vibration would stop working, and we could not tune the feedback for the right subtlety without losing it entirely.  The vibrations should be just strong enough to feel them, but not so strong that they reduce your control of the device or blend into each other for rapid key presses.  Each key press should produce a distinct, separate vibration, even if they are close together.

PureOS includes a feedback theme that describes how the Librem 5 should vibrate for certain events.  (The same theme also controls LED lights and sounds, since they are also forms of feedback.)  The theme can specify how long to turn on the motor, the strength to apply, and other factors like periodic vibrations and fade-in.

Screenshot of JSON theme data from the linked feedback theme
Alarms fade in and keep pulsing until the alarm is dismissed, while a key press produces a brief one-time vibration.

Most of those parameters didn’t really work correctly on Byzantium.  While we could tune the feedback a bit, the pulses were too long and too strong.  Keyboard pulses would blend together for fast typing, and sometimes it would stop activating the motor entirely.

A binary system

The physical motor does not actually have any strength, fade-in, or any other parameters.  It only has two states: on, and off.

To produce the subtle vibrations from our theme, the Linux kernel uses pulse-width modulation, or PWM.  It quickly changes the on/off signal to approximate any level in between “off” and “on”.

The motor takes a little bit of time to physically start or stop spinning.  As long as we modulate the on/off signal more quickly than the motor can start or stop spinning, we can produce a strength in between.

With the motor on 50% of the time, we can approximate half intensity:

With 75% duty, we can produce a higher intensity:

Speed up

The PWM rate was the problem: it was set to just 1 Hz, or one change per second.  The motor spins up and down much more quickly than that, so this didn’t really work.  You couldn’t produce a pulse of 0.1 seconds at 50% strength – you’d get either 0.1 seconds of 100% strength if the PWM ended up ‘on’, or you might end up with 0.1 seconds of 0% strength if enough earlier pulses blended together to reach an ‘off’ modulation.

Since the modulation frequency is too low, 50% duty doesn’t produce 50% intensity any more.  Instead, you get 1-second pulses.  If the vibration is less than 1 second, you just get a 100% strength pulse.  The modulation didn’t do anything in that case.

The modulation still doesn’t really do anything at 75% duty other than change the length of the pulses.

We knew this, but the theme was already producing passable feedback in Amber and Byzantium.  It wasn’t really correct, but it was passable with some short pulses that didn’t really try to control the intensity.  Since it was mostly working, and fixing it would break the theme, it was left alone.

In Crimson, the PWM rate has been increased to 20 kHz, or 20,000 changes per second.  Now we get correct modulation!

However, that means that the theme, which was created with the broken modulation, didn’t work well any more.

Fit and finish

With the kernel modulation fixed, we could now tune the theme properly.  Call vibrations now have the right pulses and strength, key presses are nicely distinct yet subtle, and SMS notifications have a unique pattern.

Vibration feedback though is sensitive to device-to-device variation.  No two motors are perfectly identical, and variations always exist.  We’ve tuned the feedback theme to work well even as motor strength varies, but we wanted to get this change in early during beta to permit more fine-tuning.  Similarly, individuals will have preferences about how strong the feedback is.  It is also difficult to separate individual preference from device variation without specialized measurements!

As with anything in PureOS, you can override the theme with your own preferences, if you like.  We want the default theme to suit a broad range of users and devices, so let us know if you have suggestions!

Keep on rolling

In addition to haptic feedback, we also updated several other packages in October.

We made several stability improvements relating to Phosh and Phoc.  We fixed crashes in phoc that could happen when disconnecting an external display by backporting improvements from upstream.  gnome-control-center does not show the new “Mirror Displays” setting when running in Phosh, since it is not yet implemented in Phosh.  We also found and fixed a problem with popups – some kinds of popups could leave blinking leftovers on the screen if they were moved around.  We sent that fix upstream too!

Phosh now launches each application in its own systemd scope, so the out-of-memory handler can terminate individual applications properly.  We’ve also switched from dbus-daemon to dbus-broker, so apps launched via inter-process messages will also launch in separate scopes.

Many packages were updated with new upstream versions.  Linux on the Librem 5 is now up to 6.6.110, and chatty was updated too.  systemd-zram-generator is up to date with Debian and no longer needed PureOS-specific changes.  libglibutil, libgbinder, and gbinder-python were updated to improve compatibility with Waydroid.  grub2 was updated to reduce the PureOS-specific changes we carry.

gnome-clocks was launching at boot incorrectly on some systems, so we fixed that.  The GNOME Bluetooth pairing dialog, which is part of gnome-bluetooth3, now fits correctly on the Librem 5 display.

Finally, we also kept up on archive maintenance.  PureOS’s package priorities are again synchronized with Debian.  We dropped more outdated packages, synchronized changes across suites as needed, and cleared stuck migrations.  The synchronization lists are very clean now!

With these done, we have our sights on the beta release milestone.  Thanks again to all of our customers and PureOS subscribers for making this work possible!

Recent Posts

Related Content

Tags