tbocek / dvorak

Wayland keyboard remapping with dvorak - make ctrl-c ctrl-c again :)
Apache License 2.0
72 stars 18 forks source link

Conflict to Logitech G304 mouse #31

Open lotc opened 3 hours ago

lotc commented 3 hours ago

Hi there,

I am using Logitech G304 wireless mouse as my mouse and a common wired keyboard

/dev/input/by-id$ ls
usb-0c45_USB_Keyboard-event-if01
usb-0c45_USB_Keyboard-event-kbd
usb-0c45_USB_Keyboard-if01-event-kbd
usb-Logitech_USB_Receiver-if02-event-mouse
usb-Logitech_USB_Receiver-if02-mouse

When I boot to the system, as the dvorak runs, my mouse can't move the cursor anymore. All the buttons failed to function as normal, except the right click. The right click can only fire once, and then it doesn't trigger anymore.

After systemctl stop 'dvorak@*.service', my mouse worked as normal again. It seems that the program considers device with Logitech is a keyboard.

I can't find the setting to ignore my mouse on either 80-dvorak.rules or dvorak@.service. Is there any method I can still use my Logitech mouse? Or do I need to provide more logs for you to locate this issue?

Thanks.

tbocek commented 2 hours ago

Interesting, I added a "auto-detect" feature, and I enable the service based on which keys are present:

//check if X, C, or V are present, if no, then its not a keyboard, exit
    if (!(array_bit[KEY_X / 32] & (1 << (KEY_X % 32))) ||
        !(array_bit[KEY_C / 32] & (1 << (KEY_C % 32))) ||
        !(array_bit[KEY_V / 32] & (1 << (KEY_V % 32)))) {
            fprintf(stdout, "Not a keyboard: [%s].\n", device);
            return EXIT_SUCCESS;
    }

Can you check your journal if you see if your mouse is detected as keyboard?

As a workaround, you can use the -m option in the dvorak@.service file:

ExecStart=/usr/local/bin/dvorak -d /dev/input/%i -m keyboard

And this will match your entries (lowercase), where the name contains the character keyboard.

To test the parameters you can call dvorak direcly (without using the serivce).

/usr/local/bin/dvorak -d /dev/input/by-id/usb-0c45_USB_Keyboard-event-kbd -m keyboard
lotc commented 23 minutes ago

Thanks for the quick response.

I wonder

  1. In what path can I find the journal? I'm not quite familiar with debug service.
  2. As it showed, my keyboard is detected as usb-0c45_USB_Keyboard-event-if01, should I use -m keyboard as the example, or -m Keyboard with capital K?