From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 C3ABF21A16ECF for ; Fri, 26 May 2017 21:29:36 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP; 26 May 2017 21:30:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,400,1491289200"; d="scan'208";a="1153454925" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga001.fm.intel.com with ESMTP; 26 May 2017 21:30:32 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 26 May 2017 21:30:31 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 26 May 2017 21:30:31 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.151]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.5]) with mapi id 14.03.0319.002; Sat, 27 May 2017 12:30:26 +0800 From: "Ni, Ruiyu" To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: "Kinney, Michael D" , "Gao, Liming" Thread-Topic: [PATCH] MdePkg/DevicePathLib: Reverse the byte order of BD_ADDR for Bluetooth Thread-Index: AQHS1pF7X+GM/0luwUGDBITIzSfXvqIHljPw Date: Sat, 27 May 2017 04:30:25 +0000 Deferred-Delivery: Sat, 27 May 2017 04:29:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5B969078@SHSMSX104.ccr.corp.intel.com> References: <20170527023151.11912-1-hao.a.wu@intel.com> In-Reply-To: <20170527023151.11912-1-hao.a.wu@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdePkg/DevicePathLib: Reverse the byte order of BD_ADDR for Bluetooth 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: Sat, 27 May 2017 04:29:37 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ruiyu Ni Thanks/Ray > -----Original Message----- > From: Wu, Hao A > Sent: Saturday, May 27, 2017 10:32 AM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A ; Ni, Ruiyu ; > Kinney, Michael D ; Gao, Liming > > Subject: [PATCH] MdePkg/DevicePathLib: Reverse the byte order of > BD_ADDR for Bluetooth >=20 > For the following two functions: > DevPathFromTextBluetooth() > DevPathToTextBluetooth() >=20 > The Bluetooth device address "UINT8 Address[6]" is displayed with the > order from Address[5] to Address[0]. This commit reverses the order. >=20 > Cc: Ruiyu Ni > Cc: Michael D Kinney > Cc: Liming Gao > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Hao Wu > --- > MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c | 37 ++++++------ > -------- > MdePkg/Library/UefiDevicePathLib/DevicePathToText.c | 12 +++---- > 2 files changed, 17 insertions(+), 32 deletions(-) >=20 > diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c > b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c > index 4322b6c0f2..187c1cc4dc 100644 > --- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c > +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c > @@ -2635,35 +2635,20 @@ DevPathFromTextBluetooth ( > ) > { > CHAR16 *BluetoothStr; > - CHAR16 *Walker; > - CHAR16 *TempNumBuffer; > - UINTN TempBufferSize; > - INT32 Index; > BLUETOOTH_DEVICE_PATH *BluetoothDp; >=20 > BluetoothStr =3D GetNextParamStr (&TextDeviceNode); > - BluetoothDp =3D (BLUETOOTH_DEVICE_PATH *) CreateDeviceNode ( > - MESSAGING_DEVICE_PATH, > - MSG_BLUETOOTH_DP, > - (UINT16) sizeof (BLUETOOTH_DEVICE_PAT= H) > - ); > - > - Index =3D sizeof (BLUETOOTH_ADDRESS) - 1; > - Walker =3D BluetoothStr; > - while (!IS_NULL(*Walker) && Index >=3D 0) { > - TempBufferSize =3D 2 * sizeof(CHAR16) + StrSize(L"0x"); > - TempNumBuffer =3D AllocateZeroPool (TempBufferSize); > - if (TempNumBuffer =3D=3D NULL) { > - break; > - } > - StrCpyS (TempNumBuffer, TempBufferSize / sizeof (CHAR16), L"0x"); > - StrnCatS (TempNumBuffer, TempBufferSize / sizeof (CHAR16), Walker, 2= ); > - BluetoothDp->BD_ADDR.Address[Index] =3D (UINT8)Strtoi > (TempNumBuffer); > - FreePool (TempNumBuffer); > - Walker +=3D 2; > - Index--; > - } > - > + BluetoothDp =3D (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; > } >=20 > diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c > b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c > index 87eca23526..f45d3dd338 100644 > --- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c > +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c > @@ -2,7 +2,7 @@ > DevicePathToText protocol as defined in the UEFI 2.0 specification. >=20 > (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
> -Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
> +Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the BS= D > License > which accompanies this distribution. The full text of the license may b= e > found at > @@ -1618,12 +1618,12 @@ DevPathToTextBluetooth ( > UefiDevicePathLibCatPrint ( > Str, > L"Bluetooth(%02x%02x%02x%02x%02x%02x)", > - Bluetooth->BD_ADDR.Address[5], > - Bluetooth->BD_ADDR.Address[4], > - Bluetooth->BD_ADDR.Address[3], > - Bluetooth->BD_ADDR.Address[2], > + Bluetooth->BD_ADDR.Address[0], > Bluetooth->BD_ADDR.Address[1], > - Bluetooth->BD_ADDR.Address[0] > + Bluetooth->BD_ADDR.Address[2], > + Bluetooth->BD_ADDR.Address[3], > + Bluetooth->BD_ADDR.Address[4], > + Bluetooth->BD_ADDR.Address[5] > ); > } >=20 > -- > 2.12.0.windows.1