Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2663166rdb; Mon, 12 Feb 2024 12:02:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW/Q45sswvj7yX2iiZZ8poLoiFPaerLOM3/5pahyOXmFgjNiOvJpu2N9fem9dkdeKRbaexs5zqwnCikC6aWT55W6pEanDnRiw+KJMNNGA== X-Google-Smtp-Source: AGHT+IF10awWyKiSiaNoZ+u4Rd3CmcXNLDypR0QBPadCj8F19e534SZopvWYVTlgjcNuITetsMie X-Received: by 2002:a05:6402:554:b0:561:ec8c:35d9 with SMTP id i20-20020a056402055400b00561ec8c35d9mr116759edx.14.1707768179731; Mon, 12 Feb 2024 12:02:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707768179; cv=pass; d=google.com; s=arc-20160816; b=apZhLQtgfDujEbtKsuo5aQLz3RyAseu/iWKTMluDIcAEDH6BaHAUAXbxU5r0ZAsPWl RNzF5m/frlpUESurhqbSh5QvOCcGRz+/jupzAfuuSmcBNYAx2RpYk0Uu1MPK2HI5tADV pR4TXwULOcfxzI8feQb02WSXlmTaWKBIxntV2Zf5aYICmYzLkpeUtKgtTJNZHvuDaiGN 1zcA88zxB4lig7l4BkTHHMx2K1fLzfWgsN6YyccIeM47bqO3fO/tuQMMgBiyA7GS8Zt6 MnuveSasbGRvkEkCUqiOT0d39Dz6O/p40oSI7HSoNbP7vPQ6b9tDtFYBlO9pkQY3iuhh tHnA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:date:from:dkim-signature; bh=MttUzMP7uQo6SjGFA+IQFfQ8QSdBFyjKsciA35gE0no=; fh=PXzMELv+E9pVp9MY+ylCgSwJz8GLl949YUdnG0guRQg=; b=CaFydVZ8j4HQ0PUl8s7JGIfH+Rrt3+peQvNPhN3Z6jdKfG+Lc2DYsDIRhm+6hoSd+U GxxIAgQeUeA7VPKdQgT48EDc8cEVntJbRJylw+1Pp6mmv7PJXNGC1NMwktFCQy9WUpsE 4lC7qFaK+SkUSP19djPBpArvitSisQVbFjbcH85Un83jauTHOWJG3lz3PDA4XP+ky5yV nTsrrFoueE9Wq05JcX+DiudyPuWs9gdeRHGUjrAoRbPTp1dro/och2gE7F52MuRk21/V Jr9R9+veaCx6DtkMvRLe+FpMj2ke/9918pgI6GeImRUlxXCx/cNWM6RlX0bLgXMZBoRZ 0qaQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="RY/keaxP"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-bluetooth+bounces-1790-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1790-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCV4293rk/MwyGKEKuDLAjsFQmZBF9uGUlzCyGAiinViLbD1gF87d+fQNDjgFHxpVaGNEVvJas6119ec6kzIOHqzbdeA1mtAhhW3Dsbz2Q== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d4-20020a50ea84000000b0056175cdfeb0si2571061edo.14.2024.02.12.12.02.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 12:02:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-1790-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="RY/keaxP"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-bluetooth+bounces-1790-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1790-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 505571F239BD for ; Mon, 12 Feb 2024 20:02:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED06647F45; Mon, 12 Feb 2024 20:02:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RY/keaxP" X-Original-To: linux-bluetooth@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59F5947A73 for ; Mon, 12 Feb 2024 20:02:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707768160; cv=none; b=XBHooj0cbjYE1ivXgW1l0qm7/df3f7l8tDP66ZQVPoTnMNLnI3Ikg/vUXBbti6AZ2TryjikPAmtfy8WYzA27EbLLVEjw/hbohakLk8jGEAzEohwxXrb40193aN5RKx0agGFoLJ983Awus0dInCkmS+SmgVjE1l1aAXbK85HxO9k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707768160; c=relaxed/simple; bh=VRgZPdA6D+8hoZ3UC+OUGz8Kti/bsHC2kA8oXFsh0lo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dt/NqIdwxcB/nWyfPao5RVVrxdYgW1wTcnC0LTwEZ0qJM+jDBzeHYbK+iFdg4FQEcydFerTVtAYkcTraDHTsdYRgqueQYbiPv04qp/ohBrwFvIIQ5uoiMY3kzXPe1rkwbda9dq/AUzCsBabGcFPT8gVE1gimcEEaFth27eEqINE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RY/keaxP; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id F2574C43399; Mon, 12 Feb 2024 20:02:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707768160; bh=VRgZPdA6D+8hoZ3UC+OUGz8Kti/bsHC2kA8oXFsh0lo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=RY/keaxPxOO1xgdxbT+BAldn1umHmQXb7d+6oIh9hFMj23nOJ/nqJ3X54cmV2RbUP bh5yqTJci8NVZNlVZ090K8HzRuSTaFa/YY56Tek4xajyZViqKFxfDIICdlGgriFifY FdANXmWEqJezvNi1wAqc1krUxB/BAIE48QYxPpi/f1hhvlcG/mIvF9Ak/t1HG1r0VS v0FsOhLHcTDDDo+IuKpAkzgE2knjLM+7WqB1j9zfiiEcgRtYH+qa/WVW231jEvfq6i ltZ6alEsxBghTG+anmGEHs14WEC8dcKqHIfHjhUKn5SaZPauVKZP4AZ4TmSjEiiqN2 0a+/oPyLsRR0g== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCEDCC48BC4; Mon, 12 Feb 2024 20:02:39 +0000 (UTC) From: Emil Velikov via B4 Relay Date: Mon, 12 Feb 2024 20:02:40 +0000 Subject: [PATCH BlueZ v2 04/10] profiles: remove unused suspend-dummy.c Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240212-disto-patches-v2-4-8bab1bd08f4d@gmail.com> References: <20240212-disto-patches-v2-0-8bab1bd08f4d@gmail.com> In-Reply-To: <20240212-disto-patches-v2-0-8bab1bd08f4d@gmail.com> To: linux-bluetooth@vger.kernel.org Cc: Emil Velikov , Nobuhiro Iwamatsu X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1707768157; l=4509; i=emil.l.velikov@gmail.com; s=20230301; h=from:subject:message-id; bh=O5urzcyyiP0SFKs5VIgx4wp/q8Y+jAMqWGPzk079OjY=; b=Uru47TI0PMzfQvm0Ttb61J+M5i54qWShbtOynQf7AixSdF6TK/Gs8ZP3KxsTV8XSjdylWK0B2 G4haOgSVxLmBZhC9T3KYvCT8EkUBRsRo2cpdk3YzfDKQx1gHev/MLiQ X-Developer-Key: i=emil.l.velikov@gmail.com; a=ed25519; pk=qeUTVTNyI3rcR2CfNNWsloTihgzmtbZo98GdxwZKCkY= X-Endpoint-Received: by B4 Relay for emil.l.velikov@gmail.com/20230301 with auth_id=35 X-Original-From: Emil Velikov Reply-To: From: Emil Velikov The file has been used for about 8 years now - see commit fb55b7a6ab48c4f782b16030e051029bcfa93e07 ("profiles/hog: Use no suspend support instead of the dummy FIFO"). Inspired by a Debian patch by Nobuhiro Iwamatsu, which was changing the /tmp/hogsuspend socket patch to /run. Looking through the codebase we have a few more sockets that could use a to /run fix, but that will follow-up at another day. Cc: Nobuhiro Iwamatsu --- Makefile.plugins | 2 - profiles/input/suspend-dummy.c | 149 ----------------------------------------- 2 files changed, 151 deletions(-) diff --git a/Makefile.plugins b/Makefile.plugins index 7cf66fd59..e960eedea 100644 --- a/Makefile.plugins +++ b/Makefile.plugins @@ -74,8 +74,6 @@ builtin_sources += profiles/input/hog.c \ profiles/battery/bas.c profiles/battery/bas.h \ profiles/scanparam/scpp.c profiles/scanparam/scpp.h \ profiles/input/suspend.h profiles/input/suspend-none.c - -EXTRA_DIST += profiles/input/suspend-dummy.c endif if HEALTH diff --git a/profiles/input/suspend-dummy.c b/profiles/input/suspend-dummy.c deleted file mode 100644 index ea1835e0f..000000000 --- a/profiles/input/suspend-dummy.c +++ /dev/null @@ -1,149 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - * Copyright (C) 2012 Nordic Semiconductor Inc. - * Copyright (C) 2012 Instituto Nokia de Tecnologia - INdT - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "src/log.h" -#include "suspend.h" - -#define HOG_SUSPEND_FIFO "/tmp/hogsuspend" - -static suspend_event suspend_cb = NULL; -static resume_event resume_cb = NULL; -static guint watch = 0; - -static int fifo_open(void); - -static gboolean read_fifo(GIOChannel *io, GIOCondition cond, gpointer user_data) -{ - char buffer[12]; - gsize offset, left, bread; - GIOStatus iostatus; - - if (cond & (G_IO_ERR | G_IO_HUP)) { - /* - * Both ends needs to be open simultaneously before proceeding - * any input or output operation. When the remote closes the - * channel, hup signal is received on this end. - */ - fifo_open(); - return FALSE; - } - - offset = 0; - left = sizeof(buffer) - 1; - memset(buffer, 0, sizeof(buffer)); - - do { - iostatus = g_io_channel_read_chars(io, &buffer[offset], left, - &bread, NULL); - - offset += bread; - left -= bread; - if (left == 0) - break; - } while (iostatus == G_IO_STATUS_NORMAL); - - if (g_ascii_strncasecmp("suspend", buffer, 7) == 0) - suspend_cb(); - else if (g_ascii_strncasecmp("resume", buffer, 6) == 0) - resume_cb(); - - return TRUE; -} - -static int fifo_open(void) -{ - GIOCondition condition = G_IO_IN | G_IO_ERR | G_IO_HUP; - GIOChannel *fifoio; - int fd; - - fd = open(HOG_SUSPEND_FIFO, O_RDONLY | O_NONBLOCK); - if (fd < 0) { - int err = -errno; - error("Can't open FIFO (%s): %s(%d)", HOG_SUSPEND_FIFO, - strerror(-err), -err); - return err; - } - - fifoio = g_io_channel_unix_new(fd); - g_io_channel_set_close_on_unref(fifoio, TRUE); - - watch = g_io_add_watch(fifoio, condition, read_fifo, NULL); - - g_io_channel_unref(fifoio); - - return 0; -} - -int suspend_init(suspend_event suspend, resume_event resume) -{ - struct stat st; - int ret; - - DBG(""); - - suspend_cb = suspend; - resume_cb = resume; - - if (stat(HOG_SUSPEND_FIFO, &st) == 0) { - if (!S_ISFIFO(st.st_mode)) { - error("Unexpected non-FIFO %s file", HOG_SUSPEND_FIFO); - return -EIO; - } - - if (unlink(HOG_SUSPEND_FIFO) < 0) { - int err = -errno; - error("Failed to remove FIFO (%s): %s (%d)", - HOG_SUSPEND_FIFO, strerror(-err), -err); - return err; - } - } - - if (mkfifo(HOG_SUSPEND_FIFO, 0600) < 0) { - int err = -errno; - - error("Can't create FIFO (%s): %s (%d)", HOG_SUSPEND_FIFO, - strerror(-err), -err); - return err; - } - - DBG("Created suspend-dummy FIFO on %s", HOG_SUSPEND_FIFO); - - ret = fifo_open(); - if (ret < 0) - unlink(HOG_SUSPEND_FIFO); - - return ret; -} - -void suspend_exit(void) -{ - if (watch > 0) { - g_source_remove(watch); - watch = 0; - } - - unlink(HOG_SUSPEND_FIFO); -} -- 2.43.0