mohamed-badaoui / asus-touchpad-numpad-driver

Activate Numpad inside the touchpad with top right corner switch
301 stars 70 forks source link

Can you add Support for ASUS ROG 2021 G15 G513 #31

Closed deadmantfa closed 3 years ago

deadmantfa commented 3 years ago

Hey @mohamed-badaoui ,

Could you add support for ASUS ROG 2021 G15 G513?

I will try and help as much as possible

deadmantfa commented 3 years ago

Output for sudo i2cdetect -l

i2c-3 smbus SMBus PIIX4 adapter port 2 at ff00 SMBus adapter i2c-1 i2c Synopsys DesignWare I2C adapter I2C adapter i2c-8 i2c NVIDIA i2c adapter 1 at 1:00.0 I2C adapter i2c-6 i2c AMDGPU DM i2c hw bus 1 I2C adapter i2c-4 smbus SMBus PIIX4 adapter port 1 at ff20 SMBus adapter i2c-2 smbus SMBus PIIX4 adapter port 0 at ff00 SMBus adapter i2c-0 i2c Synopsys DesignWare I2C adapter I2C adapter i2c-9 i2c NVIDIA i2c adapter 5 at 1:00.0 I2C adapter i2c-7 i2c AMDGPU DM aux hw bus 0 I2C adapter i2c-5 i2c AMDGPU DM i2c hw bus 0 I2C adapter

deadmantfa commented 3 years ago

output for sudo cat /proc/bus/input/devices

I: Bus=0019 Vendor=0000 Product=0005 Version=0000
N: Name="Lid Switch"
P: Phys=PNP0C0D/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:24/PNP0C0D:00/input/input0
U: Uniq=
H: Handlers=event0 
B: PROP=0
B: EV=21
B: SW=1

I: Bus=0019 Vendor=0000 Product=0001 Version=0000
N: Name="Power Button"
P: Phys=PNP0C0C/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input1
U: Uniq=
H: Handlers=kbd event1 
B: PROP=0
B: EV=3
B: KEY=10000000000000 0

I: Bus=0019 Vendor=0000 Product=0003 Version=0000
N: Name="Sleep Button"
P: Phys=PNP0C0E/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0E:00/input/input2
U: Uniq=
H: Handlers=kbd event2 
B: PROP=0
B: EV=3
B: KEY=4000 0 0

I: Bus=0019 Vendor=0000 Product=0006 Version=0000
N: Name="Video Bus"
P: Phys=LNXVIDEO/video/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:06/LNXVIDEO:00/input/input4
U: Uniq=
H: Handlers=kbd event3 
B: PROP=0
B: EV=3
B: KEY=3e000b00000000 0 0 0

I: Bus=0003 Vendor=0b05 Product=18c6 Version=0110
N: Name="ASUSTek Computer Inc. N-KEY Device"
P: Phys=usb-0000:05:00.3-4/input0
S: Sysfs=/devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-4/1-4:1.0/0003:0B05:18C6.0003/input/input13
U: Uniq=
H: Handlers=event12 
B: PROP=0
B: EV=9
B: ABS=10000000000

I: Bus=0003 Vendor=0b05 Product=18c6 Version=0110
N: Name="ASUSTek Computer Inc. N-KEY Device Keyboard"
P: Phys=usb-0000:05:00.3-4/input0
S: Sysfs=/devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-4/1-4:1.0/0003:0B05:18C6.0003/input/input14
U: Uniq=
H: Handlers=sysrq kbd event13 leds 
B: PROP=0
B: EV=120013
B: KEY=1000000000007 ff9f207ac14057ff febeffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=1f

I: Bus=0003 Vendor=0b05 Product=18c6 Version=0110
N: Name="ASUSTek Computer Inc. N-KEY Device Consumer Control"
P: Phys=usb-0000:05:00.3-4/input0
S: Sysfs=/devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-4/1-4:1.0/0003:0B05:18C6.0003/input/input15
U: Uniq=
H: Handlers=kbd event14 
B: PROP=0
B: EV=1f
B: KEY=300ff 0 0 483ffff17aff32d bfd4444600000000 1 130c730b17c000 267bfad9415fed 9e168000004400 10000002
B: REL=1040
B: ABS=100000000
B: MSC=10

I: Bus=0003 Vendor=0b05 Product=18c6 Version=0110
N: Name="ASUSTek Computer Inc. N-KEY Device System Control"
P: Phys=usb-0000:05:00.3-4/input0
S: Sysfs=/devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-4/1-4:1.0/0003:0B05:18C6.0003/input/input16
U: Uniq=
H: Handlers=kbd event15 
B: PROP=0
B: EV=13
B: KEY=c000 10000000000000 0
B: MSC=10

I: Bus=0019 Vendor=1043 Product=0000 Version=0000
N: Name="Asus Wireless Radio Control"
P: Phys=asus-wireless/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/ATK4002:00/input/input17
U: Uniq=
H: Handlers=rfkill kbd event16 
B: PROP=0
B: EV=3
B: KEY=80000000000000 0 0 0

I: Bus=0019 Vendor=0000 Product=0000 Version=0000
N: Name="Asus WMI hotkeys"
P: Phys=asus-nb-wmi/input0
S: Sysfs=/devices/platform/asus-nb-wmi/input/input18
U: Uniq=
H: Handlers=rfkill kbd event4 
B: PROP=0
B: EV=100013
B: KEY=1000000080000 0 0 0 0 181606f00900000 8280027801701000 e000000000000 0
B: MSC=10

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HD-Audio Generic HDMI/DP,pcm=3"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:08.1/0000:05:00.1/sound/card1/input19
U: Uniq=
H: Handlers=event5 
B: PROP=0
B: EV=21
B: SW=140

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA NVidia HDMI/DP,pcm=3"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:01.1/0000:01:00.1/sound/card0/input20
U: Uniq=
H: Handlers=event17 
B: PROP=0
B: EV=21
B: SW=140

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA NVidia HDMI/DP,pcm=7"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:01.1/0000:01:00.1/sound/card0/input21
U: Uniq=
H: Handlers=event6 
B: PROP=0
B: EV=21
B: SW=140

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA NVidia HDMI/DP,pcm=8"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:01.1/0000:01:00.1/sound/card0/input22
U: Uniq=
H: Handlers=event18 
B: PROP=0
B: EV=21
B: SW=140

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HD-Audio Generic Headphone"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:08.1/0000:05:00.6/sound/card2/input24
U: Uniq=
H: Handlers=event19 
B: PROP=0
B: EV=21
B: SW=4

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA NVidia HDMI/DP,pcm=9"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:01.1/0000:01:00.1/sound/card0/input23
U: Uniq=
H: Handlers=event7 
B: PROP=0
B: EV=21
B: SW=140

I: Bus=0018 Vendor=04f3 Product=319a Version=0100
N: Name="ASUE1403:00 04F3:319A Mouse"
P: Phys=i2c-ASUE1403:00
S: Sysfs=/devices/platform/AMDI0010:00/i2c-0/i2c-ASUE1403:00/0018:04F3:319A.0001/input/input25
U: Uniq=
H: Handlers=mouse0 event20 
B: PROP=0
B: EV=17
B: KEY=30000 0 0 0 0
B: REL=1943
B: MSC=10

I: Bus=0018 Vendor=04f3 Product=319a Version=0100
N: Name="ASUE1403:00 04F3:319A Touchpad"
P: Phys=i2c-ASUE1403:00
S: Sysfs=/devices/platform/AMDI0010:00/i2c-0/i2c-ASUE1403:00/0018:04F3:319A.0001/input/input26
U: Uniq=
H: Handlers=mouse1 event8 
B: PROP=5
B: EV=1b
B: KEY=e520 10000 0 0 0 0
B: ABS=2e0800000000003
B: MSC=20

I: Bus=0018 Vendor=04f3 Product=319a Version=0100
N: Name="ASUE1403:00 04F3:319A Keyboard"
P: Phys=i2c-ASUE1403:00
S: Sysfs=/devices/platform/AMDI0010:00/i2c-0/i2c-ASUE1403:00/0018:04F3:319A.0001/input/input27
U: Uniq=
H: Handlers=sysrq kbd event9 leds 
B: PROP=0
B: EV=120013
B: KEY=1000000000007 ff800000000007ff febeffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=1f

I: Bus=0003 Vendor=0b05 Product=1866 Version=0110
N: Name="Asus Keyboard"
P: Phys=usb-0000:05:00.3-3/input0
S: Sysfs=/devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-3/1-3:1.0/0003:0B05:1866.0002/input/input28
U: Uniq=
H: Handlers=rfkill kbd event10 
B: PROP=0
B: EV=10001f
B: KEY=300ff 0 0 483ffff17aff32d bfd4444600000000 1 1b30c730b17cc00 80267bfad971dfed 9e168000004400 10000002
B: REL=1040
B: ABS=10100000000
B: MSC=10

I: Bus=0005 Vendor=099a Product=0500 Version=011b
N: Name="Mi Soundbar (AVRCP)"
P: Phys=44:af:28:12:f4:2a
S: Sysfs=/devices/virtual/input/input31
U: Uniq=
H: Handlers=kbd event11 
B: PROP=0
B: EV=100007
B: KEY=2fc800 145200000000 0 10300 49e800000c00 e16800000000f f810000010000ffc
B: REL=0
Gregoire-perso commented 3 years ago

Could you do sudo modprobe i2c-dev and then do sudo i2ctransfer -f -y 0 w13@0x15 0x05 0x00 0x3d 0x03 0x06 0x00 0x07 0x00 0x0d 0x14 0x03 0x01 0xad if your touchpad light is turned on, do sudo i2ctransfer -f -y 0 w13@0x15 0x05 0x00 0x3d 0x03 0x06 0x00 0x07 0x00 0x0d 0x14 0x03 0x00 0xad to turn it off.

If it doesn't work, try that : sudo i2ctransfer -f -y 1 w13@0x15 0x05 0x00 0x3d 0x03 0x06 0x00 0x07 0x00 0x0d 0x14 0x03 0x01 0xad if your touchpad light is turned on, do sudo i2ctransfer -f -y 1 w13@0x15 0x05 0x00 0x3d 0x03 0x06 0x00 0x07 0x00 0x0d 0x14 0x03 0x00 0xad to turn it off.

Could you send us potential errors ?

deadmantfa commented 3 years ago

Hi @Gregoire-perso ,

The first set of commands worked. The touchpad did light up. There were no errors

Commands that worked

sudo modprobe i2c-dev
sudo i2ctransfer -f -y 0 w13@0x15 0x05 0x00 0x3d 0x03 0x06 0x00 0x07 0x00 0x0d 0x14 0x03 0x01 0xad
sudo i2ctransfer -f -y 0 w13@0x15 0x05 0x00 0x3d 0x03 0x06 0x00 0x07 0x00 0x0d 0x14 0x03 0x00 0xad
Gregoire-perso commented 3 years ago

Ok great ! So, when you execute the installation script, is there any error ? If not, does your touchpad light up when you click in the right top corner ?

deadmantfa commented 3 years ago

the install script works but the service says failed.

I tried running the script touchpad_numpad_nosymbols.py and that fails saying Can't find keyboard, code 0

deadmantfa commented 3 years ago
sudo systemctl status asus_touchpad_numpad.service                                                                                                                                      ─╯
● asus_touchpad_numpad.service - Asus Touchpad to Numpad Handler
     Loaded: loaded (/lib/systemd/system/asus_touchpad_numpad.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2021-06-08 23:38:34 IST; 22s ago
    Process: 2003631 ExecStart=/usr/bin/python3 /usr/bin/asus_touchpad_numpad.py (code=exited, status=1/FAILURE)
   Main PID: 2003631 (code=exited, status=1/FAILURE)

Jun 08 23:38:33 pop-os systemd[1]: Started Asus Touchpad to Numpad Handler.
Jun 08 23:38:34 pop-os systemd[1]: asus_touchpad_numpad.service: Main process exited, code=exited, status=1/FAILURE
Jun 08 23:38:34 pop-os systemd[1]: asus_touchpad_numpad.service: Failed with result 'exit-code'.
mohamed-badaoui commented 3 years ago

Hi,

As is, it cannot work. This driver requires an update to match your keyboard. You should uninstall it for the moment and wait for a next update.

But I don't know for sure which device is your keyboard in your list. I would go for this one:

I: Bus=0003 Vendor=0b05 Product=1866 Version=0110
N: Name="Asus Keyboard"
P: Phys=usb-0000:05:00.3-3/input0
S: Sysfs=/devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-3/1-3:1.0/0003:0B05:1866.0002/input/input28
U: Uniq=
H: Handlers=rfkill kbd event10 
B: PROP=0
B: EV=10001f
B: KEY=300ff 0 0 483ffff17aff32d bfd4444600000000 1 1b30c730b17cc00 80267bfad971dfed 9e168000004400 10000002
B: REL=1040
B: ABS=10100000000
B: MSC=10

If I'm right, you could replace this line https://github.com/mohamed-badaoui/asus-touchpad-numpad-driver/blob/main/touchpad_numpad_nosymbols.py#L38

by

if keyboard_detected == 0 and ( "Name=\"AT Translated Set 2 keyboard" in line or "Name=\"Asus Keyboard" in line ) :

Try this modification and launch the python script manually.

python3 touchpad_numpad_nosymbols.py

Hope this helps

deadmantfa commented 3 years ago

Hi @mohamed-badaoui ,

That line made the service work well but the number pad still doesn't work

I guess I will need to add a trigger for num lock button as its present on the touchpad. (I am trying to figure it out on my own but any help would be good)

On windows it works by pressing it for 1 sec

maybe add it in the function activate_numlock and deactivate_numlock

One think I forgot to mention while running these command

sudo modprobe i2c-dev
sudo i2ctransfer -f -y 0 w13@0x15 0x05 0x00 0x3d 0x03 0x06 0x00 0x07 0x00 0x0d 0x14 0x03 0x01 0xad
sudo i2ctransfer -f -y 0 w13@0x15 0x05 0x00 0x3d 0x03 0x06 0x00 0x07 0x00 0x0d 0x14 0x03 0x00 0xad

The touchpad lights up but doesn't let me input numbers it just lights up and functions like touchpad

mohamed-badaoui commented 3 years ago

@deadmantfa

The python script itself doesn't light up the numpad. When the python script is running, you need to touch the up right corner (or to press F8 key) to light up the numpad and to use it like on windows machine

Did you mean that the up right switch didn't work ?

deadmantfa commented 3 years ago

@deadmantfa

The python script itself doesn't light up the numpad. When the python script is running, you need to touch the up right corner (or to press F8 key) to light up the numpad and to use it like on windows machine

Did you mean that the up right switch didn't work ?

Agreed. That's what I mean the right corner button when pressed does not enable num-lock

mohamed-badaoui commented 3 years ago

That's weird :/ Do not hesitate to slide your finger around the up right corner, because the sensitive area coordinates are not precisely defined by model.

Neither F8 key press does not work? Also, check that the running python script does not log any error, when you attempt to light up the numpad.

Else there is nothing I can do to help more :/

deadmantfa commented 3 years ago

Hey @mohamed-badaoui and @Gregoire-perso,

I reinstalled the OS and tried it again with the changes mentioned in the issue.

Good news all is working well, the num lock and F8 both work as they need too

0123456789.+-*/

all keys pressed using the touch pad.

I would like to thank you guys for all your help and I really appreciate the quick responses.

Let me know if I should send you a pull request with the small change mentioned here.

Regards, Wenceslaus Dsilva

mohamed-badaoui commented 3 years ago

@deadmantfa

Great news, can you send a pull request. I will merge it to the repo.

Thanks ^^

deadmantfa commented 3 years ago

33