Skip to content

Instantly share code, notes, and snippets.

@Juul
Last active January 10, 2023 12:34
Show Gist options
  • Save Juul/bc3b9120c29a0300b9e210aaed122000 to your computer and use it in GitHub Desktop.
Save Juul/bc3b9120c29a0300b9e210aaed122000 to your computer and use it in GitHub Desktop.
How to blacklist / disable / ignore the keyboard devices created by USB bluetooth audio only adapters

I bought one of these weird USB bluetooth audio adapters that only acts as a bluetooth audio transmitter, meaning that it doesn't show up as a bluetooth device at all but rather as a USB audio device.

The specific device I got is branded as 1Mii, shows up in X logs with the name TaiYiLian and in lsusb as "Cambridge Silicon Radio, Ltd".

I can't really recommend it. There is no way to select which device to pair with (I believe it picks the device currently in pairing mode with the highest signal strength) and there is a delay every time audio is played before it kicks in (at least on my system).

Another problem is that it shows up as not just a USB audio device, but also two keyboards and these keyboards send keystrokes which causes X to loose focus with no way of regaining it by clicking. The only way I found to get normal keyboard functionality back is to ctrl+alt+F2 into a terminal and then switch back to X. Unfortunately this seems to happen repeatedly, so just having it plugged in before boot doesn't help.

I believe these keyboard devices are meant to allow the bluetooth receiver to send control signals to e.g. change the volume on the computer and I have no idea why there are two separate devices or why they cause X to misbehave so badly.

Assuming you don't want or need this functionality, there is fortunately a simple way to permanently disable the keyboards devices in X.

Simply list all USB devices with lsusb while the device is unplugged and then again when it is plugged in and look for the difference. For me they showed up as:

Bus 002 Device 014: ID 0a12:4007 Cambridge Silicon Radio, Ltd 
Bus 002 Device 013: ID 0a12:4010 Cambridge Silicon Radio, Ltd

You can also check your /var/log/Xorg.0.log and you'll see something like:

Adding input device TaiYiLian B10
Adding input device TaiYiLian B10 Consumer Control

With the /sys/... and /dev/... paths for each device.

To blacklist them, add the following to /etc/X11/xorg.conf (create it if it doesn't exist), and replace the MatchUSBID values with the values from lsusb.

Section "InputClass"
    Identifier "DisableBluetoothAudioKeyboard1"
    MatchIsKeyboard "on"
    MatchUSBID "0a12:4010"
    Option "Ignore" "true"
EndSection

Section "InputClass"
    Identifier "DisableBluetoothAudioKeyboard2"
    MatchIsKeyboard "on"
    MatchUSBID "0a12:4007"
    Option "Ignore" "true"
EndSection

Then restart X and everything should be back to normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment