媒体密钥不起作用


12

我的静音键,降低音量键和提高音量键均有效,但上一个,下一个键和播放/暂停键均无效。

我尝试了此处发布的解决方案,但这似乎不是问题。我的所有org.gnome.settings-daemon.plugins.media-keys设置似乎都以XF86作为前缀:

在此处输入图片说明

这是依次按上一个,下一个,播放/暂停和静音的输出:

$ xev
MappingNotify event, serial 39, synthetic NO, window 0x0,
    request MappingKeyboard, first_keycode 8, count 248

FocusOut event, serial 39, synthetic NO, window 0x3600001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 40, synthetic NO, window 0x3600001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 40, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

FocusOut event, serial 40, synthetic NO, window 0x3600001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 40, synthetic NO, window 0x3600001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 40, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

FocusOut event, serial 40, synthetic NO, window 0x3600001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 40, synthetic NO, window 0x3600001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 40, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

FocusOut event, serial 40, synthetic NO, window 0x3600001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 40, synthetic NO, window 0x3600001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 40, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

FocusOut event, serial 40, synthetic NO, window 0x3600001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 40, synthetic NO, window 0x3600001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 40, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0  
$ sudo showkey -k
kb mode was ?UNKNOWN?
[ if you are trying this under X, it might not work
since the X server is also reading /dev/console ]

press any key (program terminates 10s after last keypress)...
keycode 165 press
keycode 165 release
keycode 163 press
keycode 163 release
keycode 164 press
keycode 164 release
keycode 113 press
keycode 113 release
$ sudo showkey -s
kb mode was ?UNKNOWN?
[ if you are trying this under X, it might not work
since the X server is also reading /dev/console ]

press any key (program terminates 10s after last keypress)...
0xe0 0x10 0xe0 0x90 
0xe0 0x19 0xe0 0x99 
0xe0 0x22 0xe0 0xa2 
0xe0 0x20 0xe0 0xa0 

我怎样才能解决这个问题?

/ e1

我决定对此进行更多研究。显然,如果您有USB键盘,则需要使用evtest而不是showkey获取正确的扫描代码:

$ sudo evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:  Power Button
/dev/input/event1:  Power Button
/dev/input/event2:  CYKB16 USB Keyboard
/dev/input/event3:  CYKB16 USB Keyboard
/dev/input/event4:  USB Optical Mouse
/dev/input/event5:  HDA ATI HDMI HDMI/DP,pcm=3
/dev/input/event6:  HDA ATI HDMI HDMI/DP,pcm=7
/dev/input/event7:  HDA ATI HDMI HDMI/DP,pcm=8
/dev/input/event8:  HDA ATI HDMI HDMI/DP,pcm=9
/dev/input/event9:  HDA ATI HDMI HDMI/DP,pcm=10
/dev/input/event10: HDA ATI HDMI HDMI/DP,pcm=11
/dev/input/event11: HDA Intel PCH Front Mic
/dev/input/event12: HDA Intel PCH Rear Mic
/dev/input/event13: HDA Intel PCH Line
/dev/input/event14: HDA Intel PCH Line Out Front
/dev/input/event15: HDA Intel PCH Line Out Surround
/dev/input/event16: HDA Intel PCH Line Out CLFE
/dev/input/event17: HDA Intel PCH Line Out Side
/dev/input/event18: HDA Intel PCH Front Headphone
/dev/input/event19: Eee PC WMI hotkeys
Select the device event number [0-19]: 3
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x1130 product 0x7979 version 0x110
Input device name: "CYKB16 USB Keyboard"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 113 (KEY_MUTE)
    Event code 114 (KEY_VOLUMEDOWN)
    Event code 115 (KEY_VOLUMEUP)
    Event code 116 (KEY_POWER)
    Event code 128 (KEY_STOP)
    Event code 140 (KEY_CALC)
    Event code 142 (KEY_SLEEP)
    Event code 143 (KEY_WAKEUP)
    Event code 144 (KEY_FILE)
    Event code 155 (KEY_MAIL)
    Event code 156 (KEY_BOOKMARKS)
    Event code 158 (KEY_BACK)
    Event code 159 (KEY_FORWARD)
    Event code 163 (KEY_NEXTSONG)
    Event code 164 (KEY_PLAYPAUSE)
    Event code 165 (KEY_PREVIOUSSONG)
    Event code 166 (KEY_STOPCD)
    Event code 171 (KEY_CONFIG)
    Event code 172 (KEY_HOMEPAGE)
    Event code 173 (KEY_REFRESH)
    Event code 217 (KEY_SEARCH)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
Event: time 1484332277.304213, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00b6
Event: time 1484332277.304213, type 1 (EV_KEY), code 165 (KEY_PREVIOUSSONG), value 1
Event: time 1484332277.304213, -------------- SYN_REPORT ------------
Event: time 1484332277.304231, type 1 (EV_KEY), code 165 (KEY_PREVIOUSSONG), value 0
Event: time 1484332277.304231, -------------- SYN_REPORT ------------
Event: time 1484332277.640192, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00b5
Event: time 1484332277.640192, type 1 (EV_KEY), code 163 (KEY_NEXTSONG), value 1
Event: time 1484332277.640192, -------------- SYN_REPORT ------------
Event: time 1484332277.640207, type 1 (EV_KEY), code 163 (KEY_NEXTSONG), value 0
Event: time 1484332277.640207, -------------- SYN_REPORT ------------
Event: time 1484332277.951137, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00cd
Event: time 1484332277.951137, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 1
Event: time 1484332277.951137, -------------- SYN_REPORT ------------
Event: time 1484332277.951153, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 0
Event: time 1484332277.951153, -------------- SYN_REPORT ------------

通过将它们重新映射为字母,我可以验证我的密钥是否有效:

$ cat /etc/udev/hwdb.d/90-custom-keyboard.hwdb 
evdev:input:b0003v1130p7979*
 KEYBOARD_KEY_c00cd=a
 KEYBOARD_KEY_c00b6=b
 KEYBOARD_KEY_c00b5=c
$ sudo udevadm --debug hwdb --update
$ sudo udevadm trigger

现在,我可以使用上一个,下一个以及播放/暂停键键入字母。接下来,我曾经xdotool测试过按键:

$ xdotool key XF86AudioLowerVolume
$ xdotool key XF86AudioRaiseVolume

都可以,但是以下任何一项都不起作用

$ xdotool key XF86AudioPlay
$ xdotool key XF86AudioNext
$ xdotool key XF86AudioPrev

这使我认为Unity以某种方式与媒体播放器集成成为了现实。我不确定如何检查Unity是否在幕后做正确的事情。有任何想法吗?

/ e2

$ sudo lsusb -d 1130:7979
Bus 001 Device 003: ID 1130:7979 Tenx Technology, Inc. 
$ sudo lsusb -t
/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
        |__ Port 7: Dev 3, If 0, Class=Wireless, Driver=btusb, 12M
        |__ Port 7: Dev 3, If 1, Class=Wireless, Driver=btusb, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
        |__ Port 5: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 5: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 6: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M

/ e3

$ unity --version
unity 7.4.0

/ e4

$ uname -a
Linux urithiru 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

/ e5

$ banshee --version
Banshee 2.6.2 (2.6.2) http://banshee.fm
Copyright 2005-2017 Novell, Inc. and Contributors.
$ vlc --version
VLC media player 2.2.2 Weatherwax (revision 2.2.2-0-g6259d80)
VLC version 2.2.2 Weatherwax (2.2.2-0-g6259d80)
Compiled by buildd on lgw01-10.buildd (Mar 28 2016 02:49:24)
Compiler: gcc version 5.3.1 20160323 (Ubuntu 5.3.1-13ubuntu1)
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute it under the terms of the GNU General Public License;
see the file named COPYING for details.
Written by the VideoLAN team; see the AUTHORS file.

如果您想要该GSettings路径清单的文本版本,可以使用获得一个dconf dump /org/gnome/settings-daemon/plugins/media-keys/。(这恰好是保存和还原GSettings / DConf数据的强大方法。):-)
David Foerster

不是Unity:它是硬件模块。您有什么键盘硬件???
Fabby

2
@Fabby键盘在14.04上完美运行。我会与支持人员联系,以了解关于16.04的某些问题。
杰弗里(Jeffrey)

1
@JacobVlijm:一个更好的想法是将备份Dconf数据库媒体键是dconf dumpdconf reset -f和(恢复)dconf load
David Foerster

1
@DavidFoerster我确保在打开新媒体播放器之前先关闭所有媒体播放器,但仍然无法正常工作。VLC不允许我将播放/暂停,下一个或上一个按钮设置为这些操作的全局热键。不过,我能够将ALT +播放/暂停,ALT +下一步和ALT +上一个设置为热键。
杰弗里

Answers:


4

媒体键确实起作用(带有节奏盒)。它们不适用于banshee或VLC,因为Ubuntu 16.04中有banshee 2.6.2VLC 2.2.2的错误。

VLC的一种解决方法是设置全局热键


另一个有趣的发现:看来这可能是一个单一的错误。它们与gnome-shell配合良好。
杰弗里

使用ubuntu-gnome-desktop,我注意到打开两个Spotify实例也会使媒体密钥发生故障。
1

0

正如@Jeffrey在回答中指出的那样,媒体密钥可与rythmbox v.3.3一起使用。它们也适用于图腾v.3.18.1,无需进行任何调整。

还可以与Rosewill RKM-1600RF(RF6560)2.4GHz无线多媒体键盘配合使用

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.