MdePkg/DevicePathLib: Reverse the byte order of BD_ADDR for Bluetooth
For the following two functions: DevPathFromTextBluetooth() DevPathToTextBluetooth() The Bluetooth device address "UINT8 Address[6]" is displayed with the order from Address[5] to Address[0]. This commit reverses the order. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
@@ -2635,35 +2635,20 @@ DevPathFromTextBluetooth (
|
||||
)
|
||||
{
|
||||
CHAR16 *BluetoothStr;
|
||||
CHAR16 *Walker;
|
||||
CHAR16 *TempNumBuffer;
|
||||
UINTN TempBufferSize;
|
||||
INT32 Index;
|
||||
BLUETOOTH_DEVICE_PATH *BluetoothDp;
|
||||
|
||||
BluetoothStr = GetNextParamStr (&TextDeviceNode);
|
||||
BluetoothDp = (BLUETOOTH_DEVICE_PATH *) CreateDeviceNode (
|
||||
MESSAGING_DEVICE_PATH,
|
||||
MSG_BLUETOOTH_DP,
|
||||
(UINT16) sizeof (BLUETOOTH_DEVICE_PATH)
|
||||
);
|
||||
|
||||
Index = sizeof (BLUETOOTH_ADDRESS) - 1;
|
||||
Walker = BluetoothStr;
|
||||
while (!IS_NULL(*Walker) && Index >= 0) {
|
||||
TempBufferSize = 2 * sizeof(CHAR16) + StrSize(L"0x");
|
||||
TempNumBuffer = AllocateZeroPool (TempBufferSize);
|
||||
if (TempNumBuffer == NULL) {
|
||||
break;
|
||||
}
|
||||
StrCpyS (TempNumBuffer, TempBufferSize / sizeof (CHAR16), L"0x");
|
||||
StrnCatS (TempNumBuffer, TempBufferSize / sizeof (CHAR16), Walker, 2);
|
||||
BluetoothDp->BD_ADDR.Address[Index] = (UINT8)Strtoi (TempNumBuffer);
|
||||
FreePool (TempNumBuffer);
|
||||
Walker += 2;
|
||||
Index--;
|
||||
}
|
||||
|
||||
BluetoothDp = (BLUETOOTH_DEVICE_PATH *) CreateDeviceNode (
|
||||
MESSAGING_DEVICE_PATH,
|
||||
MSG_BLUETOOTH_DP,
|
||||
(UINT16) sizeof (BLUETOOTH_DEVICE_PATH)
|
||||
);
|
||||
StrHexToBytes (
|
||||
BluetoothStr,
|
||||
sizeof (BLUETOOTH_ADDRESS) * 2,
|
||||
BluetoothDp->BD_ADDR.Address,
|
||||
sizeof (BLUETOOTH_ADDRESS)
|
||||
);
|
||||
return (EFI_DEVICE_PATH_PROTOCOL *) BluetoothDp;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user