Message ID | 20220831091912.47894-1-hadess@hadess.net (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [BlueZ,v4,1/6] adapter: Keep track of whether the adapter is rfkill'ed | expand |
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=672764 ---Test result--- Test Summary: CheckPatch FAIL 9.12 seconds GitLint PASS 6.06 seconds Prep - Setup ELL PASS 31.33 seconds Build - Prep PASS 0.88 seconds Build - Configure PASS 10.02 seconds Build - Make PASS 941.21 seconds Make Check PASS 12.27 seconds Make Check w/Valgrind PASS 338.64 seconds Make Distcheck PASS 277.34 seconds Build w/ext ELL - Configure PASS 10.07 seconds Build w/ext ELL - Make PASS 97.46 seconds Incremental Build w/ patches PASS 702.02 seconds Scan Build PASS 736.92 seconds Details ############################## Test: CheckPatch - FAIL Desc: Run checkpatch.pl script with rule in .checkpatch.conf Output: [BlueZ,v4,1/6] adapter: Keep track of whether the adapter is rfkill'ed ERROR:CODE_INDENT: code indent should use tabs where possible #95: FILE: src/adapter.c:7558: +^I g_dbus_emit_property_changed(dbus_conn, adapter->path,$ ERROR:CODE_INDENT: code indent should use tabs where possible #110: FILE: src/adapter.c:7574: +^I g_dbus_emit_property_changed(dbus_conn, adapter->path,$ /github/workspace/src/12960589.patch total: 2 errors, 0 warnings, 90 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. NOTE: Whitespace errors detected. You may wish to use scripts/cleanpatch or scripts/cleanfile /github/workspace/src/12960589.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. [BlueZ,v4,2/6] adapter: Implement PowerState property ERROR:CODE_INDENT: code indent should use tabs where possible #96: FILE: src/adapter.c:590: +^I g_dbus_emit_property_changed(dbus_conn, adapter->path,$ WARNING:LONG_LINE: line length of 97 exceeds 80 columns #123: FILE: src/adapter.c:659: + reset_power_state_target(adapter, settings & MGMT_SETTING_POWERED ? 0x01 : 0x00); WARNING:LONG_LINE_STRING: line length of 81 exceeds 80 columns #153: FILE: src/adapter.c:727: + ADAPTER_INTERFACE, "PowerState"); WARNING:LONG_LINE_STRING: line length of 81 exceeds 80 columns #175: FILE: src/adapter.c:761: + ADAPTER_INTERFACE, "PowerState"); WARNING:LONG_LINE_STRING: line length of 81 exceeds 80 columns #209: FILE: src/adapter.c:3101: + ADAPTER_INTERFACE, "PowerState"); WARNING:LONG_LINE_STRING: line length of 81 exceeds 80 columns #222: FILE: src/adapter.c:3115: + ADAPTER_INTERFACE, "PowerState"); WARNING:LONG_LINE: line length of 84 exceeds 80 columns #239: FILE: src/adapter.c:3156: + } else if (adapter->power_state_target == ADAPTER_POWER_STATE_TARGET_NONE) { WARNING:LONG_LINE: line length of 81 exceeds 80 columns #245: FILE: src/adapter.c:3162: + if (adapter->power_state_target == ADAPTER_POWER_STATE_TARGET_ON) WARNING:LONG_LINE_STRING: line length of 81 exceeds 80 columns #273: FILE: src/adapter.c:5620: + ADAPTER_INTERFACE, "PowerState"); WARNING:LONG_LINE_STRING: line length of 81 exceeds 80 columns #282: FILE: src/adapter.c:7365: + ADAPTER_INTERFACE, "PowerState"); /github/workspace/src/12960593.patch total: 1 errors, 9 warnings, 197 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. NOTE: Whitespace errors detected. You may wish to use scripts/cleanpatch or scripts/cleanfile /github/workspace/src/12960593.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. --- Regards, Linux Bluetooth
On Wed, 2022-08-31 at 11:19 +0200, Bastien Nocera wrote: > @@ -7548,6 +7553,12 @@ int btd_cancel_authorization(guint id) > > int btd_adapter_restore_powered(struct btd_adapter *adapter) > { > + if (adapter->blocked) { > + adapter->blocked = false; > + g_dbus_emit_property_changed(dbus_conn, adapter->path, > + ADAPTER_INTERFACE, "PowerState"); This should have been in the next patch. > + } > + > if (btd_adapter_get_powered(adapter)) > return 0; > > @@ -7556,6 +7567,16 @@ int btd_adapter_restore_powered(struct btd_adapter *adapter) > return 0; > } > > +int btd_adapter_set_blocked(struct btd_adapter *adapter) > +{ > + if (!adapter->blocked) { > + adapter->blocked = true; > + g_dbus_emit_property_changed(dbus_conn, adapter->path, > + ADAPTER_INTERFACE, "PowerState"); Ditto.
On Wed, 2022-08-31 at 03:23 -0700, bluez.test.bot@gmail.com wrote: > 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=6727 > 64 > > ---Test result--- > > Test Summary: > CheckPatch FAIL 9.12 seconds All those should be fixed in v5.
diff --git a/src/adapter.c b/src/adapter.c index b453e86a0..641db67f9 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -250,6 +250,7 @@ struct btd_adapter { uint32_t dev_class; /* controller class of device */ char *name; /* controller device name */ char *short_name; /* controller short name */ + bool blocked; /* whether rfkill is enabled */ uint32_t supported_settings; /* controller supported settings */ uint32_t pending_settings; /* pending controller settings */ uint32_t current_settings; /* current controller settings */ @@ -654,6 +655,8 @@ static void set_mode_complete(uint8_t status, uint16_t length, if (status != MGMT_STATUS_SUCCESS) { btd_error(adapter->dev_id, "Failed to set mode: %s (0x%02x)", mgmt_errstr(status), status); + if (status == MGMT_STATUS_RFKILLED) + adapter->blocked = true; adapter->pending_settings &= ~data->setting; return; } @@ -2914,10 +2917,12 @@ static void property_set_mode_complete(uint8_t status, uint16_t length, btd_error(adapter->dev_id, "Failed to set mode: %s (0x%02x)", mgmt_errstr(status), status); - if (status == MGMT_STATUS_RFKILLED) + if (status == MGMT_STATUS_RFKILLED) { dbus_err = ERROR_INTERFACE ".Blocked"; - else + adapter->blocked = true; + } else { dbus_err = ERROR_INTERFACE ".Failed"; + } g_dbus_pending_property_error(data->id, dbus_err, mgmt_errstr(status)); @@ -7548,6 +7553,12 @@ int btd_cancel_authorization(guint id) int btd_adapter_restore_powered(struct btd_adapter *adapter) { + if (adapter->blocked) { + adapter->blocked = false; + g_dbus_emit_property_changed(dbus_conn, adapter->path, + ADAPTER_INTERFACE, "PowerState"); + } + if (btd_adapter_get_powered(adapter)) return 0; @@ -7556,6 +7567,16 @@ int btd_adapter_restore_powered(struct btd_adapter *adapter) return 0; } +int btd_adapter_set_blocked(struct btd_adapter *adapter) +{ + if (!adapter->blocked) { + adapter->blocked = true; + g_dbus_emit_property_changed(dbus_conn, adapter->path, + ADAPTER_INTERFACE, "PowerState"); + } + return 0; +} + void btd_adapter_register_pin_cb(struct btd_adapter *adapter, btd_adapter_pin_cb_t cb) { diff --git a/src/adapter.h b/src/adapter.h index b09044edd..332c0b239 100644 --- a/src/adapter.h +++ b/src/adapter.h @@ -143,6 +143,7 @@ guint btd_request_authorization_cable_configured(const bdaddr_t *src, const bdad int btd_cancel_authorization(guint id); int btd_adapter_restore_powered(struct btd_adapter *adapter); +int btd_adapter_set_blocked(struct btd_adapter *adapter); typedef ssize_t (*btd_adapter_pin_cb_t) (struct btd_adapter *adapter, struct btd_device *dev, char *out, bool *display, diff --git a/src/rfkill.c b/src/rfkill.c index 2099c5ac5..93f8e0e12 100644 --- a/src/rfkill.c +++ b/src/rfkill.c @@ -61,6 +61,7 @@ static gboolean rfkill_event(GIOChannel *chan, struct rfkill_event event = { 0 }; struct btd_adapter *adapter; char sysname[PATH_MAX]; + bool blocked = false; ssize_t len; int fd, id; @@ -84,7 +85,7 @@ static gboolean rfkill_event(GIOChannel *chan, event.soft, event.hard); if (event.soft || event.hard) - return TRUE; + blocked = true; if (event.op != RFKILL_OP_CHANGE) return TRUE; @@ -122,7 +123,10 @@ static gboolean rfkill_event(GIOChannel *chan, DBG("RFKILL unblock for hci%d", id); - btd_adapter_restore_powered(adapter); + if (blocked) + btd_adapter_set_blocked(adapter); + else + btd_adapter_restore_powered(adapter); return TRUE; }