You are not logged in.

#1 2020-05-07 09:25:53

boogy
Member
From: /dev/random
Registered: 2010-05-20
Posts: 37
Website

[solved] Ducky One 2 SF Media Keys stop working at some point

Hello Community,

I'm not sure if I'm posting in the right place but as this is a keyboard "issue" I thought hardware was the appropriate one.

I'm using Archlinux of course smile, with kernel 5.6.10-arch1-1, bspwm 0.9.9-1, sxhkd 0.6.1-1. I've purchased a second ducky keyboard (Ducky One 2 SF) to use at home. I already have a ducky mini 2 at the office and I don't have this problem at all.
So the problem is that after a while, my media keys on the ducky One 2 SF (not ducky macro keys) used with Fn+VolUp, Fn+VolDown stop working.

I've tried adding macro keys for the volume in another profile, and this also seems to stop working after some time. The only way of getting back these media keys is to unplug and then plug the keyboard back again.

My keyboard layout is set at start with:

setxkbmap -model pc105 -layout ch -variant fr -option lv3:ralt_switch

I also tried once the keys stopped working to reset the keyboard with my exported keys from xmodmap using:

# command executed when all keys are working
xmodmap -ple > ~/.xmodmap.orig

# command executed when keys are not working anymore
xmodmap ~/.xmodmap

I was suspecting sxhkd being the problem but I don't see how it could disable the media keys from the keyboard.

Is someone else having these same issues ?

Thank you in advance for your help and suggestions.

Last edited by boogy (2020-05-17 16:31:23)


Where there is a shell, there is a way

Offline

#2 2020-05-12 09:41:57

boogy
Member
From: /dev/random
Registered: 2010-05-20
Posts: 37
Website

Re: [solved] Ducky One 2 SF Media Keys stop working at some point

Up please. This issue is driving me crazy as I have no idea where this is coming from and what is causing this.

Is there a way to reconnect the keyboard without unplugging it so that the media keys are recognized again ?


Where there is a shell, there is a way

Offline

#3 2020-05-12 10:00:05

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 9,804
Website

Re: [solved] Ducky One 2 SF Media Keys stop working at some point


Sakura:-
Mobo: MSI X299 TOMAHAWK ARCTIC // Processor: Intel Core i7-7820X 3.6GHz // GFX: nVidia GeForce GTX 970 // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 5x 1TB HDD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Online

#4 2020-05-12 11:55:45

Ropid
Member
Registered: 2015-03-09
Posts: 835

Re: [solved] Ducky One 2 SF Media Keys stop working at some point

Are you sure the keys stop working? Maybe the program that's looking for the keypresses has stopped working instead of the keys.

I'd try checking on the keys with:

xinput test <id>

For the "<id>" part, you need to first check with "xinput list" and look for the id of your keyboard there.

Press the keys and see what happens. The volume up and down keys look like this for me:

$ xinput test 9
...
key press   122 
key release 122 
key press   123 
key release 123 

There's also this command here:

xev -event keyboard

This xev tool has the problem that you can't see the events if another program has captured those keypresses globally.

Last edited by Ropid (2020-05-12 11:57:25)

Offline

#5 2020-05-12 12:14:56

boogy
Member
From: /dev/random
Registered: 2010-05-20
Posts: 37
Website

Re: [solved] Ducky One 2 SF Media Keys stop working at some point

Hello @Ropid,

Thanks a lot for your answer.
I'm using sxhkd for the keys and when the media keys stop working, all other keybindings are still working. This means that sxhkd is still running. When the keys stop working if I unplug the keyboard and plug back in its working again. And this happens without restarting sxhkd.

As for the xinput test when the keys are working I have

➜ xinput test 17
key press   123 
key release 123 
key press   122 
key release 122 
key press   121 
key release 121

key 123 -> VolumeUp
key 122 -> VolumeDown
key 121 -> Mute

When I use xev (and the keys are functional) I have this output

MappingNotify event, serial 28, synthetic NO, window 0x0,
    request MappingKeyboard, first_keycode 8, count 248

And the volume is going up.

On this Ducky One2 SF keyboard, the media keys are handled with the Fn key. Same for F1-12 and all other special keys.

I've tried when the media keys are not working to reset them with

xmodmap ~/.xmodmap.orig

without success.
Also, I don't know what is causing the keyboard media keys to not work as I'm not doing anything specific when this happens. When I want to change the volume its suddenly not working anymore after a period of time.

Last edited by boogy (2020-05-12 12:16:16)


Where there is a shell, there is a way

Offline

#6 2020-05-12 14:28:05

seth
Member
Registered: 2012-09-03
Posts: 15,413

Re: [solved] Ducky One 2 SF Media Keys stop working at some point

The interesting part is xinput test / xev when the keys stopped working.

When you re-plug the keyboard, do you re-run setxkbmap & xmodmap as well?
Did you try to just restart sxhkd?

Please also post your startup scripts and the xmodmap files.

Offline

#7 2020-05-12 14:35:52

boogy
Member
From: /dev/random
Registered: 2010-05-20
Posts: 37
Website

Re: [solved] Ducky One 2 SF Media Keys stop working at some point

Hello Sets,

When I'm plugging the keyboard back in I don't restart any of the services nor run xmodmap or setxkbmap and the keys are working again.

I haven't had the issue yet to record the output of xev and xinput, but I'll do that the next time I have the issue.
And yes, I've tried restarting sxhkd when the keys stop working and it doesn't help. Same for xmodmap and setxkbmap without any success.

I forgot to mention that initially I had the keyboard plugged into a docking station (Dell TB16) and I'm using a Lenovo (my work laptop) but everything else seems to work just fine. I've plugged the keyboard directly into the laptop now and see if it changes something.
Once I also tried running a udevadm trigger command to see if it helps without success.

I'm wondering why when using xev and pressing volume up it's not showing XF86AudioRaise and its showing this

MappingNotify event, serial 28, synthetic NO, window 0x0,
    request MappingKeyboard, first_keycode 8, count 248

Last edited by boogy (2020-05-12 14:37:45)


Where there is a shell, there is a way

Offline

#8 2020-05-12 14:53:10

seth
Member
Registered: 2012-09-03
Posts: 15,413

Re: [solved] Ducky One 2 SF Media Keys stop working at some point

Because the key is grabbed. Xev cannot read it but notices that the focus moves to the "window" that grabs it.

You didn't post your init scripts and the xmodmap config you apply.

Offline

#9 2020-05-13 09:47:06

boogy
Member
From: /dev/random
Registered: 2010-05-20
Posts: 37
Website

Re: [solved] Ducky One 2 SF Media Keys stop working at some point

I use lightdm as a session manager to launch bspwm.

My init (autostart scripts) is as follows:
1) bspwrc (https://github.com/boogy/dotfiles/blob/ … wm/bspwmrc)
2) bspwm-autostart.sh (https://github.com/boogy/dotfiles/blob/ … tostart.sh)

My xmodmap configuration when all the keys are working is as follows: https://pastebin.com/GXYvBP4D


Where there is a shell, there is a way

Offline

#10 2020-05-13 12:37:19

seth
Member
Registered: 2012-09-03
Posts: 15,413

Re: [solved] Ducky One 2 SF Media Keys stop working at some point

Those scripts do not seem to call xmodmap at all?
But what's suspicious is that you call sxhkd *before* setxkbmap, ie. sxhkd operates on the keycodes from the original symbol table (probably us) - a state that you'll recreate by re-plugging the keyboard (before calling setxkbmap again)

I'd replace setxkbmap w/ https://wiki.archlinux.org/index.php/Xo … tion_files and see wheter
a) this breaks your current sxhkd altogether
b) is (on a perhaps fixed sxhkd config) more robust

Sidenote: is this the output of "xmodmap -pke" or do you really have a config that brute-forces over the entire symbol map when you're ever calling xmodmap?

Offline

#11 2020-05-13 13:59:32

boogy
Member
From: /dev/random
Registered: 2010-05-20
Posts: 37
Website

Re: [solved] Ducky One 2 SF Media Keys stop working at some point

Yes, the pastebin is the output from "xmodmap -pke". I don't call xmodmap when starting because I think it's not necessary as everything works as expected without running it at startup.

Now that you mention this, I also have a configuration in Xorg for the key mapping.

➜ cat /etc/X11/xorg.conf.d/00-keyboard.conf 
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "ch"
        Option "XkbModel" "pc105"
        Option "XkbVariant" "fr"
        Option "XkbOptions" "lv3:ralt_switch"
EndSection

But I'm not sure if my configuration in this file is good. Based on the documentation I should run a command like

localectl --no-convert set-x11-keymap ch pc105 ,fr grp:alt_shift_toggle

Which is generating the following configuration:

Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "ch"
        Option "XkbModel" "pc105"
        Option "XkbVariant" ",fr"
        Option "XkbOptions" "grp:alt_shift_toggle"
EndSection

I'm a little bit confused about the layout and variant here. I have a swiss french keyboard, so I've set the layout to "ch" and the variant to "fr". If I use these configs with setxkbmap my keys are good. But is the comma "," before the "fr" mandatory ? I didn't have this in my initial file.

I see, following your explanation, how sxhkd could pose some problems here with the keyboard in us or Swiss French format. So in my autostart script I've put sxhkd after the setxkbmap.


Where there is a shell, there is a way

Offline

#12 2020-05-13 14:27:24

seth
Member
Registered: 2012-09-03
Posts: 15,413

Re: [solved] Ducky One 2 SF Media Keys stop working at some point

The comma in the example is because there're also two layouts. Doesn't fit your case.

Offline

#13 2020-05-13 16:05:02

boogy
Member
From: /dev/random
Registered: 2010-05-20
Posts: 37
Website

Re: [solved] Ducky One 2 SF Media Keys stop working at some point

I think the issue is solved.
I removed from my bspwm autostart script the setxkbmap command, created the X11 configuration file using

localectl --no-convert set-x11-keymap ch pc105 fr lv3:ralt_switch

Also found on the internet and it was also in the sxhkd man page, if you are not using a QWERTY keyboard you need to start sxhkd with the following parameters

sxhkd -m -1

So I think that was the problem as you said, I was starting sxhkd after the keyboard was being set, which was US by default. So this shouldn't happen again and sxhkd is working fine and all my keys as well

Many thanks for your help on this.

Best,
Boogy

Last edited by boogy (2020-05-13 16:05:33)


Where there is a shell, there is a way

Offline

Board footer

Powered by FluxBB