Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1612660rwb; Fri, 7 Oct 2022 15:39:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4F4MV8FPazMOLfEP9rxsBBKUCRmQcO5ixgZRR2QoB1GBdndFNB69iokmcRZW39cRze95+A X-Received: by 2002:a17:902:8bc2:b0:17f:5908:9a01 with SMTP id r2-20020a1709028bc200b0017f59089a01mr7007830plo.133.1665182342031; Fri, 07 Oct 2022 15:39:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665182342; cv=none; d=google.com; s=arc-20160816; b=c9NMFccs/3Ix3V696HOBkGi8nzFF/c6guOSeMwAvLHcAEobtrAPg8jR/k0Z4K9867s ejxzcajBoTKhz7wS319KmfPVV4Mi0fMYyFHf41wECNaWko0megpqF8EcMXAgYtZmXpss /+LMzacJLZetDpMdzCsg5pJlRWYn5fNgLVlY5qPjsmr5/JFHQLI8bo0TmbHTa2NLSFoN K7MkJ2USCx3t7vibXd/QSHzPk5OnM4K8wSt+r/LvbhmaTEj4EGzYe2eKiLKcMCO7K1oJ aLKTsGjuiF8hqA9W27/UHFjhU93p+7wKwBNXUk5D2MrqrSI25QehC9bbyUmgh5H51OwU TOBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=aWZTAG1Eih+DouCQoHVwsrrhAQjYzIpkDznjhxpWO28=; b=ppj2SMaSlzgdczyOZuw3eR+71l1uBHdI+PfGAYQeNhTSTn2bCT4tqsG36dUEjbwf3G +lHtotg8r7ku0tUGsplhs2kboyfFtl8kcM29BnCmMT5IyVHHNrw4zX+YA3i347yafxd9 uaMuWU26Wvf129Dcuv/wtjrYGAvDsPVCiAA56QLaq+5sqmuXUUYcPevKRtsz+FJHkM0g VZccwBPpeuiUewzcX3Yiu+vosVUlIhlaRbwfcKE4P7t7FfTSq/TJaStrGJVvBXmxzRGb qPgIODCOQ0Ki2OwGJYvLqKbSoaAikbtp5cBvSCT90ivg8Zc1J6w5m5GYhBTVWTWe4O/q 4v0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=J3DhTy+Z; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ch7-20020a17090af40700b00205b268cd58si8355355pjb.181.2022.10.07.15.38.34; Fri, 07 Oct 2022 15:39:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=J3DhTy+Z; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229506AbiJGWh5 (ORCPT + 99 others); Fri, 7 Oct 2022 18:37:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbiJGWh4 (ORCPT ); Fri, 7 Oct 2022 18:37:56 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AA0D9F744 for ; Fri, 7 Oct 2022 15:37:55 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id a5-20020a17090aa50500b002008eeb040eso7778056pjq.1 for ; Fri, 07 Oct 2022 15:37:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=aWZTAG1Eih+DouCQoHVwsrrhAQjYzIpkDznjhxpWO28=; b=J3DhTy+ZS7HhwoiBXHDJDSQoZj+PhAEiN7H6R+WRQsxaKQtKMkD0fFXonr1+iwLL9k Y0efiqAs53zhQ4RY3/xXeoXP5NjENvCg5F/+EKPG+KUqufdclziCRn7bfTlrpTeEzNUA eE4a4UcDwtTtB4Tc63U2DElSCmKwt18PZUdC8wnHzWZJnL4Ns448vRfsvVDwFPKQhMI0 GVSzySt292VlyKkiFcQRHJcYWKWgGfHp9mQHqIN23CTSLoQpwo1wsc8LeIkKdrboGPpy VP29G8BuhGG20doFcv/PPxd0q9qAy+Q81Xn9rWXQkq21Lab8ijR0EqI7Ynxa02ZrjtwM pwdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aWZTAG1Eih+DouCQoHVwsrrhAQjYzIpkDznjhxpWO28=; b=JUaFLegg6FuJh2EjHFZv+un/e3laVsrHqkim43FBXrxTZ543Z2EVHCvvJVge9+XqCL DHT2MTSK29eY+UlCHLeE6urm5CSaV/Gb7BjFfQX6SAP+4QhC4ZEZs0IFRky8ViL9k+9y ufzES02S0DjV5A5oII5T+J86/xwPAuCzspPnbZwTICvJtbfobZsrXsdncsgyyyr0UOT3 Kbq+2B7U8esExRrWpmeG7nNFCdqbwSrti3pXh+Tn0yOMChCkyAuFTF2NuV2bHPuslTfZ 4Wt6JJAYU57eEUWsYVWoK9XZlFTnZfvVNtb43CwR71j/RguoAqgMXSoCX/FWW+S5znmQ jRGQ== X-Gm-Message-State: ACrzQf27rfZdj6qVhqkTpU4Z7rycZvGPkc4ks/PwuzXmB+FOMKnzXEsA YzOvELTk1I18zG0Eb4waBl+um/uMPr0= X-Received: by 2002:a17:90b:4d0e:b0:1f7:ae99:4d7f with SMTP id mw14-20020a17090b4d0e00b001f7ae994d7fmr18419098pjb.200.1665182274056; Fri, 07 Oct 2022 15:37:54 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id z6-20020a170902d54600b00178af82a08dsm1991647plf.91.2022.10.07.15.37.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Oct 2022 15:37:53 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ] btdev: Add support for setting bdaddr Date: Fri, 7 Oct 2022 15:37:51 -0700 Message-Id: <20221007223751.1832559-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This adds btdev_set_bdaddr so it is possible to set an arbritrary address. --- emulator/btdev.c | 10 ++++++++++ emulator/btdev.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/emulator/btdev.c b/emulator/btdev.c index 3fdfb64a9eba..549f93645684 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -6960,6 +6960,16 @@ const uint8_t *btdev_get_bdaddr(struct btdev *btdev) return btdev->bdaddr; } +bool btdev_set_bdaddr(struct btdev *btdev, const uint8_t *bdaddr) +{ + if (!btdev || !bdaddr) + return false; + + memcpy(btdev->bdaddr, bdaddr, sizeof(btdev->bdaddr)); + + return true; +} + uint8_t *btdev_get_features(struct btdev *btdev) { return btdev->features; diff --git a/emulator/btdev.h b/emulator/btdev.h index 228bf205cf4b..cad5f699f801 100644 --- a/emulator/btdev.h +++ b/emulator/btdev.h @@ -72,6 +72,8 @@ bool btdev_set_debug(struct btdev *btdev, btdev_debug_func_t callback, void *user_data, btdev_destroy_func_t destroy); const uint8_t *btdev_get_bdaddr(struct btdev *btdev); +bool btdev_set_bdaddr(struct btdev *btdev, const uint8_t *bdaddr); + uint8_t *btdev_get_features(struct btdev *btdev); uint8_t btdev_get_scan_enable(struct btdev *btdev); -- 2.37.3