This widget could not be displayed.
This widget could not be displayed.
cancel
Showing results for 
Search instead for 
Did you mean: 

Duo Pro 2024 UX8406 Linux: Screen dock/un-dock display control and keyboard BT pairing

Russtopia
Star I

Hi all,

After some hacking I've gotten my UX8406 to auto-switch its lower display upon keyboard removal/dock nicely.

System: UX8406
OS: Linux (Devuan daedalus x86_64)
Desktop: XFCE (XWindows)

My initial approach was to add rules to udev, but docking and undocking the keyboard is extremely noisy using this method, as the pogo pin connections are not debounced wrt. USB events, or udev itself generates separate events for each sub-device comprising the keyboard+touchpad composite device(s); the resulting 'storm' of desktop re-configurations via the xrandr screen tool is ugly, causing multiple rapid reflashes of the screen and sometimes even crashes the desktop.

So, the simplest/best method so far seems to be simply monitoring the output of the `lsusb` command for the keyboard's entry.

A simple bash script running a forever-loop, monitoring the usb device's presence or absence and calling `xrandr` on dock/detach events works nicely.

---

[/usr/local/bin/asusUX8406_kbdwatch]

#!/bin/bash

me=$(basename "$0")
laststate=2

while true; do
  sleep 3
  output=$(lsusb -d 0b05:1b2c)
  stat=$?
  if [ $stat == 1 ] && [ $laststate != 1 ]; then
    ## kbd removed, enable lower display
    laststate=1
    logger -p user.info "${me} KEYBOARD REMOVED"
    xrandr --auto && xrandr --output eDP-2 --below eDP-1
  elif [ $stat == 0 ] && [ $laststate != 0 ]; then
    ## kbd replaced, disable lower display
    laststate=0
    logger -p user.info "${me} KEYBOARD DOCKED"
    xrandr --output eDP-2 --off
  fi
done

Hook this up to your init system, or run from a `nohup` session redirected to `/dev/null` on login or (probably easiest) run it at session startup ... for example, on my system I am member of group `video`, so installing it to `/usr/local/bin` and setting ownership to `root:video` and `sudo chmod ug+rx` allows it to be run on session login automatically.

---
Pairing your keyboard via Bluetooth For the First Time

It isn't obvious (to me at least) how one first pairs the UX8406 keyboard to Linux. Here is the procedure:
Dependency: `blueman` package and associated utils

  1. Ensure `bluetoothctl` is running and initiate 'pair' in Bluetooth by clicking 'Create pairing with this device' (key icon in the 'Blueman-Manager' window)
  2. Turn on bluetooth (switch on the left of the keyboard)
  3. Remove the keyboard
  4. Hold F10 for 4-5 seconds until its blue LED starts blinking rapidly (kbd in pairing mode)
  5. Watch your desktop notifications for the connection message with the BT challenge pin code (6 digits)
  6. type the challenge PIN code on the keyboard
  7. Now the keyboard should be paired.

 

---

Now: Has anyone figured out how to get Audio and the keyboard's multimedia keys (Fn+Func keys eg. Vol +/-, Screen brightness, keyboard LED control) working?? Please post! Thanks.

1 REPLY 1

Russtopia
Star I

Update: Someone has been working on patches to the `asus-hid` keyboard drivers for Linux here: https://github.com/flukejones/asusctl/issues/25

... Would ASUS support consider reaching out to the author there and helping get official support for the UX8406 keyboard in USB and BT mode please? It would be amazing to have upstream official kernel support.

Thank you!