Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traceback y not defined #63

Closed
martininsulander opened this issue Sep 9, 2021 · 5 comments
Closed

Traceback y not defined #63

martininsulander opened this issue Sep 9, 2021 · 5 comments

Comments

@martininsulander
Copy link

Hi,
I don't have the traceback available. But in the code I found something that looked wrong.

In /usr/bin/asus_touchpad_numpad.py there looks to me (and my traceback at computer startup), that x and y could be undefined:

      # During tap #
      if finger == 1:
          finger = 2
          try:
              # first row
              if y < 0.25 * maxy:

if not these have been matched:

        # Get x position #
        if e.matches(EV_ABS.ABS_MT_POSITION_X):
            x = e.value
            continue
        # Get y position #
        if e.matches(EV_ABS.ABS_MT_POSITION_Y):
            y = e.value
            continue

Default values for x and y maybe could help, or an indicator if this has happened.

Also while at it, the try-catch-case this is in looks like it is only used for the last rows, so try could be moved there instead.

@mohamed-badaoui
Copy link
Owner

Hi,

Events ABS_MT_POSITION_X and ABS_MT_POSITION_Y always precede BTN_TOOL_FINGER events So x and y are always defined before checking their value to determinate current touch coordinate.

@martininsulander
Copy link
Author

martininsulander commented Sep 15, 2021

The issue is that it has happened me at least once, and then the numpad was lit until I restarted the application.

Anyway, thanks for the driver. It is a fun feature.

@mohamed-badaoui
Copy link
Owner

Hi,

It is a collaborative project. Do not hesitate to submit any PR that would improve the readability and maintainability of this project
We're not all Python developers, so we're doing our best to find a workaround to make the Asus touchpad work.

Thank you for your indulgence

@martininsulander
Copy link
Author

Hi Mohamed, I did a pull-request with some cleanup of the code if you care to check :)

@mohamed-badaoui
Copy link
Owner

Thank you!
I need some time to test it and review it :)
I will soon, I'm a little busy right now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants