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

Create option to detect trigger by the device name rather than descriptor #783

Open
9 tasks
Generator opened this issue Sep 29, 2021 · 15 comments
Open
9 tasks
Assignees
Labels
enhancement New feature or request

Comments

@Generator
Copy link

Generator commented Sep 29, 2021

Developer TODO (don't remove)

  • First implement Option to detect triggers by scan code instead of key code #761
  • create new branch. put issue number at start of name if not a very quick fix.
  • write tests. put issue number in comment
  • create a trigger key option that will use the name of the device rather than the id to detect the trigger key.
  • update documentation.
    • update known issues to prompt the user to enable the extra compatibility options if on 2.4.0+.
    • in the compatibility options section describe why this issue happens and how to find the option to fix this.
  • squash and merge
  • delete branch

Describe the bug
I have a Android TV with a USB wireless remote (Air Mouse MX3), and set some keys to execute some actions, but after some reboots those key mappers stop working.
The app show another device with same name, the remote is always at same USB port and didn't any system update.
Tried the same settings with Button Mapper, didn't have this issue.

Workaround is to set Tigger to "Any Device"

To Reproduce
Steps to reproduce the behavior:

  • Use a USB remote or keyboard
  • set some actions
  • Try it after some reboots

Expected behavior
Always use the same device with same name/ID

Screenshots

Screenshot_20210825-175244

Smartphone (please complete the following information):

  • Device: X96 Max+
  • Android version: Android (9) TV (Slimbox ATV)

Additional context
List input devices cat /proc/bus/input/devices inputs.txt
The remote is an Air Mouse (mouse+keyboard) Name="123 COM Smart Control"

@Generator Generator added the bug Something isn't working label Sep 29, 2021
@sds100
Copy link
Collaborator

sds100 commented Sep 30, 2021

Hello,
Interesting issue and will definitely be fixed in 2.3.1. Can you also send a backup of your key maps. follow this guide to do this https://docs.keymapper.club/user-guide/backup-restore

@Generator
Copy link
Author

I've created an example key map with Keycode_Search with automatic key captured with the remote.
mappings_20210930-114931.zip

@sds100
Copy link
Collaborator

sds100 commented Sep 30, 2021

So does the key map work straight after you create the trigger? I'm not sure how this issue can happen because if a trigger can be recorded then it should still be detected.

@Generator
Copy link
Author

Yes, after creating works for some time, but after 2 or 3 reboots a new device with same name shows on created key map, if i change the device works.

Just yesterday after creating two new key maps for Automate, stopped working after some reboots.

@sds100
Copy link
Collaborator

sds100 commented Sep 30, 2021

Oh okay, so the "descriptor" (id) of the devices actually changes after some reboots? 🤔 They should be universally unique.

@sds100
Copy link
Collaborator

sds100 commented Sep 30, 2021

Can you

  1. back up your key maps
  2. install the 2.3.0 release from github (you'll have to uninstall the google play version)
  3. restore your key maps
  4. turn on "extra logging" in the key mapper settings.
  5. trigger your key maps
  6. send me the log. there is a button to share the log at the bottom of the key mapper settings

@Generator
Copy link
Author

install the 2.3.0 release from github (you'll have to uninstall the google play version)

I already had 2.3.0 from F-Droid, but installed the Github version anyway.

Enabled "extra logging" and pressed some mapped keys
key_mapper_log_20210930-195142.txt

I'll leave "KEYCODE_SEARCH" mapped, and keep trying till stop working then send another log, also create logs from /proc/bus/input/devices with working and not working, to see if there's any difference.
Since both keyboard and mouse share the same name and VID/PID, if the app looks for those and they got swap on boot the app will wait for the wrong device for key event.

@sds100
Copy link
Collaborator

sds100 commented Oct 1, 2021

Cool, thanks. Your key maps were working in that log since the device descriptor matched the one in the trigger. I'll wait for your 2nd log.

@Generator
Copy link
Author

Generator commented Oct 1, 2021

Here it is, after rebooting "KEYCODE_SEARCH" stopped working, then changed mapped key to the other device with same name, then works.
key_mapper_log_20211001-120717.txt Oops something went wrong with log, will recreate it.

Also the /proc/bus/input/devices didn't change, made one with working (after creating key map)
and after (after not working)
inputs-working.txt
inputs-not-working.txt
inputs.diff.txt

EDIT: Fixed
key_mapper_log_20211001-122910.txt

@sds100
Copy link
Collaborator

sds100 commented Oct 1, 2021

Okay, interesting. Yeah, the device descriptor does change. Do you have any idea why it changes? Does it ever change back to the one stored in the trigger?

@Generator
Copy link
Author

Think so, before noticing this, all mapped keys some times worked or times don't. But now i set them to "any device"

@sds100
Copy link
Collaborator

sds100 commented Oct 1, 2021

Okay, really strange that it always changes the descriptors. Is using "any device" a solution for you? I would prefer to not have to add a UI setting for one person that has an issue that shouldn't be happening anyway. 😀

@Generator
Copy link
Author

Yes "any device" works all the time. Its device related, but there's more similar devices for Android Boxes. But don't think this is a priority if only affects certain devices.
Maybe a notice on app site "known issues" or in the app itself.

@sds100
Copy link
Collaborator

sds100 commented Oct 1, 2021

Yeah, I will add it to the known issues. I will close this now. :)

@sds100
Copy link
Collaborator

sds100 commented Oct 2, 2021

I will actually implement a proper fix for this. See the developer checklist for what I'm going to do.

@sds100 sds100 added enhancement New feature or request and removed bug Something isn't working labels Oct 2, 2021
@sds100 sds100 changed the title Duplicated USB devices Create option to detect trigger by the device name rather than descriptor Oct 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants