You are not logged in.

#1 2021-03-25 20:24:58

MilanKnizek
Member
Registered: 2005-12-13
Posts: 88

How to suppress rtk_btcoex messages in journal

Hi,

I have got a new Bluetooth 5 usb dongle 0bda:8771 Realtek Semiconductor Corp. Bluetooth Radio and got it working with the help of AUR package rtl8761usb

$ lsmod | grep rtk_
rtk_btusb              65536  0
bluetooth             749568  55 bnep,rtk_btusb,rfcomm

btusb module is blacklisted.

Generally, it is working, however during the playback the journal is full of

Mar 25 20:56:53 athlon kernel: rtk_btcoex: count_a2dp_packet_timeout: a2dp_packet_count 127
Mar 25 20:56:54 athlon kernel: rtk_btcoex: count_a2dp_packet_timeout: a2dp_packet_count 126
Mar 25 20:56:55 athlon kernel: rtk_btcoex: count_a2dp_packet_timeout: a2dp_packet_count 127
Mar 25 20:56:56 athlon kernel: rtk_btcoex: count_a2dp_packet_timeout: a2dp_packet_count 65

That represents cca 90 % of all messages. The issue occurs on both USB 2.0 and 3.0 ports (without hub).

I can see that the messages are produced by usb/bluetooth_usb_driver/rtk_coex.c

#if LINUX_VERSION_CODE > KERNEL_VERSION(4, 14, 0)
static void count_a2dp_packet_timeout(struct timer_list *unused)
#else
static void count_a2dp_packet_timeout(unsigned long data)
#endif
{
    if (btrtl_coex.a2dp_packet_count)
        RTKBT_DBG("%s: a2dp_packet_count %d", __func__,
              btrtl_coex.a2dp_packet_count);
    if (btrtl_coex.a2dp_packet_count == 0) {
        if (is_profile_busy(profile_a2dp)) {
            RTKBT_DBG("%s: a2dp busy->idle!", __func__);
            update_profile_state(profile_a2dp, FALSE);
            if (btrtl_coex.profile_bitmap & BIT(profile_sink))
                update_profile_state(profile_sink, FALSE);
        }
    }

Although I believe it would be great to solve the timeout problems, yet, is there a way how to suppress the RTKBT_DBG messages? Either realtime, via module config or even by recompiling the module?


--
Milan Knizek
http://knizek.net

Offline

#2 2021-03-25 20:43:17

loqs
Member
Registered: 2014-03-06
Posts: 19,016

Re: How to suppress rtk_btcoex messages in journal

Try applying this diff to the package:

diff --git a/20201202_LINUX_BT_DRIVER/usb/bluetooth_usb_driver/rtk_misc.h b/20201202_LINUX_BT_DRIVER/usb/bluetooth_usb_driver/rtk_misc.h
index dbc5690..9fb1163 100644
--- a/20201202_LINUX_BT_DRIVER/usb/bluetooth_usb_driver/rtk_misc.h
+++ b/20201202_LINUX_BT_DRIVER/usb/bluetooth_usb_driver/rtk_misc.h
@@ -37,11 +37,13 @@
 /* #define RTKBT_TV_POWERON_WHITELIST */
 
 #if 1
-#define RTKBT_DBG(fmt, arg...) printk(KERN_INFO "rtk_btusb: " fmt "\n" , ## arg)
+#define RTKBT_DBG(fmt, arg...) printk(KERN_DEBUG "rtk_btusb: " fmt "\n" , ## arg)
 #define RTKBT_INFO(fmt, arg...) printk(KERN_INFO "rtk_btusb: " fmt "\n" , ## arg)
 #define RTKBT_WARN(fmt, arg...) printk(KERN_WARNING "rtk_btusb: " fmt "\n", ## arg)
 #else
 #define RTKBT_DBG(fmt, arg...)
+#define RTKBT_INFO(fmt, arg...)
+#define RTKBT_WARN(fmt, arg...)
 #endif
 
 #if 1

Edit:
Updated patch to use log level KERN_DEBUG instead of disabling the message.  By default debug messages are disabled anyway.

Last edited by loqs (2021-03-25 21:15:55)

Offline

#3 2021-03-25 22:05:48

MilanKnizek
Member
Registered: 2005-12-13
Posts: 88

Re: How to suppress rtk_btcoex messages in journal

Thanks for the quick comment and effort. From some reason, the RTKBT_DBG macro still produced the full error message, despite the log level being changed to KERN_DEBUG from the original KERN_INFO - as per you patch.

My kernel log level is:

# cat /proc/sys/kernel/printk
1	4	1	4

So, the DEBUG messages should not show. They did.

Eventually, I ended up commenting the part of the code directly:

--- rtk_coex.c  2020-10-20 13:52:08.000000000 +0200
+++ rtk_coex.c_1    2021-03-25 22:26:30.158850666 +0100
@@ -1046,9 +1046,9 @@
 static void count_a2dp_packet_timeout(unsigned long data)
 #endif
 {
-   if (btrtl_coex.a2dp_packet_count)
-       RTKBT_DBG("%s: a2dp_packet_count %d", __func__,
-             btrtl_coex.a2dp_packet_count);
+   //if (btrtl_coex.a2dp_packet_count)
+       //RTKBT_DBG("%s: a2dp_packet_count %d", __func__,
+       //    btrtl_coex.a2dp_packet_count);
    if (btrtl_coex.a2dp_packet_count == 0) {
        if (is_profile_busy(profile_a2dp)) {
            RTKBT_DBG("%s: a2dp busy->idle!", __func__);

My journal is now happier :-)


--
Milan Knizek
http://knizek.net

Offline

#4 2021-03-25 22:19:09

loqs
Member
Registered: 2014-03-06
Posts: 19,016

Re: How to suppress rtk_btcoex messages in journal

Printk filtering only effects what is sent to the console but it is surprising debug messages are being emitted by the kernel.
Glad you fixed the issue anyway.
Edit:
Should have used pr_debug / dev_debug which would only be enabled by dynamic debugging instead of just changing the log level.  Oh well fixed now.

Last edited by loqs (2021-03-25 22:38:16)

Offline

Board footer

Powered by FluxBB