summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
diff options
context:
space:
mode:
authorQiu Shumin <shumin.qiu@intel.com>2015-05-06 02:41:37 +0000
committershenshushi <shenshushi@Edk2>2015-05-06 02:41:37 +0000
commit7795c8f942333779adb812d492c3a92684daf3b5 (patch)
tree2065eb334d81da380872903015a211c9b2c8967a /MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
parent362c355cc43d325a8da56af343251a2d484c41ba (diff)
downloadedk2-7795c8f942333779adb812d492c3a92684daf3b5.tar.gz
edk2-7795c8f942333779adb812d492c3a92684daf3b5.tar.bz2
edk2-7795c8f942333779adb812d492c3a92684daf3b5.zip
MdePkg: Add bluetooth devicepath handling in device path library.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <shumin.qiu@intel.com> Reviewed-by: Yao Jiewen <jiewen.yao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17312 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c')
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c49
1 files changed, 47 insertions, 2 deletions
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
index f688c1af74..dec084c313 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@@ -1,7 +1,7 @@
/** @file
DevicePathFromText protocol as defined in the UEFI 2.0 specification.
-Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -2697,6 +2697,51 @@ DevPathFromTextVlan (
}
/**
+ Converts a text device path node to Bluetooth device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created Bluetooth device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextBluetooth (
+ IN CHAR16 *TextDeviceNode
+ )
+{
+ 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;
+ while (!IS_NULL(BluetoothStr) && Index >= 0) {
+ Walker = SplitStr (&BluetoothStr, L':');
+ TempBufferSize = StrSize (Walker) + StrLen (L"0x") * sizeof (CHAR16);
+ TempNumBuffer = AllocateZeroPool (TempBufferSize);
+ if (TempNumBuffer == NULL) {
+ break;
+ }
+ StrnCpy (TempNumBuffer, L"0x", TempBufferSize / sizeof (CHAR16));
+ StrnCat (TempNumBuffer + StrLen (L"0x"), Walker, TempBufferSize / sizeof (CHAR16) - StrLen (L"0x") );
+ BluetoothDp->BD_ADDR.Address[Index] = (UINT8)Strtoi (TempNumBuffer);
+ FreePool (TempNumBuffer);
+ Index--;
+ }
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) BluetoothDp;
+}
+
+/**
Converts a media text device path node to media device path structure.
@param TextDeviceNode The input Text device path node.
@@ -3136,7 +3181,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevP
{L"Unit", DevPathFromTextUnit },
{L"iSCSI", DevPathFromTextiSCSI },
{L"Vlan", DevPathFromTextVlan },
-
+ {L"Bluetooth", DevPathFromTextBluetooth },
{L"MediaPath", DevPathFromTextMediaPath },
{L"HD", DevPathFromTextHD },
{L"CDROM", DevPathFromTextCDROM },