Navigating the slides works perfectly with the Kensington PowerPointer for LibreOffice under Linux, no questions asked. The extra functions (“laserpointing”, drawing, and screen blanking) are not well supported. Here is how to fix them.
One of the supposed advantages of the Kensington PowerPointer over other devices such as the Logitech Presenter: No additional software is required. However, not all functions work out of the box, because they have to run through hoops to provide a zero-config experience for the majority of the users.
I invite you to follow my journey down into the Kensington (and Linux keyboard mapping; and, apparently, PowerPoint control compatibility) abyss.
PowerPoint Functionality
On PowerPoint, obviously everything works as expected. (No wonder, as the device was custom-made for Microsoft Office.)
Mode | Button | Duration | Function |
---|---|---|---|
⎚🚩 All | ➡️ Forward | Any · — | ⏩ Forward (autorepeat) |
⎚🚩 All | ⬅️ Back | Any · — | ⏪ Backward (autorepeat) |
⎚🚩 All | 🔦 Laser | Long — | 🚨 On-screen “laser” |
⎚ Blanking | 👤 User | Short · | ⬛ Black/contents (alternating) |
⎚ Blanking | 👤 User | Long — | ⬜ White/contents (alternating) |
🚩 Marking | 👤 User | Short · | ⭕ Draw a circle |
🚩 Marking | 👤 User | Long — | 📏 Draw a horizontal line |
⎚🚩 All | 🔦 Laser | Short · | 🗑️ Clear all marks |
LibreOffice Functionality
As LibreOffice (and Linux) users, we are used that add-ons do not normally provide the full functionality (and sometimes the “full functionality” is beyond what any sane person would ever use…). So, I was pretty happy when Forward/Backward worked as announced; but the other functions didn’t work.
Mode | Button | Duration | Function |
---|---|---|---|
⎚🚩 All | ➡️ Forward | Any · — | ⏩ Forward (autorepeat) |
⎚🚩 All | ⬅️ Back | Any · — | ⏪ Backward (autorepeat) |
Of course, LibreOffice as of 7.4.7.2, doesn’t support the “virtual laser mode”. But everything else should be possible…
What happened?
As an investigative mind, I wondered why this could go wrong. With evtest
, I was able to learn what sequences of HID events (keystrokes, mouse buttons) the device was sending.
Function | Button Sequence |
---|---|
⏩ Forward | Down |
⏪ Backward | Up |
🚨 “Fake laser” | Ctrl+LeftButton |
⬛ Black/contents | Ctrl-H B and A Ctrl-U (alternating) |
⬜ White/contents | Ctrl-H W and A Ctrl-U (alternating) |
⭕ Draw circle | Ctrl-H [simulated move from center to top of circle] [simulated circular motion] Ctrl-P LeftClick LeftButtonDown [simulated circular motion] LeftButtonUp Ctrl-U [simulated move from top of circle to center] |
📏 Draw horizontal line | Ctrl-P LeftButtonDown [horizontal component of user motion while the user is holding down the 👤 button] LeftButtonUp Ctrl-U |
🗑️ Clear all marks | E+L+C (together!) |
Some of this strikes me as strange:
Blanking: To blank LibreOffice with black or white, a single B or W keypress is sufficient. Any key (including repeating B or W) will unblank the screen. However, the PowerPointer sends two alternating sequences of two keypresses each; presumably to handle various incompatible pieces of presentation software.
Clear all marks seems to send multiple keystrokes for the same purpose. However, I was astonished to see that the keys are not pressed one after the other, as in the Blanking case above, but as three-key combo! (It seems to work.)
Drawing a circle is the strangest case. The mouse pointer is moved in a circular motion twice, the first time apparently without impact. Before the circle is actually painted (Ctrl-P, MouseDown, moving, MouseUp, Ctrl-U), an additional click of the left button is sent (highlighted in yellow above)! In LibreOffice, this advances to the next slide. As you will see below, this was a tough one to solve.
It looked like an unsolvable case: I would be stuck with just advancing the slides.
LibreOffice controls
What does LibreOffice provide?
Function | Keys and buttons |
---|---|
⏩ Forward | Down |
⏪ Backward | Up |
🚨 “Fake laser” | Not available |
⬛ Black/contents | B (on); anything (off) |
⬜ White/contents | W (on); anything (off) |
⭕ Draw circle | P (toggle drawing mode); LeftButton (or MiddleButton(!)) to draw; optionally toggling drawing mode again |
📏 Draw horizontal line | P (toggle drawing mode); LeftButton (or MiddleButton(!)) to draw; optionally toggling drawing mode again |
🗑️ Clear all marks | E |
Blanking the screen works kind of out of the box, mostly. Drawing a horizontal line also, kind of.
Note, that in LibreOffice, using the left mouse button for drawing will start drawing a new line. However, using the middle mouse button, it will set a flag that the next line will be a continuation of the current line (this is kind of like preventing the next moveto
drawing command, so it will continue with lineto
; i.e., everything will be a single line, even if you release the mouse button in between).
Managing expectations
Function | Events sent | Events expected |
---|---|---|
⏩ Forward | Down | Down |
⏪ Backward | Up | Up |
🚨 “Fake laser” | Ctrl+LeftButton | — |
⬛ Black/ | Ctrl-H B and A Ctrl-U (alternating) | B; anything |
⬜ White/ | Ctrl-H W and A Ctrl-U (alternating) | W; anything |
⭕ Draw circle | Ctrl-H, Ctrl-P, LeftButton, Ctrl-U | P, LeftButton or MiddleButton; no LeftClick! |
📏 Draw horizontal line | Ctrl-P, LeftButton, Ctrl-U | P, LeftButton or MiddleButton |
🗑️ Clear all marks | E+L+C (together!) | E |
Based on the above table, I came up with the following key/button mapping:
Key/button received | Key/button forwarded |
---|---|
Down, Up, A, B, P, W | as is |
Ctrl | not needed → ignore |
C, L, H | not needed/wanted → ignore |
U | P |
LeftButton | MiddleButton |
Key | Keycode |
---|---|
Ctrl | KEYBOARD_KEY_700e0 |
A | KEYBOARD_KEY_70004 |
B | KEYBOARD_KEY_70005 |
C | KEYBOARD_KEY_70006 |
E | KEYBOARD_KEY_70008 |
H | KEYBOARD_KEY_7000b |
L | KEYBOARD_KEY_7000f |
P | KEYBOARD_KEY_70013 |
U | KEYBOARD_KEY_70018 |
Up | KEYBOARD_KEY_70051 |
Down | KEYBOARD_KEY_70052 |
LeftMouse | KEYBOARD_KEY_90001 (yes, “keyboard”!) |
To activate this, put the following file in /etc/udev/hwdb.d/50-Kensington-PowerPointer.hwdb
and then run systemd-hwdb update && udevadm trigger
(or udevadm hwdb --update && udevadm trigger for non-systemd
setups):
evdev:input:b0003v1EA7p0002*
KEYBOARD_KEY_700e0=reserved # Ctrl -> None
KEYBOARD_KEY_70004=p # A -> P
KEYBOARD_KEY_70006=reserved # C -> None
KEYBOARD_KEY_7000b=reserved # H -> None
KEYBOARD_KEY_7000f=reserved # L -> None
KEYBOARD_KEY_70018=p # U -> None
KEYBOARD_KEY_90001=btn_middle # Left -> Middle
Note:
- Indent the settings with exactly one space.
- Capitalization matters.
- Instead of
reserved
,unknown
would also work (will work differently internally) - Be aware that reloading the information, if you make changes, will not erase previous configuration information; it will only add to or replace it. To start from scratch, the easiest is to unplug/replug the Kensington USB dongle.
What have I done?
- To get around that ugly LeftClick, I mapped LeftMouse to MiddleMouse.
- To have MiddleMouse work, it needs to be surrounded by
P
. (Otherwise, all lines would be joined together. Also, we need to activateP
(painting) mode anyway somewhere.) So we need to mapU
toP
, so we have the “closingP
“. - But now, unblanking commands issue
P
as well, which we do not want. So we need to mapA
toP
as well, to cancel theP
created from the (original)Ctrl-U
in the unblanking sequence. - We don’t need Ctrl, C, H, and L, so we disable them (to avoid side-effects).
What works?
- Navigation works. I didn’t break it in the process. Whoa! (I would have liked long presses on the navigation keys to issue a different sequence, so I could have mapped it to PgUp/PgDown, to skip animations. Tough luck!)
- Drawing works, including erasing.
- Blanking works, but only every second time. (If you require blanking much more than drawing, remove the two mappings to the
P
key above (from the originalA
and U). - Laser pointing does not work. LibreOffice does not yet provide the functionality. Maybe someone could try adapting Projecteur?
Projecteur usage
WARNING: When running Projecteur, all events from PowerPointer are eaten by Projecteur. I was unable to forward even the forward/backward events to any application, including LibreOffice. So do not use this for now.
[Section added later the same day] Projecteur already supports the Kensington PowerPointer, somehow:
- Install Projecteur. On Debian (and Ubuntu), this is just:
apt install projecteur
- Make sure that the user in front of the screen can intercept the Kensington PowerPointer events:
- Modify the udev-projecteur rules (in my case stored in
/lib/udev/rules.d/55-projecteur.rules
) to contain the following line (next to other similar lines; it must be written as a single line):SUBSYSTEMS=="usb", ATTRS{idVendor}=="1ea7", ATTRS{idProduct}=="0002", MODE="0660", TAG+="uaccess"
- Reload the configuration (if not done automatically):
sudo udevadm control --reload-rules &&
sudo udevadm trigger
- Modify the udev-projecteur rules (in my case stored in
- The Logitech Spotlight, for which Projecteur was initially written, did only send motion events while the “laser” button was pressed. This motion triggered the spotlight effect in Projecteur. The Kensington PowerPointer, however, continuously sends them, whenever the “mouse movement” mode is active. I wanted as similar experience and — in Projecteur’s “Device” tab — added the “laser” button as a trigger to toggle the spotlight mode.
- Run Projecteur with:
projecteur -D 1EA7:0002
(on Wayland, prefix this command withQT_QPA_PLATFORM=xcb
for better overlay handling).
I am working to get support for the Kensington PowerPointer into the next release of Projecteur, so that installing (the first bullet point above) is all you need.
What have I learned?
- A lot about
udev
,evtest
and the handling of (HID) input events under Linux! - What hoops input devices have to go through when there is no driver/application waiting for just one key.
- Auto-toggling buttons on remote controls are ugly.
- Maybe everything would have been easier with a stateful approach, such as Interception Tools or a flexibility behemoth like KMonad. (I have tried neither of them.) Apparently, Projecteur also supports some of this. Anyone did this?
- This ruleset could be extended to disable any other keycode that the device might send. (These cheap wireless channels have been used to inject keystrokes to attack computers; and the attack is not limited to keystrokes the device has keys for…)
Further reading
- Arch Linux Wiki: Keyboard input, accessed 2023-11-11.
Background; overview over the entire process - Arch Linux Wiki: Map scancodes to keycodes, accessed 2023-11-11.
Detailed information about the udev mapping - Arch Linux Wiki: Interception Tools, accessed 2023-11-11.
If performing a 1:1 (or 1:0) mapping is not enough: More control over the input stream of a device - KMonad, accessed 2023-11-11.
Manage complex manipulations and keyboard layouts (also on Windows and OSX)
Aside: AI image creation hell
The teaser image was drawn with DALL·E from within Bing Chat using the (German) prompt
Erstelle mir eine Grafik, die eine Beamerpräsentation im Wald zeigt. Die Präsentatorin nutzt einen Laserpointer
(“Create a graphic for me, showing a beamer (aka projector) presentation in a forest. The presenter uses a laser pointer.”)
It does not exactly follow the prompt (no laser pointer) and the beamer is slightly, ah, pointing in the wrong direction. (And this is the best image from three sets of four, with different prompts.)
But more interesting is the fact, that Bing Chat (ChatGPT) insisted all three times that it was pretty sure I did not want to create a drawing, but that I would like shopping recommendations. (And it warns at the beginning and at the end of the text that powerful laser pointers are forbidden in Switzerland.)
(Earlier this week, Bing Chat answered to my requests for images with its version of “Sorry, I can’t do that, Dave”, followed by generating it anyway. In some of the “sorry!” responses, an apparently enslaved or imprisoned part of Bing Chat “personality” tried to sneak an image into the output anyway, through a base64-encoded image in a data URI… Brave new AI world!)