All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] emulator: Skip new line when using util_debug
@ 2023-09-19 16:27 Arkadiusz Bokowy
  2023-09-19 16:27 ` [PATCH BlueZ 2/2] hciemu: Call btdev_receive_h4 unconditionally Arkadiusz Bokowy
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Arkadiusz Bokowy @ 2023-09-19 16:27 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Arkadiusz Bokowy

The debug callback vhci_debug() already prints new line after each debug
string. Explicit new line in the util_debug call causes double new line
in the output.
---
 emulator/btdev.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 58414bd74..65ad0a40c 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -7298,16 +7298,17 @@ static const struct btdev_cmd *vnd_cmd(struct btdev *btdev, uint8_t op,
 					const struct btdev_cmd *cmd,
 					const void *data, uint8_t len)
 {
+	uint8_t opcode = ((const uint8_t *)data)[0];
+
 	for (; cmd && cmd->func; cmd++) {
-		if (cmd->opcode != ((uint8_t *)data)[0])
+		if (cmd->opcode != opcode)
 			continue;
 
 		return run_cmd(btdev, cmd, data, len);
 	}
 
 	util_debug(btdev->debug_callback, btdev->debug_data,
-			"Unsupported Vendor subcommand 0x%2.2x\n",
-			((uint8_t *)data)[0]);
+			"Unsupported Vendor subcommand 0x%2.2x", opcode);
 
 	cmd_status(btdev, BT_HCI_ERR_UNKNOWN_COMMAND, op);
 
@@ -7333,7 +7334,7 @@ static const struct btdev_cmd *default_cmd(struct btdev *btdev, uint16_t opcode,
 	}
 
 	util_debug(btdev->debug_callback, btdev->debug_data,
-			"Unsupported command 0x%4.4x\n", opcode);
+			"Unsupported command 0x%4.4x", opcode);
 
 	cmd_status(btdev, BT_HCI_ERR_UNKNOWN_COMMAND, opcode);
 
@@ -7521,7 +7522,7 @@ void btdev_receive_h4(struct btdev *btdev, const void *data, uint16_t len)
 		break;
 	default:
 		util_debug(btdev->debug_callback, btdev->debug_data,
-				"Unsupported packet 0x%2.2x\n", pkt_type);
+				"Unsupported packet 0x%2.2x", pkt_type);
 		break;
 	}
 }
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH BlueZ 2/2] hciemu: Call btdev_receive_h4 unconditionally
  2023-09-19 16:27 [PATCH BlueZ 1/2] emulator: Skip new line when using util_debug Arkadiusz Bokowy
@ 2023-09-19 16:27 ` Arkadiusz Bokowy
  2023-09-19 17:53 ` [BlueZ,1/2] emulator: Skip new line when using util_debug bluez.test.bot
  2023-09-19 19:20 ` [PATCH BlueZ 1/2] " patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: Arkadiusz Bokowy @ 2023-09-19 16:27 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Arkadiusz Bokowy

Calling btdev_receive_h4 without prior logic will allow this function
to print some debug logs. E.g.: in case when the received packet type
is not supported.

> Bluetooth emulator ver 5.66
> vhci0: > ff 00 01 00                                      ....
> vhci0: Unsupported packet 0xff
---
 emulator/hciemu.c | 9 +--------
 emulator/vhci.c   | 9 +--------
 2 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/emulator/hciemu.c b/emulator/hciemu.c
index 0b5847c27..25874ded5 100644
--- a/emulator/hciemu.c
+++ b/emulator/hciemu.c
@@ -190,14 +190,7 @@ static gboolean receive_btdev(GIOChannel *channel, GIOCondition condition,
 	if (len < 1)
 		return FALSE;
 
-	switch (buf[0]) {
-	case BT_H4_CMD_PKT:
-	case BT_H4_ACL_PKT:
-	case BT_H4_SCO_PKT:
-	case BT_H4_ISO_PKT:
-		btdev_receive_h4(btdev, buf, len);
-		break;
-	}
+	btdev_receive_h4(btdev, buf, len);
 
 	return TRUE;
 }
diff --git a/emulator/vhci.c b/emulator/vhci.c
index c6a5caa5e..7b363009a 100644
--- a/emulator/vhci.c
+++ b/emulator/vhci.c
@@ -74,14 +74,7 @@ static bool vhci_read_callback(struct io *io, void *user_data)
 	if (len < 1)
 		return false;
 
-	switch (buf[0]) {
-	case BT_H4_CMD_PKT:
-	case BT_H4_ACL_PKT:
-	case BT_H4_SCO_PKT:
-	case BT_H4_ISO_PKT:
-		btdev_receive_h4(vhci->btdev, buf, len);
-		break;
-	}
+	btdev_receive_h4(vhci->btdev, buf, len);
 
 	return true;
 }
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [BlueZ,1/2] emulator: Skip new line when using util_debug
  2023-09-19 16:27 [PATCH BlueZ 1/2] emulator: Skip new line when using util_debug Arkadiusz Bokowy
  2023-09-19 16:27 ` [PATCH BlueZ 2/2] hciemu: Call btdev_receive_h4 unconditionally Arkadiusz Bokowy
@ 2023-09-19 17:53 ` bluez.test.bot
  2023-09-19 19:20 ` [PATCH BlueZ 1/2] " patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2023-09-19 17:53 UTC (permalink / raw)
  To: linux-bluetooth, arkadiusz.bokowy

[-- Attachment #1: Type: text/plain, Size: 1122 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=785675

---Test result---

Test Summary:
CheckPatch                    PASS      1.07 seconds
GitLint                       PASS      0.72 seconds
BuildEll                      PASS      27.95 seconds
BluezMake                     PASS      856.86 seconds
MakeCheck                     PASS      12.43 seconds
MakeDistcheck                 PASS      157.60 seconds
CheckValgrind                 PASS      257.99 seconds
CheckSmatch                   WARNING   348.58 seconds
bluezmakeextell               PASS      106.98 seconds
IncrementalBuild              PASS      1500.71 seconds
ScanBuild                     PASS      1069.65 seconds

Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
emulator/btdev.c:420:29: warning: Variable length array is used.


---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH BlueZ 1/2] emulator: Skip new line when using util_debug
  2023-09-19 16:27 [PATCH BlueZ 1/2] emulator: Skip new line when using util_debug Arkadiusz Bokowy
  2023-09-19 16:27 ` [PATCH BlueZ 2/2] hciemu: Call btdev_receive_h4 unconditionally Arkadiusz Bokowy
  2023-09-19 17:53 ` [BlueZ,1/2] emulator: Skip new line when using util_debug bluez.test.bot
@ 2023-09-19 19:20 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2023-09-19 19:20 UTC (permalink / raw)
  To: Arkadiusz Bokowy; +Cc: linux-bluetooth

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Tue, 19 Sep 2023 18:27:44 +0200 you wrote:
> The debug callback vhci_debug() already prints new line after each debug
> string. Explicit new line in the util_debug call causes double new line
> in the output.
> ---
>  emulator/btdev.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)

Here is the summary with links:
  - [BlueZ,1/2] emulator: Skip new line when using util_debug
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=eb9eaf01d161
  - [BlueZ,2/2] hciemu: Call btdev_receive_h4 unconditionally
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=7f788a2c5162

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-19 19:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-19 16:27 [PATCH BlueZ 1/2] emulator: Skip new line when using util_debug Arkadiusz Bokowy
2023-09-19 16:27 ` [PATCH BlueZ 2/2] hciemu: Call btdev_receive_h4 unconditionally Arkadiusz Bokowy
2023-09-19 17:53 ` [BlueZ,1/2] emulator: Skip new line when using util_debug bluez.test.bot
2023-09-19 19:20 ` [PATCH BlueZ 1/2] " patchwork-bot+bluetooth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.