linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] rfkill: Do not log errors for missing device path
@ 2024-11-13 14:12 Marcus Prebble
  2024-11-13 16:01 ` [BlueZ] " bluez.test.bot
  2024-11-13 16:30 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Marcus Prebble @ 2024-11-13 14:12 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Marcus Prebble

In the case of our products, we lack a physical RFKILL switch and do
not have the rfkill module enabled in the kernel which resulted in an
error message each time bluetoothd was started.

This commit looks at the errno code after failing to open the RFKILL
device and only logs an error if it is something other than ENOENT
(No such file or directory).

Fixes: https://github.com/bluez/bluez/issues/792
---
 src/rfkill.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/rfkill.c b/src/rfkill.c
index 88cad1c9e..ac4a48d0a 100644
--- a/src/rfkill.c
+++ b/src/rfkill.c
@@ -55,6 +55,7 @@ struct rfkill_event {
 	uint8_t  hard;
 };
 #define RFKILL_EVENT_SIZE_V1    8
+#define RFKILL_DEVICE_PATH      "/dev/rfkill"
 
 static int get_adapter_id_for_rfkill(uint32_t rfkill_id)
 {
@@ -88,7 +89,7 @@ int rfkill_get_blocked(uint16_t index)
 	int fd;
 	int blocked = -1;
 
-	fd = open("/dev/rfkill", O_RDWR);
+	fd = open(RFKILL_DEVICE_PATH, O_RDWR);
 	if (fd < 0) {
 		DBG("Failed to open RFKILL control device");
 		return -1;
@@ -178,9 +179,16 @@ void rfkill_init(void)
 	int fd;
 	GIOChannel *channel;
 
-	fd = open("/dev/rfkill", O_RDWR);
+	errno = 0;
+	fd = open(RFKILL_DEVICE_PATH, O_RDWR);
 	if (fd < 0) {
-		error("Failed to open RFKILL control device");
+		if (errno == ENOENT) {
+			DBG("No RFKILL device available at '%s'",
+				RFKILL_DEVICE_PATH);
+		} else {
+			error("Failed to open RFKILL control device: %s",
+				strerror(errno));
+		}
 		return;
 	}
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [BlueZ] rfkill: Do not log errors for missing device path
  2024-11-13 14:12 [PATCH BlueZ] rfkill: Do not log errors for missing device path Marcus Prebble
@ 2024-11-13 16:01 ` bluez.test.bot
  2024-11-13 16:30 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2024-11-13 16:01 UTC (permalink / raw)
  To: linux-bluetooth, marcus.prebble

[-- Attachment #1: Type: text/plain, Size: 948 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=909312

---Test result---

Test Summary:
CheckPatch                    PASS      0.47 seconds
GitLint                       PASS      0.33 seconds
BuildEll                      PASS      20.66 seconds
BluezMake                     PASS      1660.50 seconds
MakeCheck                     PASS      13.44 seconds
MakeDistcheck                 PASS      163.50 seconds
CheckValgrind                 PASS      216.58 seconds
CheckSmatch                   PASS      276.84 seconds
bluezmakeextell               PASS      100.66 seconds
IncrementalBuild              PASS      1473.04 seconds
ScanBuild                     PASS      871.26 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ] rfkill: Do not log errors for missing device path
  2024-11-13 14:12 [PATCH BlueZ] rfkill: Do not log errors for missing device path Marcus Prebble
  2024-11-13 16:01 ` [BlueZ] " bluez.test.bot
@ 2024-11-13 16:30 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2024-11-13 16:30 UTC (permalink / raw)
  To: Marcus Prebble; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Wed, 13 Nov 2024 15:12:56 +0100 you wrote:
> In the case of our products, we lack a physical RFKILL switch and do
> not have the rfkill module enabled in the kernel which resulted in an
> error message each time bluetoothd was started.
> 
> This commit looks at the errno code after failing to open the RFKILL
> device and only logs an error if it is something other than ENOENT
> (No such file or directory).
> 
> [...]

Here is the summary with links:
  - [BlueZ] rfkill: Do not log errors for missing device path
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=63f1ab560c42

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-13 16:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-13 14:12 [PATCH BlueZ] rfkill: Do not log errors for missing device path Marcus Prebble
2024-11-13 16:01 ` [BlueZ] " bluez.test.bot
2024-11-13 16:30 ` [PATCH BlueZ] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).