Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocol not supported error when BT_RFCOMM is in the kernel config #44

Closed
devsk opened this issue Jan 2, 2021 · 12 comments
Closed

Protocol not supported error when BT_RFCOMM is in the kernel config #44

devsk opened this issue Jan 2, 2021 · 12 comments

Comments

@devsk
Copy link

devsk commented Jan 2, 2021

$ bluetooth_battery AC:12:2F:0B:3D:84
Couldn't find the RFCOMM port number
Traceback (most recent call last):
File "/home/devsk/.local/bin/bluetooth_battery", line 33, in
sys.exit(load_entry_point('bluetooth-battery==1.2.0', 'console_scripts', 'bluetooth_battery')())
File "/home/devsk/.local/lib/python3.7/site-packages/bluetooth_battery/bluetooth_battery.py", line 90, in main
s = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
File "/home/devsk/.local/lib/python3.7/site-packages/bluetooth/bluez.py", line 165, in init
_sock = _bt.btsocket (proto)
_bluetooth.error: (93, 'Protocol not supported')

$ zgrep RFCOMM /proc/config.gz
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y

Running Gentoo Linux with kernel 5.10.2

$ bluetoothctl devices
Device AC:12:2F:0B:3D:84 Soundcore Life Q30

@TheWeirdDev
Copy link
Owner

Is rfcomm kernel module loaded at startup?

@devsk
Copy link
Author

devsk commented Jan 2, 2021

As you can see from the zgrep I posted, the module is built into the kernel. So, its loaded for sure.

@TheWeirdDev
Copy link
Owner

Just to make sure, what is the output of lsmod | grep rfcomm

@devsk
Copy link
Author

devsk commented Jan 2, 2021

If a module is built-in, it won't show up in lsmod. In fact, it just doesn't exist as a .ko file that you can modprobe or insmod to load it.

# modprobe rfcomm
modprobe: FATAL: Module rfcomm not found in directory /lib/modules/5.10.2

# lsmod|grep -i rfcom

$ zgrep RFCOMM /proc/config.gz
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y

@ghost
Copy link

ghost commented Jan 2, 2021

If a module is built-in, it won't show up in lsmod. In fact, it just doesn't exist as a .ko file that you can modprobe or insmod to load it.

# modprobe rfcomm
modprobe: FATAL: Module rfcomm not found in directory /lib/modules/5.10.2

# lsmod|grep -i rfcom

$ zgrep RFCOMM /proc/config.gz
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y

This is a bug in the Linux kernel. Try CONFIG_BT_RFCOMM=m.

@devsk
Copy link
Author

devsk commented Jan 2, 2021

Do you have a link for the bug?

How is bluetooth working if there is a bug with basic RFCOMM protocol missing? I can see and connect all devices fine. blueman has no issues.

@TheWeirdDev
Copy link
Owner

This is a bug in the Linux kernel. Try CONFIG_BT_RFCOMM=m.

Now that makes sense since my arch machine also has CONFIG_BT_RFCOMM set to m by default.

➜ zgrep RFCOMM /proc/config.gz
CONFIG_BT_RFCOMM=m
CONFIG_BT_RFCOMM_TTY=y

@ghost
Copy link

ghost commented Jan 2, 2021

Do you have a link for the bug?

How is bluetooth working if there is a bug with basic RFCOMM protocol missing? I can see and connect all devices fine. blueman has no issues.

I haven't investigated this issue further. I only know that when I recompiled kernel with the following options then I see a "Protocol not supported" message:

CONFIG_BT_RFCOMM=y
CONFIG_BT_BNEP=y
CONFIG_BT_HIDP=y

@devsk
Copy link
Author

devsk commented Jan 2, 2021

ok, that's evidence.

Do we need to make the other two (HIDP and BNEP) also as modules?

@ghost
Copy link

ghost commented Jan 2, 2021

Do we need to make the other two (HIDP and BNEP) also as modules?

I don't know.

@TheWeirdDev
Copy link
Owner

TheWeirdDev commented Jan 2, 2021

Mine is like this: (I didn't change these)

➜ zgrep BT_BNEP /proc/config.gz
CONFIG_BT_BNEP=m
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y

➜ zgrep BT_HIDP /proc/config.gz
CONFIG_BT_HIDP=m

@devsk
Copy link
Author

devsk commented Jan 6, 2021

I can confirm. This is a weird kernel bug. It works when RFCOMM=m is selected.

Closing this because its not this program's fault.

@devsk devsk closed this as completed Jan 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants