emulator/vhci: Fix writing msft_opcode using binary format
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 20 Oct 2021 18:39:27 +0000 (11:39 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:37 +0000 (19:08 +0530)
debugfs expects values in string format not binary format.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
emulator/vhci.c

index f8560e0..59ad1ec 100755 (executable)
@@ -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)