GitHub – asus-linux-drivers/asus-numberpad-driver: Up-to-date feature-rich linux driver for NumberPad(2.0) on Asus laptops. NumberPad(2.0) is illuminated numeric keypad integrated to touchpad which ap

Asus touchpad NumberPad driver

License: GPL v2
Maintainer


Contributor
All Contributors
GitHub Release
GitHub commits
Arch package
GitHub issues-closed
GitHub pull-requests closed
Ask Me Anything !
PRs Welcome
Hits

The driver is written in python and runs as a systemctl service. Driver contains basic key layouts, you can pick up right one during install process. Default settings try to be most comfortable for the majority. All possible customizations can be found here.

If you find this project useful, do not forget to give it a GitHub stars People already did!

Features

  • Multiple pre-created NumberPad layouts with possibility create custom one or improve existing (keys, sizes, paddings..)
  • Customization through 2-way sync configuration file (when is run sudo bash ./install.sh changes done in config file may not be overwritten, the same when is run sudo bash ./uninstall.sh and when config file or part of does not exist is automatically created/completed with default values)
  • Automatic NumberPad model detection via list of used NumberPad layouts for laptops and when is available a connection via finding all other laptops on linux-hardware.org which use the same version of NumberPad to which might be already in mentioned list associated proper layout
  • Activation/deactivation of NumberPad via holding top right icon or every spot with key KEY_NUMLOCK (activation time by default 1s)
  • Fast activation/deactivation of NumberPad via slide gesture beginning on top right icon (by default is required end slide after at least 30% of touchpad width and height)
  • When is NumberPad activated can be used customizable slide gesture beginning on top left (by default is send key EV_KEY.KEY_CALC translated to XF86Calculator so it is prepared for bounding script with toggle functionality of preferred calculator app in your system keyboard shortcuts, example of mine toggling script, so first slide gesture activates calculator app and next closes calculator app, by default is also required end each slide after at least 30% of width and height)
  • Support for various keyboard layouts (unicode characters (e.g. "%" in layouts up5401ea, ux581l or "#" in layout gx701) are sent via <left_shift>+<left_ctrl>+<U>+<0-F>+<space>)
  • Smooth change of backlight levels (endless loop with customizable interval, default 1s)
  • Customizable default level of backlight (by default is default level last used level – works even between reboots)
  • NumberPad is automatically disabled due inactivity (default 1 min)
  • NumberPad cooperation with system NumLock is configurable (activation/deactivation of NumberPad may also enable/disable system NumLock vice versa as well)
  • Activated NumberPad allowes pointer moves and is configurable distance when do not use key during press and move only with pointer
  • Activated NumberPad disables pointer taps (this functionality supports atm only xinput from xorg and gnome via gsettings, can be configured)
  • Repeating the key, when is held (disabled by default)
  • Multitouch up to 5 fingers (disabled by default)
  • Is implemented protection against multitouching accidentally when is multitouch not enabled (printing NumberPad key and slide gestures from corners are cancelled when is second finger used)
  • Disabling Touchpad (e.g. Fn+special key) disables by default NumberPad as well (this functionality supports atm only xinput from xorg and gnome via gsettings, can be disabled)
  • Is recognized when is connected external keyboard and automatically is changed configuration

Layouts

Model/Layout
Description
Image

ux433fa
Without % = symbols

Without left icon
without % = symbols

e210ma
With % = symbols

Without left icon
with % = symbols but left icon is missing

b7402
With % = symbols

Without left icon

Rectangle style of backlight
with % = symbols, left icon is missing and rectangles style of backlight

up5401ea
With % = symbols
with % = symbols with % = symbols

ux581l
With % = symbols

Vertical model
model ux581

g533
With NumLock key
with numlock

g513
With NumLock key

With left, right key outside of NumberPad
with numlock and buttons outside

gx701
With # symbol

With NumLock key outside of touchpad

With left, right key outside of NumberPad
model gx701

gx551
Without % = symbols

With NumLock key on the top left

With left, right key outside of NumberPad
model gx551

Touchpad models

Do you own Touchpad for which is row in table below empty/wrong? Please, create an issue or make PR

Table data

Table is based on all unique Asus touchpad models from repository Dmesg (repository contains uploaded probes = scanned laptops via https://linux-hardware.org/). Table may contains touchpads without NumberPad. Used command:

$ git clone https://github.com/linuxhw/Dmesg$ cd Dmesg$ grep -hRP "(^|\s)(ELAN|ASUE).*04F3:.*Touchpad(?=\s|$)" Convertible/ASUSTek\ Computer/ Notebook/ASUSTek\ Computer/ | cut -b 23-43 | sort -u

Table columns

  • touchpad – from file /proc/bus/input/devices (e.g. via command egrep -B1 -A5 "ASUE|ELAN" /proc/bus/input/devices | grep -B1 -A5 Touchpad even for column described below)
  • detected but not used touchpad – means touchpad to which does not work i2c commands, e.g.: ZenBook Pro Duo UX582LR_UX582LR @mbrouillet, correct is ELAN1406:00 04F3:3101:
I: Bus=0018 Vendor=04f3 Product=2c23 Version=0100N: Name="ELAN9009:00 04F3:2C23 Touchpad"P: Phys=i2c-ELAN9009:00S: Sysfs=/devices/pci0000:00/0000:00:15.3/i2c_designware.3/i2c-4/i2c-ELAN9009:00/0018:04F3:2C23.0003/input/input48U: Uniq=H: Handlers=mouse4 event27 B: PROP=5B: EV=1bB: KEY=e520 10000 0 0 0 0B: ABS=2e0800000000003B: MSC=20I: Bus=0018 Vendor=04f3 Product=3101 Version=0100N: Name="ELAN1406:00 04F3:3101 Touchpad"P: Phys=i2c-ELAN1406:00S: Sysfs=/devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-2/i2c-ELAN1406:00/0018:04F3:3101.0004/input/input51U: Uniq=H: Handlers=mouse6 event17 B: PROP=5B: EV=1bB: KEY=e420 10000 0 0 0 0B: ABS=2e0800000000003B: MSC=20
  • has NumberPad – select fit layout name from table above or use No – table may contains touchpads without NumberPad
  • I2C values – for testing which value can control brightness of touchpad backlight can be used script tests/test_brightness.py which write in cycle gradually all possible values to reverse engineered i2c registr which is used for control of NumberPad (also mentioned in FAQ), activation via 0x01 (by default) automatically set last used brightness (do not be confused)
  • laptop model – series of laptop including specific model name from vendor/seller

*when column contains ? is information not known

*when is column empty is used default

Table

Link

Installation

Install latest dev version using git

git clone https://github.com/asus-linux-drivers/asus-numberpad-driver

cd

asus-numberpad-driver

#

install under current user (highly recommended)sudo bash ./install.sh --user

#

install as rootsudo bash ./install.sh

or download latest release (stable version) from release page, extract and run:

#

install as rootsudo bash ./install.sh

#

install under current user (highly recommended)sudo bash ./install.sh --user

or is available package for arch on AUR here (replace model with available models, e.g. asus-numberpad-driver-ux433fa-git)

paru -S asus-numberpad-driver-

${model}

-git

Uninstallation

And to uninstall, just run:

sudo bash ./uninstall.sh

#

stop driver and uninstall for current usersudo bash ./uninstall.sh --user

Dependencies

Everything is included in install script sudo bash ./install.sh

To see the exact commands for your package manager look here (for python dependencies take a look at requirements.txt)

Troubleshooting

  • Start point [x:0,y:0] of touchpad is on the left top!
  • Before debugging make sure you have disabled the [email protected] service

#

when installed for running under root (`sudo bash ./install.sh`)sudo systemctl stop [email protected]

#

when installed for running under current user (`sudo bash ./install.sh --user`)sudo systemctl stop asus_touchpad_numpad@

<

user

>

.service
  • To show debug logs run this command in terminal (Do not forget specify numpad layout and which config do you want to use):

#

LOG=DEBUG sudo -E ./asus_touchpad.py <REQUIRED:numpad layout file name without extension .py> <OPTIONAL:directory where is located config file with name: asus_touchpad_numpad_dev, by default is taken CWD - current working directory, not existing config file is created and filled with default values>

cd

asus-numberpad-driverLOG=DEBUG sudo -E ./asus_touchpad.py

"

up5401ea

"

"

"

#

now driver use root of repository as directory for config file named asus_touchpad_numpad_dev

cd

asus-numberpad-driverLOG=DEBUG sudo -E ./asus_touchpad.py

"

up5401ea

"

"

/usr/share/asus_touchpad_numpad-driver/

"

#

now driver use installed config
  • To show pressed keys:
sudo apt install libinput-toolssudo libinput debug-events
  • To simulate key press:
sudo apt install xdotoolxdotool key XF86Calculator

FAQ

The driver works, I can press keys but backlight is not enabled: reason may be registr used for enabling NumberPad backlight via I2C is blocked and you have to via command line try find value which can registr unblock (example of automation of testing all possible values 0-255 of registr is located in file /tests/test_brightness.py) (in this issue were found values 0x60 as equivalent for activating, 0x61 as equivalent for deactivating). Used command:

$ i2ctransfer -f -y <touchpad_i2c_number> w13@0x15 0x05 0x00 0x3d 0x03 0x06 0x00 0x07 0x00 0x0d 0x14 0x03 <testing value in hex format 0x01 from 0 to 255> 0xad

<touchpad_i2c_number> can be found with cat /proc/bus/input/devices in line started with letter S: . So in this case is <touchpad_i2c_number> number 2 because of S: Sysfs=/devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-2/..).

$ cat /proc/bus/input/devices...I: Bus=0018 Vendor=04f3 Product=31b9 Version=0100N: Name="ASUE140D:00 04F3:31B9 Touchpad"P: Phys=i2c-ASUE140D:00S: Sysfs=/devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-2/i2c-ASUE140D:00/0018:04F3:31B9.0002/input/input29U: Uniq=H: Handlers=mouse3 event12 B: PROP=5B: EV=1bB: KEY=e520 10000 0 0 0 0B: ABS=2e0800000000003B: MSC=20...

How can be activated NumberPad via CLI?

  • is required have enabled in config sys_numlock_enables_numpad = 1 (enabled by default), then will be NumberPad activated/disabled according to status of system numlock, source for pressing system numlock can be numlock physical key on the same laptop or external keyboard or simulated key via xdotool key Num_Lock or numlockx on and numlockx off

  • directly just change enabled in appropriate config file:

# when is installed under current user (--user) sudo is not required# enabling NumberPad via command linesudo sed -i "s/enabled = 0/enabled = 1/g" asus_touchpad_numpad_devsudo sed -i "s/enabled = 0/enabled = 1/g" /usr/share/asus_touchpad_numpad-driver/asus_touchpad_numpad_dev# disablingsudo sed -i "s/enabled = 1/enabled = 0/g" asus_touchpad_numpad_devsudo sed -i "s/enabled = 1/enabled = 0/g" /usr/share/asus_touchpad_numpad-driver/asus_touchpad_numpad_dev

Is any key from NumberPad not send properly?

$ sudo evtestNo device specified, trying to scan all of /dev/input/event*Available devices:.../dev/input/event12:	ASUE140D:00 04F3:31B9 Touchpad/dev/input/event13:	ASUE140D:00 04F3:31B9 Keyboard.../dev/input/event22:	Asus Touchpad/NumpadSelect the device event number [0-22]: 22Input driver version is 1.0.1Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0Input device name: "Asus Touchpad/Numpad"Supported events:  Event type 0 (EV_SYN)  Event type 1 (EV_KEY)    Event code 14 (KEY_BACKSPACE)    Event code 18 (KEY_E)    Event code 22 (KEY_U)    Event code 29 (KEY_LEFTCTRL)    Event code 30 (KEY_A)    Event code 31 (KEY_S)    Event code 32 (KEY_D)    Event code 33 (KEY_F)    Event code 42 (KEY_LEFTSHIFT)    Event code 46 (KEY_C)    Event code 48 (KEY_B)    Event code 55 (KEY_KPASTERISK)    Event code 57 (KEY_SPACE)    Event code 69 (KEY_NUMLOCK)    Event code 71 (KEY_KP7)    Event code 72 (KEY_KP8)    Event code 73 (KEY_KP9)    Event code 74 (KEY_KPMINUS)    Event code 75 (KEY_KP4)    Event code 76 (KEY_KP5)    Event code 77 (KEY_KP6)    Event code 78 (KEY_KPPLUS)    Event code 79 (KEY_KP1)    Event code 80 (KEY_KP2)    Event code 81 (KEY_KP3)    Event code 82 (KEY_KP0)    Event code 83 (KEY_KPDOT)    Event code 96 (KEY_KPENTER)    Event code 98 (KEY_KPSLASH)    Event code 117 (KEY_KPEQUAL)    Event code 140 (KEY_CALC)    Event code 272 (BTN_LEFT)    Event code 273 (BTN_RIGHT)    Event code 274 (BTN_MIDDLE)Properties:Testing ... (interrupt to exit)Event: time 1679133719.799252, type 1 (EV_KEY), code 140 (KEY_CALC), value 1Event: time 1679133719.799252, -------------- SYN_REPORT ------------Event: time 1679133719.799295, type 1 (EV_KEY), code 140 (KEY_CALC), value 0Event: time 1679133719.799295, -------------- SYN_REPORT ------------

Toggling calculator app does not work

  • When is new keybindings added to list custom-keybinings, is necessary every time atleast log out. Otherwise newly added shortcut will not work.

  • When using custom keybinding via custom-keybindings values calculator and calculator-static has to be empty:

$ sudo install dconf-editor$ gsettings set org.gnome.settings-daemon.plugins.media-keys calculator [\'\']$ gsettings set org.gnome.settings-daemon.plugins.media-keys calculator-static [\'\']
  • Whether script works can be tested via bash /usr/share/asus_touchpad_numpad-driver/scripts/calculator_toggle.sh

  • Whether keybinding works can be tested via slide gesture from NumberPad or via simulating XF86Calculator key xdotool key XF86Calculator

Configuration

Keyboard layout

During the install process sudo bash ./install.sh, you’re required to select your keyboard layout:

Select models keypad layout:1) b7402.py2) e210ma.py3) g533.py4) gx551.py5) gx701.py6) up5401ea.py7) ux433fa.py8) ux581l.py9) QuitPlease enter your choice

Each key layout (g533.py, gx701.py, ..) chosen during the install process corresponds to the specific file. To change any layout depending settings you need to locally edit the selected layout file and change the value of the corresponding variable from the first table below.

Example: If you want to set the size of top right icon to bigger and you have chosen the layout up5401ea.py during the install process. You need to change the corresponding variables (top_right_icon_width = 400,top_right_icon_height = 400) in the layout file (asus-numberpad-driver/numpad_layouts/up5401ea.py) and install the layout again.

Option
Required
Default
Description

Key layout
keys
Required

map of keys as array of arrays, dimension has to be atleast array of len 1 inside array

everything else what is not an event except None is sent as unicode character <left_shift>+<left_ctrl>+<U>+<0-F> (use apostrophes!, e.g. "%" in layouts up5401ea, ux581l or "#" in layout gx701). Is allowed use string of unicode characters e.g. "±%")

keys_ignore_offset
[]
map of keys which should be touchable even on offset area

e.g. used in layout gx551 with value [0,0] where is NumLock key on the top left and right icon as primary activation area for NumLock is not used

Top left icon

any function is disabled when is missing option top_left_icon_height or top_left_icon_width and icon has to be touchable (0 dimensions)

top_left_icon_width

width of the top left icon

top_left_icon_height

height of the top left icon

top_left_icon_slide_func_keys
[EV_KEY.KEY_CALC]
array of InputEvent
Top right icon

send numlock key and activate/deactivate numpad

activating/deactivating touch has to start over icon area declared by top_right_icon_width and top_right_icon_height
top_right_icon_width

width of the top right icon

top_right_icon_height

height of the top right icon

Paddings

NumberPad has padding zones around where nothing happens when is touched except top icons

top_offset
0 (px)
top NumberPad offset

right_offset
0 (px)
right NumberPad offset

left_offset
0 (px)
left NumberPad offset

bottom_offset
0 (px)
bottom NumberPad offset

Backlight
backlight_levels

array of backlight levels in hexa format 0x00 for brightness change by top_left_icon (values for turn on (0x01) and turn off (0x00) are hardcoded)

Configuration file

What is not depending on specific keyboard of Numpad is mentioned in table below and can be changed in config file asus_touchpad_numpad_dev (dev as device interface because is here saved even status enabled of NumberPad, latest used brightness) in installed driver location /usr/share/asus_touchpad_numpad-driver/asus_touchpad_numpad_dev. Example default one:

[main]numpad_disables_sys_numlock = 1disable_due_inactivity_time = 60touchpad_disables_numpad = 1key_repetitions = 0multitouch = 0one_touch_key_rotation = 0activation_time = 1sys_numlock_enables_numpad = 1top_left_icon_activation_time = 1top_left_icon_slide_func_activation_x_ratio = 0.3top_left_icon_slide_func_activation_y_ratio = 0.3top_right_icon_slide_func_activation_x_ratio = 0.3top_right_icon_slide_func_activation_y_ratio = 0.3enabled_touchpad_pointer = 3press_key_when_is_done_untouch = 1enabled = 0default_backlight_level = 0x01top_left_icon_brightness_func_disabled = 0distance_to_move_only_pointer = 250

Option
Required
Default
Description

System
enabled
0
NumberPad running status (enabled/disabled)

disable_due_inactivity_time
60.0 [s]
NumberPad is automatically disabled when have not received any event for this interval

decimal places allowed

touchpad_disables_numpad
1
when is touchpad disabled is disabled NumberPad aswell, valid value is 1 or 0 (e.g. via Fn+special key)

status is being attempted for the first time from gsettings get org.gnome.desktop.peripherals.touchpad send-events, tested can be via direct change gsettings set org.gnome.desktop.peripherals.touchpad send-events 'enabled' or simulation of Touchpad toggling via CLI xdotool key XF86TouchpadToggle or xdotool key XF86TouchpadOn and xdotool key XF86TouchpadOff, secondary is taken result of xinput – in this case can be for get this work used this script which has to be binded to Touchpad special key

sys_numlock_enables_numpad
1
obtained via active LED_NUML of keyboard device

so by default NumberPad reflects both: disabling NumberPad when is system numlock disabled even activating in the same moment as is system numlock activated

System numlock can be simulated xdotool key Num_Lock

sys_numlock_enables_numpad is set up to 1 automatically even when is in config file read value 0 (overwritten) in case when is not defined in key layout on any position key EV_KEY.KEY_NUMLOCK and top right icon is not defined (size values top_right_icon_width and top_right_icon_height)

numpad_disables_sys_numlock
1
when is set to 1 is every time during inactivation of NumberPad sent KEY_NUMLOCK. Is useful do not send NumLock when is to laptop connected external keyboard and goal is only disable NumberPad on laptop but keep NumLock on external keyboard enabled

enabled_touchpad_pointer
3
valid values are 0, 1, 2, 3

when is set to 1 touchpad pointer can be used to moving and for clicking and can be clicked pointer buttons left, right and middle when is NumberPad activated, 0 disable this usage and 2 allowes only pointer button clicks, 3 allowes only touchpad pointer moving without clicks (touchpad tap-to-click is disabled/enabled using gnome via gsettings and for xinput for X11 with this order priority)

Key layout
activation_time
1.0 [seconds]
amount of time you have to touch top_right_icon or another spot with key EV_KEY.KEY_NUMLOCK for the NumberPad activation/deactivation

decimal places allowed

multitouch
0
up to quint tap when enabled

Example 1: can be enabled NumberPad when second finger is touched on touchpad somewhere as well;

Example 2: brightness can be changed during using NumberPad for calculating)

one_touch_key_rotation
0
possibility of altering multiple keys during one-touch

key_repetitions
0
possible to enable with value 1 hold key for repeated pressing key like on a physical keyboard

distance_to_move_only_pointer
0 [px]
when is set up press_key_when_is_done_untouch = 1 (by default) and disabled one_touch_key_rotation = 0 (by default) and is crossed with finger line of bordering key is implemented reset of current key so will not be printed, this option allows specify the same behaviour but inside key area with distance in px crossed to another key and is set up to enable with value 1 hold key for repeated pressing key like on a physical keyboard

Top left icon

custom function is used when is NumberPad activated and is first touched top_left_icon and finger is slid to center and untouched atleast after ratio of touchpad width > top_left_icon_slide_func_activation_x_ratio and height > top_left_icon_slide_func_activation_y_ratio and array top_left_icon_custom_keys is not empty

brightness function is used only when is NumberPad activated, top_left_icon_brightness_function_disabled is not 1, array backlight_levels is not empty and works like endless loop of incrementing brightness in interval top_left_icon_activation_time
top_left_icon_activation_time
1.0 [s]
amount of time for touch top_left_icon

decimal places allowed

top_left_icon_slide_func_activation_x_ratio
0.3 (30%)
ratio of touchpad width of slide

top_left_icon_slide_func_activation_y_ratio
0.3 (30%)
ratio of touchpad height of slide

top_left_icon_brightness_func_disabled
0
valid value is 0 or 1, allow force disable brightness change function

brightness function is auto disabled when is empty array backlight_levels and when is not set top_left_icon_width or top_left_icon_width backlight_levels
Top right icon

send numlock key and activate/deactivate numpad

activating/deactivating touch has to start over icon area declared by top_right_icon_width and top_right_icon_height for amout of time in activation_time or NumberPad is activated/deactivated with slide function from this icon to center and untouched atleast after ratio of touchpad width > top_right_icon_slide_func_activation_x_ratio and height > top_right_icon_slide_func_activation_y_ratio
top_right_icon_slide_func_activation_x_ratio
0.3 (30%)
ratio of touchpad width of slide

top_right_icon_slide_func_activation_y_ratio
0.3 (30%)
ratio of touchpad height of slide

Backlight
default_backlight_level
0x01
default backlight level in hexa format 0x00 (has to be the value from layout backlight_levels or value for disabled brightness 0x00 or value for usage of last used brightness 0x01)

External keyboard configuration

Is installed also udev rule 90-numberpad-external-keyboard which run .sh scripts for NumberPad configuration change when is external keyboard connected or disconnected.

State connected external keyboard / adding external keyboard means these changes:

sys_numlock_enables_numpad=0numpad_disables_sys_numlock=0

State without external keyboard / removing external keyboard means these changes:

sys_numlock_enables_numpad=1numpad_disables_sys_numlock=1

Credits

Thank you very much all the contributors of asus-numberpad-driver for your work.

Thank you who-t for great post about multitouch Understanding evdev.

Existing similar projects

  • [python service, first initialization] https://gitlab.com/Thraen/gx735_touchpad_numpad
  • [python service] https://github.com/danahynes/Asus_L410M_Numpad inspired by [python service, first initialization] https://gitlab.com/Thraen/gx735_touchpad_numpad
  • [python service, configurable, the most spread repository] https://github.com/mohamed-badaoui/asus-numberpad-driver inspired by [python service] https://gitlab.com/Thraen/gx735_touchpad_numpad
  • [c++ and meson] https://github.com/xytovl/asus-numpad inspired by/rewritten version of [python service, configurable, the most spread repository] https://github.com/mohamed-badaoui/asus-numberpad-driver
  • [rust] https://github.com/iamkroot/asus-numpad rewritten in rust the same python project which was starting point for this repository https://github.com/mohamed-badaoui/asus-numberpad-driver
  • [python service, configurable, the most up-to-date] This project with continuing work based on [python service, configurable, the most spread repository] https://github.com/mohamed-badaoui/asus-numberpad-driver
  • [c++] https://github.com/haronaut/asus_numberpad

Existing related projects

  • [WIP, package for arch based open rc systems] https://codeberg.org/BenWestcott/asus-numpad-driver-openrc prepare for this driver PKGBUILD and other infrastructure needed for Arch-based OpenRC systems

Existing related articles

  • [Numpad linux driver — implementation of multitouch] https://medium.com/@ldrahnik/numpad-linux-driver-implementation-of-multitouch-bd8ae76a8d6c

Why have been these projects created? Because linux does not support NumberPad integration to touchpad (reported issue for Ubuntu here)

Why was this project created? Because compared to mentioned projects I implemented more features and fixed more found bugs and I have time keep driver up-to-date.

Stargazers project history?

Stargazers over time

Buy me a coffee

Do you think my effort put into open source is useful for you / others? Put star on the GitHub repository. Every star makes me proud. The same as any contribution. Would you like to reward me more? Now exists the way. You can invite me for a coffee! I really appreciate that!

BuyMeACoffee

Buy me a coffee supporter

Alternate Text Gọi ngay