From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8950821AE30D0 for ; Mon, 5 Jun 2017 23:41:53 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jun 2017 23:42:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,305,1493708400"; d="scan'208";a="96024397" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga002.jf.intel.com with ESMTP; 05 Jun 2017 23:42:59 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 5 Jun 2017 23:42:59 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 5 Jun 2017 23:42:58 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.151]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.116]) with mapi id 14.03.0319.002; Tue, 6 Jun 2017 14:42:57 +0800 From: "Wu, Hao A" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH v2 1/5] MdePkg/DevicePath: Add BluetoothLe device path node support Thread-Index: AQHS3nYA4OBXzLjQ50OK9bIeY9pHO6IXYy4w Date: Tue, 6 Jun 2017 06:42:56 +0000 Message-ID: References: <20170606033543.254936-1-ruiyu.ni@intel.com> <20170606033543.254936-2-ruiyu.ni@intel.com> In-Reply-To: <20170606033543.254936-2-ruiyu.ni@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v2 1/5] MdePkg/DevicePath: Add BluetoothLe device path node support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jun 2017 06:41:53 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Hao Wu 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 no= de > support >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ruiyu Ni > Cc: Hao A Wu > --- > 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(-) >=20 > 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 driv= ers. > These definitions are from Bluetooth Core Specification Version 4.0 Ju= ne, > 2010 >=20 > - Copyright (c) 2015, Intel Corporation. All rights reserved.
> + Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
> 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; >=20 > +/// > +/// 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() >=20 > #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 t= o boot. >=20 > -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
> This program and the accompanying materials are licensed and made availa= ble > under > the terms and conditions of the BSD License that accompanies this distri= bution. > The full text of the license may be found at > @@ -938,6 +938,15 @@ typedef struct { > UINT8 SSId[32]; > } WIFI_DEVICE_PATH; >=20 > +/// > +/// 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 ( > } >=20 > /** > + 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 struct= ure. > + > +**/ > +EFI_DEVICE_PATH_PROTOCOL * > +DevPathFromTextBluetoothLE ( > + IN CHAR16 *TextDeviceNode > + ) > +{ > + CHAR16 *BluetoothLeAddrStr; > + CHAR16 *BluetoothLeAddrTypeStr; > + BLUETOOTH_LE_DEVICE_PATH *BluetoothLeDp; > + > + BluetoothLeAddrStr =3D GetNextParamStr (&TextDeviceNode); > + BluetoothLeAddrTypeStr =3D GetNextParamStr (&TextDeviceNode); > + BluetoothLeDp =3D (BLUETOOTH_LE_DEVICE_PATH *) CreateDeviceNode ( > + MESSAGING_DEVICE_PATH, > + MSG_BLUETOOTH_LE_DP, > + (UINT16) sizeof (BLUETO= OTH_LE_DEVICE_PATH) > + ); > + > + BluetoothLeDp->Address.Type =3D (UINT8) Strtoi (BluetoothLeAddrTypeStr= ); > + StrHexToBytes ( > + BluetoothLeAddrStr, sizeof (BluetoothLeDp->Address.Address) * 2, > + BluetoothLeDp->Address.Address, sizeof (BluetoothLeDp->Address.Addre= ss) > + ); > + return (EFI_DEVICE_PATH_PROTOCOL *) BluetoothLeDp; > +} > + > +/** > Converts a text device path node to URI device path structure. >=20 > @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 ( > } >=20 > /** > + Converts a Bluetooth device path structure to its string representativ= e. > + > + @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 o= f the display > node > + is used. > + @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut fo= rms of > text > + representation for a device node can be used, w= here > applicable. > + > +**/ > +VOID > +DevPathToTextBluetoothLE ( > + IN OUT POOL_PRINT *Str, > + IN VOID *DevPath, > + IN BOOLEAN DisplayOnly, > + IN BOOLEAN AllowShortcuts > + ) > +{ > + BLUETOOTH_LE_DEVICE_PATH *BluetoothLE; > + > + BluetoothLE =3D 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. >=20 > @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