Giter Site home page Giter Site logo

asus_l410m_wmi_keys's Introduction

Asus_L410M_WMI_Keys

"It mostly works™"

This small program runs at boot and gives you access to the keys on the keyboard that aren't handled by the current asus-nb-wmi driver.

On my laptop (a 2021 Asus L410M) these are the camera toggle key (same as F10) and the "Launch MyAsus" or "//]" key (same as F12).

Installing

To install, clone the git repo:

foo@bar:~$ cd ~/Downloads
foo@bar:~/Downloads$ git clone https://github.com/danahynes/Asus_L410M_WMI_Keys
foo@bar:~/Downloads$ cd Asus_L410M_WMI_Keys

Next you need to install the python libevdev library:

foo@bar~/Downloads/Asus_L410M_WMI_Keys$ pip3 install libevdev

You MAY need to find the key scancodes and edit asus_l410m_wmi_keys.py before you install.

See note below!

Once you do that, you can install by:

foo@bar:~/Downloads/Asus_L410M_WMI_Keys$ sudo ./install.sh

You can also download the latest release, unzip it, possibly set the scancodes in asus_l410m_wmi_keys.py, and run the install.sh file as sudo from there.

Uninstalling

To uninstall, go to the git directory and run:

foo@bar:~/Downloads/Asus_L410M_WMI_Keys$ sudo ./uninstall.sh

or delete the files manually:

foo@bar:~$ sudo rm -rf /usr/bin/asus_l410m_wmi_keys.py
foo@bar:~$ sudo rm -rf /lib/systemd/system/asus_l410m_wmi_keys.service
foo@bar:~$ sudo rm -rf /var/log//asus_l410m_wmi_keys.log

Finding the KEY_WMI_* values

Here's how to find the KEY_WMI_* values for the keys you want to map:

Press the key you want to map a few times, then do this:

foo@bar:~$ dmesg | grep "asus_wmi"

where the you should find this near the end of the output:

[30999.432449] asus_wmi: Unknown key 85 pressed
[31001.608410] asus_wmi: Unknown key 85 pressed
[31001.608410] asus_wmi: Unknown key 85 pressed

In this case scancode 85 is my camera key. Note that this is a hex value so it must be written as 0x85.

Use these values in asus_l410m_wmi_keys.py to fire events for your unused keys. Also if you have other keys that don't work, and you know python, you can map more keys to more functions if you have other non-working keys.

Notes

I banged my head against a wall for a few hours until I found a solution to this. At first I thought the asus-nb-wmi driver was swallowing events for keys it did not recognize (actually some programs, like xev, could see them being pressed and released but they just had 0x0 scancodes). But then I realized the asus-nb-wmi driver was logging them in dmesg as "unknown" keys, but with unique scancodes. Turns out that the python library libevdev can read the scancodes from the keyboard before the asus-nb-wmi driver throws them away!

Turning the camera on and off is still a work in progress, so for now the "Toggle Camera" (F10) key is mapped to Shift-Meta-R. As for the "MyAsus" key (F12), it presents itself as Shift-Meta-T. The screenshot (F11) key is already mapped to Shift-Meta-S, so these seemed like reasonable values for the keys to the left and right of it.

If the WMI keyboard can't be found, then all hope is lost and the programs quits.

If it doesn't seem to be working right, check the log file:

foo@bar:~$ cat /var/log/asus_l410m_wmi_keys.log

Note that the keys are also function keys, so what happens when you press them depends on the state of the Fn key. This laptop, and others like it, have a "Function Lock" feature (similar to "Caps Lock") that is activated by pressing Fn+Esc. This feature is set to "on" at boot, so you may need to turn it off or press Fn along with the key to get the desired behavior. The "Function Lock" feature can be turned off in the BIOS menu, in which case you need to press the Fn key with the desired key to use the WMI function (volume, screen brightness, etc.), otherwise pressing the key alone sends Fn(N).

TODO

  1. camera file lock checking/syncing
  2. camera enabled indicator (not the same as the in-use light)

-)

asus_l410m_wmi_keys's People

Contributors

cyclopticnerve avatar

Watchers

 avatar

Forkers

keepsoftware

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.