diff mbox series

[BlueZ] rfkill: Do not log errors for missing device path

Message ID 20241113141256.602066-1-marcus.prebble@axis.com (mailing list archive)
State Accepted
Commit 63f1ab560c4253742aa12f139610d5c1c52debb5
Headers show
Series [BlueZ] rfkill: Do not log errors for missing device path | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Marcus Prebble Nov. 13, 2024, 2:12 p.m. UTC
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(-)

Comments

bluez.test.bot@gmail.com Nov. 13, 2024, 4:01 p.m. UTC | #1
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
patchwork-bot+bluetooth@kernel.org Nov. 13, 2024, 4:30 p.m. UTC | #2
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!
diff mbox series

Patch

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;
 	}