diff mbox series

[BlueZ,3/6] emulator/vhci: Fix writing msft_opcode using binary format

Message ID 20211020214843.431327-3-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Delegated to: Luiz Von Dentz
Headers show
Series [BlueZ,1/6] monitor/msft: Fix uuid.u128 format | expand

Checks

Context Check Description
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS

Commit Message

Luiz Augusto von Dentz Oct. 20, 2021, 9:48 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

debugfs expects values in string format not binary format.
---
 emulator/vhci.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/emulator/vhci.c b/emulator/vhci.c
index f8560e0c5..59ad1ecb8 100644
--- a/emulator/vhci.c
+++ b/emulator/vhci.c
@@ -230,7 +230,16 @@  int vhci_set_force_wakeup(struct vhci *vhci, bool enable)
 
 int vhci_set_msft_opcode(struct vhci *vhci, uint16_t opcode)
 {
-	return vhci_debugfs_write(vhci, "msft_opcode", &opcode, sizeof(opcode));
+	int err;
+	char val[7];
+
+	snprintf(val, sizeof(val), "0x%4x", opcode);
+
+	err = vhci_debugfs_write(vhci, "msft_opcode", &val, sizeof(val));
+	if (err)
+		return err;
+
+	return btdev_set_msft_opcode(vhci->btdev, opcode);
 }
 
 int vhci_set_aosp_capable(struct vhci *vhci, bool enable)