Sysfs

From wikinotes

sysfs was introduced in the linux kernel 2.6. It exposes kernel options as a filesystem under /sys/. Some distros have fancy configuration files to apply settings to sysfs that persist across reboots (generally /etc/sysfs.conf, but minimalist systems like arch expect you to make changes in systemd unitfiles.

Parameter Overview

The sysfsutils package includes systool, which can be used to query the various configurable sysfs elements.

systool -m bluetooth -a                 # list all parameters of module:bluetooth
systool -m bluetooth -A disable_ertm    # query the state of module:bluetooth's parameter:disable_ertm

Temporary Changes

echo 1 > /sys/modules/bluetooth/parameters/disable_ertm

Persistent Changes

Persistent changes are made in systemd unitfiles.

/etc/systemd/system/disable_bluetooth_ertm.service
[Unit]
Description=Disable Bluetooth ERTM (for Xbox One Controller)
After=multi-user.target

[Service]
ExecStart=/usr/bin/bash -c '/usr/bin/echo 1 > /sys/module/bluetooth/parameters/disable_ertm'

[Install]
WantedBy=bluetooth.target
systemctl enable disable_bluetooth_ertm.service
systemctl start  disable_bluetooth_ertm.service