From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "Ni, Ruiyu" <ruiyu.ni@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH v2 1/5] MdePkg/DevicePath: Add BluetoothLe device path node support
Date: Tue, 6 Jun 2017 06:42:56 +0000 [thread overview]
Message-ID: <B80AF82E9BFB8E4FBD8C89DA810C6A0931CBE2F2@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20170606033543.254936-2-ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
> -----Original Message-----
> From: Ni, Ruiyu
> Sent: Tuesday, June 06, 2017 11:36 AM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A
> Subject: [PATCH v2 1/5] MdePkg/DevicePath: Add BluetoothLe device path node
> support
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> ---
> MdePkg/Include/IndustryStandard/Bluetooth.h | 17 +++++++++-
> MdePkg/Include/Protocol/DevicePath.h | 11 ++++++-
> .../Library/UefiDevicePathLib/DevicePathFromText.c | 34
> +++++++++++++++++++
> .../Library/UefiDevicePathLib/DevicePathToText.c | 38
> ++++++++++++++++++++++
> 4 files changed, 98 insertions(+), 2 deletions(-)
>
> diff --git a/MdePkg/Include/IndustryStandard/Bluetooth.h
> b/MdePkg/Include/IndustryStandard/Bluetooth.h
> index 7dc9d558dc..caea3ac034 100644
> --- a/MdePkg/Include/IndustryStandard/Bluetooth.h
> +++ b/MdePkg/Include/IndustryStandard/Bluetooth.h
> @@ -2,7 +2,7 @@
> This file contains the Bluetooth definitions that are consumed by drivers.
> These definitions are from Bluetooth Core Specification Version 4.0 June,
> 2010
>
> - Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2015 - 2017, 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
> @@ -38,6 +38,21 @@ typedef struct {
> UINT16 MajorServiceClass:11;
> } BLUETOOTH_CLASS_OF_DEVICE;
>
> +///
> +/// BLUETOOTH_LE_ADDRESS
> +///
> +typedef struct {
> + ///
> + /// 48-bit Bluetooth device address
> + ///
> + UINT8 Address[6];
> + ///
> + /// 0x00 - Public Device Address
> + /// 0x01 - Random Device Address
> + ///
> + UINT8 Type;
> +} BLUETOOTH_LE_ADDRESS;
> +
> #pragma pack()
>
> #define BLUETOOTH_HCI_COMMAND_LOCAL_READABLE_NAME_MAX_SIZE
> 248
> diff --git a/MdePkg/Include/Protocol/DevicePath.h
> b/MdePkg/Include/Protocol/DevicePath.h
> index aa7aec793e..220fa90765 100644
> --- a/MdePkg/Include/Protocol/DevicePath.h
> +++ b/MdePkg/Include/Protocol/DevicePath.h
> @@ -5,7 +5,7 @@
> from a software point of view. The path must persist from boot to boot, so
> it can not contain things like PCI bus numbers that change from boot to boot.
>
> -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2006 - 2017, 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 that accompanies this distribution.
> The full text of the license may be found at
> @@ -938,6 +938,15 @@ typedef struct {
> UINT8 SSId[32];
> } WIFI_DEVICE_PATH;
>
> +///
> +/// Bluetooth LE Device Path SubType.
> +///
> +#define MSG_BLUETOOTH_LE_DP 0x1E
> +typedef struct {
> + EFI_DEVICE_PATH_PROTOCOL Header;
> + BLUETOOTH_LE_ADDRESS Address;
> +} BLUETOOTH_LE_DEVICE_PATH;
> +
> //
> // Media Device Path
> //
> diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
> b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
> index 187c1cc4dc..f50c11cfa2 100644
> --- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
> +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
> @@ -2692,6 +2692,39 @@ DevPathFromTextWiFi (
> }
>
> /**
> + Converts a text device path node to Bluetooth LE device path structure.
> +
> + @param TextDeviceNode The input Text device path node.
> +
> + @return A pointer to the newly-created Bluetooth LE device path structure.
> +
> +**/
> +EFI_DEVICE_PATH_PROTOCOL *
> +DevPathFromTextBluetoothLE (
> + IN CHAR16 *TextDeviceNode
> + )
> +{
> + CHAR16 *BluetoothLeAddrStr;
> + CHAR16 *BluetoothLeAddrTypeStr;
> + BLUETOOTH_LE_DEVICE_PATH *BluetoothLeDp;
> +
> + BluetoothLeAddrStr = GetNextParamStr (&TextDeviceNode);
> + BluetoothLeAddrTypeStr = GetNextParamStr (&TextDeviceNode);
> + BluetoothLeDp = (BLUETOOTH_LE_DEVICE_PATH *) CreateDeviceNode (
> + MESSAGING_DEVICE_PATH,
> + MSG_BLUETOOTH_LE_DP,
> + (UINT16) sizeof (BLUETOOTH_LE_DEVICE_PATH)
> + );
> +
> + BluetoothLeDp->Address.Type = (UINT8) Strtoi (BluetoothLeAddrTypeStr);
> + StrHexToBytes (
> + BluetoothLeAddrStr, sizeof (BluetoothLeDp->Address.Address) * 2,
> + BluetoothLeDp->Address.Address, sizeof (BluetoothLeDp->Address.Address)
> + );
> + return (EFI_DEVICE_PATH_PROTOCOL *) BluetoothLeDp;
> +}
> +
> +/**
> Converts a text device path node to URI device path structure.
>
> @param TextDeviceNode The input Text device path node.
> @@ -3367,6 +3400,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED
> DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevP
> {L"Uri", DevPathFromTextUri },
> {L"Bluetooth", DevPathFromTextBluetooth },
> {L"Wi-Fi", DevPathFromTextWiFi },
> + {L"BluetoothLE", DevPathFromTextBluetoothLE },
> {L"MediaPath", DevPathFromTextMediaPath },
> {L"HD", DevPathFromTextHD },
> {L"CDROM", DevPathFromTextCDROM },
> diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> index f45d3dd338..b8d9491885 100644
> --- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> @@ -1660,6 +1660,43 @@ DevPathToTextWiFi (
> }
>
> /**
> + Converts a Bluetooth device path structure to its string representative.
> +
> + @param Str The string representative of input device.
> + @param DevPath The input device path structure.
> + @param DisplayOnly If DisplayOnly is TRUE, then the shorter text
> representation
> + of the display node is used, where applicable. If DisplayOnly
> + is FALSE, then the longer text representation of the display
> node
> + is used.
> + @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of
> text
> + representation for a device node can be used, where
> applicable.
> +
> +**/
> +VOID
> +DevPathToTextBluetoothLE (
> + IN OUT POOL_PRINT *Str,
> + IN VOID *DevPath,
> + IN BOOLEAN DisplayOnly,
> + IN BOOLEAN AllowShortcuts
> + )
> +{
> + BLUETOOTH_LE_DEVICE_PATH *BluetoothLE;
> +
> + BluetoothLE = DevPath;
> + UefiDevicePathLibCatPrint (
> + Str,
> + L"BluetoothLE(%02x%02x%02x%02x%02x%02x,0x%02x)",
> + BluetoothLE->Address.Address[0],
> + BluetoothLE->Address.Address[1],
> + BluetoothLE->Address.Address[2],
> + BluetoothLE->Address.Address[3],
> + BluetoothLE->Address.Address[4],
> + BluetoothLE->Address.Address[5],
> + BluetoothLE->Address.Type
> + );
> +}
> +
> +/**
> Converts a URI device path structure to its string representative.
>
> @param Str The string representative of input device.
> @@ -2191,6 +2228,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED const
> DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLib
> {MESSAGING_DEVICE_PATH, MSG_URI_DP,
> DevPathToTextUri },
> {MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_DP,
> DevPathToTextBluetooth },
> {MESSAGING_DEVICE_PATH, MSG_WIFI_DP,
> DevPathToTextWiFi },
> + {MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_LE_DP,
> DevPathToTextBluetoothLE },
> {MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP,
> DevPathToTextHardDrive },
> {MEDIA_DEVICE_PATH, MEDIA_CDROM_DP,
> DevPathToTextCDROM },
> {MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP,
> DevPathToTextVendor },
> --
> 2.12.2.windows.2
next prev parent reply other threads:[~2017-06-06 6:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-06 3:35 [PATCH v2 0/5] Add Bluetooth LE definitions per UEFI Spec 2.7 Ruiyu Ni
2017-06-06 3:35 ` [PATCH v2 1/5] MdePkg/DevicePath: Add BluetoothLe device path node support Ruiyu Ni
2017-06-06 6:42 ` Wu, Hao A [this message]
2017-06-06 3:35 ` [PATCH v2 2/5] MdePkg/BluetoothConfig: Add new EFI_BLUETOOTH_CONFIG_DATA_TYPE types Ruiyu Ni
2017-06-06 3:35 ` [PATCH v2 3/5] MdePkg/BluetoothHc: Add detailed function header comments Ruiyu Ni
2017-06-06 3:35 ` [PATCH v2 4/5] MdePkg/BluetoothIo: Formalize " Ruiyu Ni
2017-06-06 3:35 ` [PATCH v2 5/5] MdePkg: Add BluetoothAttribute.h and BluetoothLeConfig.h Ruiyu Ni
2017-06-06 4:46 ` [PATCH v2 0/5] Add Bluetooth LE definitions per UEFI Spec 2.7 Yao, Jiewen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B80AF82E9BFB8E4FBD8C89DA810C6A0931CBE2F2@SHSMSX104.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox