Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6769623ybi; Mon, 8 Jul 2019 08:22:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqzlnHrNvJZupFhypCYyEm2e6E1f/dD8nIK0N1dd/tD88f95FKtNn/RQWtZ4sDGodwRLJd5T X-Received: by 2002:a65:5c0a:: with SMTP id u10mr24991806pgr.412.1562599335472; Mon, 08 Jul 2019 08:22:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562599335; cv=none; d=google.com; s=arc-20160816; b=1F3CmIUNiqxyz8hSFYs/31fb0hZ9r/A5PPD4aYk5JZYrnwdkZX8DRptoXfpm10la95 SVufvPZkZCEhsLVbQQgV0Tj+37smBfSgXcOsGfKvftffC4xojpsHROYXpfUZ8orr5WVs zeHlL8Q03T+bmyUyzCaUz9Jch1IS2Gi6iBuOwV3Hja/MttkRhwfLP9bU8Z2/JWvRKrxl pVNvz5S58ATx61WCgYEwA7gkDhpUI8g+42+8ejXP6j+TCxJHdLhmj7vDLGwLS8MbtXWW y9qJaLLo9oPbLp2MybySvcuIB8KxyqMMbD5v7QtjPIaPShmzahFOE4v07E+EqRMm/T4Q yuAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=DZx/5bVcRf+XCGU8J5dnHUVoJ32o+oGqi4k1uE8vMXo=; b=VCCqk9XtzFDRR32IyT8RKR31moL2Qne1Y6p73PCahb7UojNpv7AxJawuExV/ndNyNu 2lPjmNq30IwUNxexo6Zl2OglJJmG2ypxQdSix+NetJpDqU1lYi8PkaHlbuYO5tmK63uf SINr1gMwmaby8taSSovKCwvuYE9pebm+Pz00XLjWtEj3PXp80M+B6gNDI4P81SVQjQ0v kw+v81pbgTOD6HshfvqWiCNGLiFLjw9iBxZ+k7HWpNDyT1qEM5wR1+d4k8KbJwS2M338 hAirMYFsEJ4/x/NFUu3XKikcrJWCuJ14STnL6RFkawkVnJIjyjc28S0She+rbCzr5xwn x0EA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c4si19870314pfn.71.2019.07.08.08.22.00; Mon, 08 Jul 2019 08:22:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731094AbfGHNJL convert rfc822-to-8bit (ORCPT + 99 others); Mon, 8 Jul 2019 09:09:11 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:58144 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731110AbfGHNJL (ORCPT ); Mon, 8 Jul 2019 09:09:11 -0400 Received: from [192.168.0.77] (apn-37-247-209-172.dynamic.gprs.plus.pl [37.247.209.172]) by mail.holtmann.org (Postfix) with ESMTPSA id 0A0AFCF18A; Mon, 8 Jul 2019 15:17:42 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: [PATCH] Fix endianness bug in hci_core.c From: Marcel Holtmann In-Reply-To: Date: Mon, 8 Jul 2019 15:09:08 +0200 Cc: linux-bluetooth@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: <167BCA9E-1BBD-48D9-965B-97AD49A2FB5C@holtmann.org> References: To: Andrey Batyiev X-Mailer: Apple Mail (2.3445.104.11) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Andrey, > I'm using Linux on big endian CPU (one of MIPS-based home routers). > Also, I'm trying to use Cypress CYW20704A2 USB-Bluetooth dongle on it. > However, `hciconfig hci0 up` failed, and `btmon` showed very specific problem: > > > > < HCI Command: LE Write Suggested Default Data Length (0x08|0x0024) plen 4 > TX octets: 64256 > TX time: 18440 >> HCI Event: Command Complete (0x0e) plen 4 > LE Write Suggested Default Data Length (0x08|0x0024) ncmd 1 > Status: Invalid HCI Command Parameters (0x12) > > > > After comparing with similar log on the Linux desktop (where TX octets > value is `251`), I came to conclusion that it's an endianness problem, > therefore here is a patch that fixes it. > > Thanks, > Andrey > > --- linux-4.14.104-old/net/bluetooth/hci_core.c 2019-07-07 > 23:39:44.069862824 +0000 > +++ linux-4.14.104/net/bluetooth/hci_core.c 2019-07-07 > 22:43:21.291838543 +0000 > @@ -802,8 +802,8 @@ > if (hdev->le_features[0] & HCI_LE_DATA_LEN_EXT) { > struct hci_cp_le_write_def_data_len cp; > > - cp.tx_len = hdev->le_max_tx_len; > - cp.tx_time = hdev->le_max_tx_time; > + cp.tx_len = cpu_to_le16(hdev->le_max_tx_len); > + cp.tx_time = cpu_to_le16(hdev->le_max_tx_time); > hci_req_add(req, HCI_OP_LE_WRITE_DEF_DATA_LEN, sizeof(cp), &cp); > } good catch, but please send a git-format-patch created patch. And following the submitting patches guide. Thanks. Regards Marcel