From patchwork Wed Feb 28 16:53:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1905922 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=KZKPDwSY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::23a; helo=mail-lj1-x23a.google.com; envelope-from=swupdate+bncbaabbkwk7wxamgqeb23ajbi@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-lj1-x23a.google.com (mail-lj1-x23a.google.com [IPv6:2a00:1450:4864:20::23a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TlL6W3Chjz23qY for ; Thu, 29 Feb 2024 03:54:11 +1100 (AEDT) Received: by mail-lj1-x23a.google.com with SMTP id 38308e7fff4ca-2d29a89434csf17940201fa.0 for ; Wed, 28 Feb 2024 08:54:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709139244; cv=pass; d=google.com; s=arc-20160816; b=ZhyTkBwEJog5ey1u2exGpooL+kZup99LCjVlWwtV3S47mTSU9ApWsUKTd9ak3M0EJe y05k9WzmGp4KVnOuFNCt5YXbkRfQc9M++FPeh+ZjYysbA35+1xX2tu1isP3XFyRuhbpu nlv/ocq3pWpEpnRmyAMYOmHU/LpP29hEXFTo7Drohd06aGg6mr021jkWlMDJep8QcyQL 5nlm8Yc1O8eem6xcrOY9F2+LY1AXQfZn6C8t8AbpXivMj+plJrwhx4XSwjXxAH1lK2Y2 n0y82Tn746CDZamVBIcvC2icv7nQNXyCiAttQoIiajoRxcim5YRSQiSxsaXLMJHBD3EA 53Mw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:ui-outboundreport:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=ivADBFFhWYwFqkPW2o88Aqookye7iE+NVHS2uPEGVao=; fh=nFlegjUere2HcfyauHJXVCWfuNJlZ/2TekafumCRgOg=; b=kBQ2REjhn3zNlmLWGhejOFhy6IKV4ua67t7TggpFvarnf/QTwD/S2QkXGQkLPsrrDw mv4IwMEznFbUVB8fGRYAeSbjTDa4vaHUVF2Ww5hGMPLoL3qiktUHqfBqJXDbSZNM+X57 2ETkbodqDZaCIg8s7a+09TZk3XbI3IMDwzfc4G1cRzxImvq/miASNCtWO/XAy+YTOFzf 2TL3sN1ZFALx5vhXnpuTGArmpu8HGZFiAGP6NzXZDT9JwFb5Lo7E+FHyvbRS/ow+l1eE 1rB8k73CV2ioYjIFx4IOt5VSLs7TChkY8gXxi3CclXSleny6N/Gh5Doq5yTyPpGMRvB5 s7kQ==; darn=patchwork.ozlabs.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=EdI9sSGW; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.135 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1709139244; x=1709744044; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:ui-outboundreport:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:from:to:cc :subject:date:message-id:reply-to; bh=ivADBFFhWYwFqkPW2o88Aqookye7iE+NVHS2uPEGVao=; b=KZKPDwSYms33+G4dRKHjrilQMCFGsGwAoZh3ore/El0gTMksM1vUBCeE3sPvta6gcc vJZs1sQj9t8eU/YyAPmtMepRME+quxbwrgB8fWQV/Ara55wc8dEnVocHVtefkazjg/uK gvAXD5S6+KrM2pg2ob4m8KiLxOo9vXvSM1nFlTY1/wjXtLq8MjltBmD3lB/T9JkX6R5m zx7Ei8YQT03HifNJpism/SWOjvEu2OY8E+Rj8E+lI67xepCOOfIaMrlWUmwOGphU65hK kF99F03Xfn/i0zAD2tWulPR7tam7ds3xivzNIeJgZ6Jmnp7IrZz+IfiHw7bBszu1/I0k bMgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709139244; x=1709744044; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender :ui-outboundreport:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:x-beenthere:x-gm-message-state:sender:from :to:cc:subject:date:message-id:reply-to; bh=ivADBFFhWYwFqkPW2o88Aqookye7iE+NVHS2uPEGVao=; b=KFNxzt5P0dpj2mP5VJp45+08Si3pxY2cTXJQBuO5Pv1PidEjV+XPa0D1FV3tQWVrOT DHq89LZEUV71/NSOlFxwg2V5WnXFa3lEZYpY5u5JiBAcx1BNzn9yzjzrzm7OjSIl+Lx3 73+uJ5NzBKzFFrYKNYrUZ2+ImlvFc4fMdGB8u+TULjywa8r0/wJsdNzHfkj4mbEBg1m1 iMyPb1ccKt+32Fzkf1wHy1BGVlpE04xKhtXl4rl9PwefYhN1cyL/12SJjIDQtyT2zq5G EyaZfPEuLeDxQnG85lVA7/NbBGcp5Dd9WWYA4zPu8EidCKXg6AogYzdJtkHIXzr7dnW5 9aDQ== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCXeejT/ArwamF75raWAUgxOzbasn7zLWlN13SJi/Tu5UTinIM9AdR7eiPRDl2IAxZohrXx40DbX9ifSonrmtehkKJ9HN6kPf7yIDnDm0A== X-Gm-Message-State: AOJu0YwJPFfHYmvJJQCKZDeFColjRF6yx8E9tBmqSVVqIwuZ8k7QZKss 8MB63ya/J8oceCOVGRLfuOe+1Bt3zYeokq9X3CT4sOKK3plSQ2jK X-Google-Smtp-Source: AGHT+IEhzYpLNCnGBaGb1YyIw0+6AYObqipufxaxzpzVG8c/gAtSIhXn3/wv4RX8UIN0HkdNAR7hVw== X-Received: by 2002:a2e:9415:0:b0:2d2:ed53:6544 with SMTP id i21-20020a2e9415000000b002d2ed536544mr18423ljh.32.1709139243348; Wed, 28 Feb 2024 08:54:03 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a2e:a4d5:0:b0:2d2:99e8:bbb8 with SMTP id p21-20020a2ea4d5000000b002d299e8bbb8ls267509ljm.1.-pod-prod-01-eu; Wed, 28 Feb 2024 08:54:01 -0800 (PST) X-Received: by 2002:a05:651c:1246:b0:2d2:b17a:1724 with SMTP id h6-20020a05651c124600b002d2b17a1724mr2617634ljh.19.1709139241268; Wed, 28 Feb 2024 08:54:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709139241; cv=none; d=google.com; s=arc-20160816; b=HJsGZniDqh+4r8ZS40iDc7BEa/JQK5APL5L+7cm3pVONwKeQeSPdNChD7U3eumQPP6 EV+9rsURjDa6US68443ljCoa4xdQaVR/MaxAkjhIxrgjLAu5g5POzidFatUHhmcpoV8I UqgPZqjV6AkqLZlCD7igFagHtbVULp6ZbVtnLLPOIldO/E8LjlWyvPikc5jaB+y8mXdg aJ7imEJWvF/SGSESi2rEK82PMvHPJDa5nmkbPwLBJcpmuQipn80t07salceK4TG9XwFP 1DhIDKJaoQJ9XeKXMCVmCVkvEyDpS931wBCw9RdEPO9GEwAaYLFjuBsRg0Cj0hQl5p9u Au7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=vXLsQGS1MenIVfWWuROqEFmHG01iEP4dHMkl+SaAvnM=; fh=TiEWcqMcKpHk5s7uErzpntoONrNfOXwKpI5P8bIlggk=; b=DcuA4+zqR7gbSLpRzqslw4Vh3RWmxEnxJJUUp447JSx5uLEwfzTA5J6ew2OSDYgS42 /3WgyJ/FvH9GM358YzdMdLJ56S63SfIbJEezEsgK/zDydfPdUXfsSbQGqUoaIAlPngVY q1wAmz0jPjAEVNhVpFhe4NbeGUhFn8vvmF0grvXajVGSqvBF0O9SaV+q1siYt1NLiakh kY6T62DAvcHIyypJu9ERfvK18UL6krR/riiZQKRyJfYudftfyVJ8ryb5Tn7YuoLOX/A8 0vZhHb8SJKks8xKjCF0Dnf3XrfltHIkw36A0XRivpGpTDQcTSoYZgP6hujrkbPDnurhU dmMA==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=EdI9sSGW; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.135 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.126.135]) by gmr-mx.google.com with ESMTPS id h5-20020a05600c350500b00412ae42bfa1si168594wmq.1.2024.02.28.08.54.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 08:54:01 -0800 (PST) Received-SPF: pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.135 as permitted sender) client-ip=212.227.126.135; X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from paperino.fritz.box ([88.217.136.221]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MUGuZ-1rVeA72bn1-00RKcI; Wed, 28 Feb 2024 17:54:00 +0100 From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 2/2] Lua: add function emmcbootpart Date: Wed, 28 Feb 2024 17:53:56 +0100 Message-Id: <20240228165356.3993592-2-stefano.babic@swupdate.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240228165356.3993592-1-stefano.babic@swupdate.org> References: <20240228165356.3993592-1-stefano.babic@swupdate.org> MIME-Version: 1.0 X-Provags-ID: V03:K1:IJYlOUUQSX2aOvVQ0hlD58aiUdHUq4ocajWGx/JHSfMKvd14/XX ZqEaEo5BXGrN86N99d5w6CWwtMi5aVnv1n2FJNXtGMOe/C7nc2kutI+a+Yd1GYDpa1SUgW1 qw3EwD07hwfzqLrJcpFcAYgmSdd2nxGN515BA4dcWBMTWvwXBrAagM4Vf/STVLoNb/qCaKJ Wds5iUP8dxdCFEvATogjw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:e9R1S6b809U=;vydi4sMiN/7io3Rgppqpuyel3Oq xYy+yhb09jg/YTmaCBkxYc90wcCaaiMUr8WTBNCiE23+VUiKBigMTap92VkYbOL560XFaYGrb jXX5HVTCRUZy/wXuf/Xl8FjNtvxSTP3fRI9xmMbk0I1+3jb+DFJ9ptSfYX96QHeJz7Ua3Ixs1 JsyUOhnvoiGAf4sl7JqjRZ8oemRHZjjY+tFtrUxwc+bOAh1cD02KwzZP24EiWa/CGx2iZOnVv kBuqAdWq0rTwz7RiX7sgAg4lC7AsTzjz+dD8vcFiXU/Byowt4/cAiKtE23fD1KjKCvlYlzua7 YfVDoepMUctTUOuERJda8ivNPbqGzVRLzNu/CWa+XhVpAQOwflT1RurL4reAUEotMDjRWexIh FZeugCU8KHnnazLT1bIUJU9GcnAvek8LrXu2mH/aCy5djpL/R0PG5rwLx0fHVv6TJyb3sRIiV zaulzt5valah3SkLIRxYky4nfLvKq+md8mDUjoI9NcChshGfh+aRKQVk5yWbdpVJIVs4TyWAW 4HJVhJiC7msO7C4dOho5zvRQWMJfkD2SES3gjDRow94/ePGWhzMZB1RCFgjr3n0qNIwz2PuFe 6HOY7Uun9HvlM3/zKmSWfUbIRa9ibROK1LskuN5XAUacfVAdY0FhLu+Bo8rlma3hNEfAqU9A4 95WCAyqi4nu3UGYmEFbgKmswl0oQ6twMNsw8f69KXRi7mfZHlgNyIYUl6/evPPV/Ld2EUy5yM aePohkPbRzbvL1+dmChEzn49+0R7C3gCpFuNmwEzfKbMFsNtR+34WQ= X-Original-Sender: stefano.babic@swupdate.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=EdI9sSGW; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.135 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Function returns the HW boot device of an eMMC. Signed-off-by: Stefano Babic --- Changes since V1: - no changes corelib/lua_interface.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) -- 2.34.1 diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c index de3b8702..a9e30b33 100644 --- a/corelib/lua_interface.c +++ b/corelib/lua_interface.c @@ -967,6 +967,22 @@ l_get_hw_exit: return 1; } +static int l_get_emmc_bootpart(lua_State *L) +{ + const char *device = luaL_checkstring(L, 1); + int active = -1, fd; + + if (device) { + fd = open(device, O_RDONLY); + if (fd) { + active = emmc_get_active_bootpart(fd); + close(fd); + } + } + lua_pushinteger(L, active); + return 1; +} + static void lua_push_enum(lua_State *L, const char *name, int value) { lua_pushstring(L, name); @@ -1188,6 +1204,7 @@ static const luaL_Reg l_swupdate[] = { { "get_hw", l_get_hw }, { "getversion", lua_get_swupdate_version }, { "progress", lua_notify_progress }, + { "emmcbootpart", l_get_emmc_bootpart }, { NULL, NULL } };