You are not logged in.

#1 2018-12-26 18:17:25

maltesar
Member
Registered: 2014-10-28
Posts: 9

Keyboard lags for ~1minute after connecting a bluetooth headset

Hello together,

I have the problem that after connecting a bluetooth headset no keyboard inputs are possible for a minute or so. After that timespan all inputs from the unresponsive period are processed at once.
It is not a totally bad problem but it is anoying to wait for my keyboard after connecting my headset (didnt test it with other bluetooth devices yet).

This is the output of `sudo journalctl -xf` from connect until the keyboard is working again:

Dez 26 19:06:19 ntbk rfkill[8260]: unblock set for type bluetooth
Dez 26 19:06:19 ntbk bluetoothd[533]: Endpoint unregistered: sender=:1.219 path=/MediaEndpoint/A2DPSource
Dez 26 19:06:19 ntbk bluetoothd[533]: Endpoint unregistered: sender=:1.219 path=/MediaEndpoint/A2DPSink
Dez 26 19:06:19 ntbk rtkit-daemon[1026]: Successfully made thread 8274 of process 8274 (/usr/bin/pulseaudio) owned by '1000' high priority at nice level -11.
Dez 26 19:06:19 ntbk rtkit-daemon[1026]: Supervising 1 threads of 1 processes of 1 users.
Dez 26 19:06:19 ntbk rtkit-daemon[1026]: Supervising 1 threads of 1 processes of 1 users.
Dez 26 19:06:19 ntbk rtkit-daemon[1026]: Successfully made thread 8283 of process 8274 (/usr/bin/pulseaudio) owned by '1000' RT at priority 5.
Dez 26 19:06:19 ntbk rtkit-daemon[1026]: Supervising 2 threads of 1 processes of 1 users.
Dez 26 19:06:19 ntbk rtkit-daemon[1026]: Supervising 2 threads of 1 processes of 1 users.
Dez 26 19:06:19 ntbk rtkit-daemon[1026]: Successfully made thread 8284 of process 8274 (/usr/bin/pulseaudio) owned by '1000' RT at priority 5.
Dez 26 19:06:19 ntbk rtkit-daemon[1026]: Supervising 3 threads of 1 processes of 1 users.
Dez 26 19:06:19 ntbk bluetoothd[533]: Endpoint registered: sender=:1.245 path=/MediaEndpoint/A2DPSource
Dez 26 19:06:19 ntbk bluetoothd[533]: Endpoint registered: sender=:1.245 path=/MediaEndpoint/A2DPSink
Dez 26 19:06:19 ntbk pulseaudio[8274]: Failed to register as a handsfree audio agent with ofono: org.freedesktop.DBus.Error.ServiceUnknown: The name org.ofono was not provided by any .service files
Dez 26 19:06:23 ntbk bluetoothd[533]: /org/bluez/hci0/dev_04_5D_4B_EA_2B_16/fd2: fd(36) ready
Dez 26 19:06:23 ntbk rtkit-daemon[1026]: Supervising 3 threads of 1 processes of 1 users.
Dez 26 19:06:23 ntbk rtkit-daemon[1026]: Successfully made thread 8331 of process 8274 (/usr/bin/pulseaudio) owned by '1000' RT at priority 5.
Dez 26 19:06:23 ntbk rtkit-daemon[1026]: Supervising 4 threads of 1 processes of 1 users.
Dez 26 19:06:23 ntbk kernel: input: 04:5D:4B:EA:2B:16 as /devices/virtual/input/input23
Dez 26 19:06:23 ntbk systemd-logind[542]: Watching system buttons on /dev/input/event20 (04:5D:4B:EA:2B:16)

I was not able to find any solution in the wiki or on the internet yet. Maybe anyone here has an idea?

Merry Christmas btw
Malte

Last edited by maltesar (2018-12-26 18:17:48)

Offline

#2 2018-12-26 21:24:27

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,697

Re: Keyboard lags for ~1minute after connecting a bluetooth headset

The log only covers 4 seconds - where do they fit in the 1min span?
To rule out higher level event processing: does this also affect the linux console? (ctrl+alt+f1, or preferably "systemctl isolate multi-user.target", WARNING: this will unconditionally kill your GUI session!!)

Online

#3 2019-01-04 20:09:19

maltesar
Member
Registered: 2014-10-28
Posts: 9

Re: Keyboard lags for ~1minute after connecting a bluetooth headset

Hi,

Thanks for your help. There are only 4 seconds covered because no additional messages came up.
Higher level event processing seems to works normally after connecting a bluetooth device.
I am able to open a console with ctrl+alt+f1 and login. I can use my tmux session there and type normally.

I think the problem is triggered when I press shortcuts defined in the KDE Settings after I connected a bluetooth device.
So I connect a bluetooth device and can type normaly. But as soon as I press certain shortcuts (I tried meta+space, or ctrl+alt+j) all subsequent keyboard inputs are delayed.
However, other shortcuts to not trigger the problem (like ctrl+a).

I will read about how KDE processes shortcuts and check if I can solve the problem.
However, if someone has a idea i would be very happy.

Bye
Malte

Offline

#4 2019-01-04 23:05:41

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,697

Re: Keyboard lags for ~1minute after connecting a bluetooth headset

The shortcut daemon should be kglobalaccel or kglobalaccel5.
Only the keyboard is affected? Eg. mouse input works normally during the "freeze"?

Online

#5 2019-01-05 12:47:29

maltesar
Member
Registered: 2014-10-28
Posts: 9

Re: Keyboard lags for ~1minute after connecting a bluetooth headset

Hi Seth,

Thanks for your help so far.
Yes, the mouse works normally.

I can not find any logs of the kglobalaccel5 daemon, just this:

dbus-daemon[986]: [session uid=1000 pid=986] Successfully activated service 'org.kde.kglobalaccel

Bye
Malte

Offline

#6 2019-01-05 15:27:39

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,697

Re: Keyboard lags for ~1minute after connecting a bluetooth headset

What happens if you kill the process (eg. "sleep 10; pkill kglobalaccel; printf '\a'", then provoke the freeze and see whether it releases. "printf '\a'" triggers a terminal bell, ie. some kind of beep)

Online

#7 2019-01-06 22:40:02

maltesar
Member
Registered: 2014-10-28
Posts: 9

Re: Keyboard lags for ~1minute after connecting a bluetooth headset

Hi Seth,

What is the purpose of the sleep and terminal bell?

I just killed kglobalaccel5 and immediately pressed one of the shortcuts which usually trigger the freeze but no freeze happend. I was able to type normally.
However, one second after I connect a bluetooth device the previously killed kglobalaccel5 is running again and all shortcuts work as usual.
So the connection of a bluetooth device restarts kglobalaccel5.
I tried to find out if multiple processes of kglobalaccel5 are started after connecting a bluetooth device by running `watch -n 1 "ps -ef | grep kglobalac"` but that was not the case.

When I kill kglobalaccel5 and connect a bluetooth device journalctl shows me the following:

Jan 06 23:26:59 ntbk bluetoothd[554]: /org/bluez/hci0/dev_04_5D_4B_EA_2B_16/fd6: fd(25) ready
Jan 06 23:26:59 ntbk rtkit-daemon[1046]: Supervising 0 threads of 0 processes of 0 users.
Jan 06 23:26:59 ntbk kernel: input: 04:5D:4B:EA:2B:16 as /devices/virtual/input/input27
Jan 06 23:26:59 ntbk rtkit-daemon[1046]: Successfully made thread 14908 of process 6331 (/usr/bin/pulseaudio) owned by '1000' RT at priority 5.
Jan 06 23:26:59 ntbk rtkit-daemon[1046]: Supervising 1 threads of 1 processes of 1 users.
Jan 06 23:27:00 ntbk systemd-logind[560]: Watching system buttons on /dev/input/event20 (04:5D:4B:EA:2B:16)
Jan 06 23:27:01 ntbk dbus-daemon[910]: [session uid=1000 pid=910] Activating service name='org.kde.kglobalaccel' requested by ':1.5' (uid=1000 pid=942 comm="kded5 [kdeinit5]                                  ")
Jan 06 23:27:01 ntbk dbus-daemon[910]: [session uid=1000 pid=910] Successfully activated service 'org.kde.kglobalaccel'

Offline

#8 2019-01-06 22:42:33

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,697

Re: Keyboard lags for ~1minute after connecting a bluetooth headset

The idea was to kill kglobalaccel5 after you caused the freeze (adding the BT device and pressing a triggering shortcut) - and the bell was to inform you that the kill command terminated (and does not eg. wait for the freeze release itself)

Online

#9 2019-01-09 09:02:27

maltesar
Member
Registered: 2014-10-28
Posts: 9

Re: Keyboard lags for ~1minute after connecting a bluetooth headset

Hi seth,

Ok I just tried that. Killing kglobalaccel5, after the freeze has been triggered, works. I dont even have to restart it since kglobalaccel5 starts again immediately.

Thanks for your help so far. Since I use a script to connect my headphones this workaround works for me atm.

// [...]
pkill kglobalaccel5
echo -e "connect $DEVICE\nquit" | bluetoothctl
sleep 3

# restart kglobalaccel5 if its not running
if ! pgrep -x "kglobalaccel5" > /dev/null
then
  kglobalaccel5
fi

Best regards
Malte

Offline

#10 2019-01-09 13:18:36

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,697

Re: Keyboard lags for ~1minute after connecting a bluetooth headset

You could attach strace to kglobalaccel5 to get an idea what it's doing or ideally attach gdb to it - but you'll probably need a remote connection in order to stop the kglobalaccel execution and dump a trace while you don't have keyboard input on the affected system…

Online

Board footer

Powered by FluxBB