Closed Joan-Tondo closed 3 years ago
Hi,
Please consider to use Stackoverflow for any technical question, We here mainly to try to resolve any issue with the current driver for the supported models. If you want to contribute to evolve this for a new model, please consider a pull request.
Thanks for your comprehension.
Hello everybody!!! I tried to adapt the script for touchpad with % and = for the ZenBook Pro Duo UX581 with Manjaro kernel 12 I recalculate cols and rows sizes and I putted the events following the image. After that I got a problem with the % I could reproduce the % sending an InputEvent(EV_KEY.KEY_LEFTSHIFT, 1) plus an InputEvent(EV_KEY.KEY_5, 1) but after write in the screen the first %, the system makes a very little pause and begins to write a lot of % till I click another character in the touchpad. After that, the % doesn't write anything more and the keyboard respond badly. The rest of the touchpad characters follows fine.
The code modified:
` import re import subprocess import sys from fcntl import F_SETFL, fcntl from os import O_NONBLOCK from subprocess import PIPE, Popen from time import sleep
from libevdev import EV_ABS, EV_KEY, EV_LED, EV_SYN, Device, InputEvent
tries=5
Look into the devices file
while tries > 0:
Start monitoring the touchpad
fd_t = open('/dev/input/event' + str(touchpad), 'rb') fcntl(fd_t, F_SETFL, O_NONBLOCK) d_t = Device(fd_t)
Retrieve touchpad dimensions
ai = d_t.absinfo[EV_ABS.ABS_X] (minx, maxx) = (ai.minimum, ai.maximum) ai = d_t.absinfo[EV_ABS.ABS_Y] (miny, maxy) = (ai.minimum, ai.maximum)
Start monitoring the keyboard (numlock)
fd_k = open('/dev/input/event' + str(keyboard), 'rb') fcntl(fd_k, F_SETFL, O_NONBLOCK) d_k = Device(fd_k)
Create a new keyboard device to send numpad events
dev = Device() dev.name = "Asus Touchpad/Numpad" dev.enable(EV_KEY.KEY_KP1) dev.enable(EV_KEY.KEY_KP2) dev.enable(EV_KEY.KEY_KP3) dev.enable(EV_KEY.KEY_KP4) dev.enable(EV_KEY.KEY_KP5) dev.enable(EV_KEY.KEY_5) dev.enable(EV_KEY.KEY_KP6) dev.enable(EV_KEY.KEY_KP7) dev.enable(EV_KEY.KEY_KP8) dev.enable(EV_KEY.KEY_KP9) dev.enable(EV_KEY.KEY_KP0) dev.enable(EV_KEY.KEY_BACKSPACE) dev.enable(EV_KEY.KEY_KPSLASH) dev.enable(EV_KEY.KEY_KPASTERISK) dev.enable(EV_KEY.KEY_KPMINUS) dev.enable(EV_KEY.KEY_KPPLUS) dev.enable(EV_KEY.KEY_KPCOMMA) dev.enable(EV_KEY.KEY_KPENTER) dev.enable(EV_KEY.KEY_LEFTSHIFT) dev.enable(EV_KEY.KEY_NUMLOCK) dev.enable(EV_KEY.KEY_APOSTROPHE) dev.enable(EV_KEY.KEY_KPDOT) dev.enable(EV_KEY.KEY_KPEQUAL)
udev = dev.create_uinput_device() finger = 0 value = 0
onCmd = "i2ctransfer -f -y " + device_id + " w13@0x15 0x05 0x00 0x3d 0x03 0x06 0x00 0x07 0x00 0x0d 0x14 0x03 0x01 0xad" offCmd = "i2ctransfer -f -y " + device_id + " w13@0x15 0x05 0x00 0x3d 0x03 0x06 0x00 0x07 0x00 0x0d 0x14 0x03 0x00 0xad"
def activate_numlock(): events = [ InputEvent(EV_KEY.KEY_NUMLOCK, 1), InputEvent(EV_SYN.SYN_REPORT, 0) ] udev.send_events(events) d_t.grab() subprocess.call(onCmd, shell=True)
def deactivate_numlock(): events = [ InputEvent(EV_KEY.KEY_NUMLOCK, 0), InputEvent(EV_SYN.SYN_REPORT, 0) ] udev.send_events(events) d_t.ungrab() subprocess.call(offCmd, shell=True)
numlock=False
Process events while running
while True:
Close file descriptors
fd_k.close() fd_t.close() `
Moreover, I had to modify the service because the gnome doesn't start till I click Alt+F2, command line, startx:
` [Unit] Description=Asus Touchpad to Numpad Handler After=graphical.target
[Service] ExecStart=/usr/bin/python3 /usr/bin/asus_touchpad_numpad.py
[Install] WantedBy=graphical.target `
Thanks