Message ID | 20220709162658.1953-2-shwoseph@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | ExcludeAdapter setting for input plugin | 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=658199 ---Test result--- Test Summary: CheckPatch FAIL 1.46 seconds GitLint PASS 0.76 seconds Prep - Setup ELL PASS 31.66 seconds Build - Prep PASS 0.76 seconds Build - Configure PASS 10.17 seconds Build - Make FAIL 88.28 seconds Make Check FAIL 1208.95 seconds Make Check w/Valgrind FAIL 70.73 seconds Make Distcheck PASS 269.99 seconds Build w/ext ELL - Configure PASS 9.97 seconds Build w/ext ELL - Make FAIL 31.13 seconds Incremental Build w/ patches PASS 0.00 seconds Scan Build FAIL 545.03 seconds Details ############################## Test: CheckPatch - FAIL Desc: Run checkpatch.pl script with rule in .checkpatch.conf Output: [BlueZ,1/1] ExcludeAdapter configuration setting for input profile ERROR:POINTER_LOCATION: "foo** bar" should be "foo **bar" #95: FILE: profiles/input/device.c:85: +static char** exclude_adapters; ERROR:POINTER_LOCATION: "foo** bar" should be "foo **bar" #104: FILE: profiles/input/device.c:108: +char** input_get_exclude_adapters(void) ERROR:POINTER_LOCATION: "foo** bar" should be "foo **bar" #109: FILE: profiles/input/device.c:113: +void input_set_exclude_adapters(char** adapters) WARNING:LEADING_SPACE: please, no spaces at the start of a line #111: FILE: profiles/input/device.c:115: + exclude_adapters = adapters;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #121: FILE: profiles/input/device.c:125: + num_exclude_adapters = num;$ ERROR:POINTER_LOCATION: "foo** bar" should be "foo **bar" #135: FILE: profiles/input/device.h:22: +char** input_get_exclude_adapters(void); ERROR:POINTER_LOCATION: "foo** bar" should be "foo **bar" #136: FILE: profiles/input/device.h:23: +void input_set_exclude_adapters(char** address); WARNING:LEADING_SPACE: please, no spaces at the start of a line #163: FILE: profiles/input/manager.c:35: + const bdaddr_t* address;$ ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar" #163: FILE: profiles/input/manager.c:35: + const bdaddr_t* address; WARNING:LEADING_SPACE: please, no spaces at the start of a line #164: FILE: profiles/input/manager.c:36: + char addr[18];$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #165: FILE: profiles/input/manager.c:37: + char** exclude_adapters;$ ERROR:POINTER_LOCATION: "foo** bar" should be "foo **bar" #165: FILE: profiles/input/manager.c:37: + char** exclude_adapters; WARNING:LEADING_SPACE: please, no spaces at the start of a line #166: FILE: profiles/input/manager.c:38: + gsize num_exclude_adapters;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #168: FILE: profiles/input/manager.c:40: + address = btd_adapter_get_address(adapter);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #169: FILE: profiles/input/manager.c:41: + ba2str(address, addr);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #170: FILE: profiles/input/manager.c:42: + exclude_adapters = input_get_exclude_adapters();$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #171: FILE: profiles/input/manager.c:43: + num_exclude_adapters = input_get_num_exclude_adapters();$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #173: FILE: profiles/input/manager.c:45: + for(int i = 0; i < num_exclude_adapters; i++)$ ERROR:OPEN_BRACE: that open brace { should be on the previous line #173: FILE: profiles/input/manager.c:45: + for(int i = 0; i < num_exclude_adapters; i++) + { ERROR:SPACING: space required before the open parenthesis '(' #173: FILE: profiles/input/manager.c:45: + for(int i = 0; i < num_exclude_adapters; i++) WARNING:LEADING_SPACE: please, no spaces at the start of a line #174: FILE: profiles/input/manager.c:46: + {$ ERROR:CODE_INDENT: code indent should use tabs where possible #175: FILE: profiles/input/manager.c:47: + if(strcmp(addr, exclude_adapters[i]))$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #175: FILE: profiles/input/manager.c:47: + if(strcmp(addr, exclude_adapters[i]))$ ERROR:OPEN_BRACE: that open brace { should be on the previous line #175: FILE: profiles/input/manager.c:47: + if(strcmp(addr, exclude_adapters[i])) + { WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (8, 12) #175: FILE: profiles/input/manager.c:47: + if(strcmp(addr, exclude_adapters[i])) + { ERROR:SPACING: space required before the open parenthesis '(' #175: FILE: profiles/input/manager.c:47: + if(strcmp(addr, exclude_adapters[i])) ERROR:CODE_INDENT: code indent should use tabs where possible #176: FILE: profiles/input/manager.c:48: + {$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #176: FILE: profiles/input/manager.c:48: + {$ ERROR:CODE_INDENT: code indent should use tabs where possible #177: FILE: profiles/input/manager.c:49: + return 0;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #177: FILE: profiles/input/manager.c:49: + return 0;$ ERROR:CODE_INDENT: code indent should use tabs where possible #178: FILE: profiles/input/manager.c:50: + }$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #178: FILE: profiles/input/manager.c:50: + }$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #179: FILE: profiles/input/manager.c:51: + }$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #189: FILE: profiles/input/manager.c:101: + DBG("CONFIGDIR: %s", CONFIGDIR);$ ERROR:CODE_INDENT: code indent should use tabs where possible #193: FILE: profiles/input/manager.c:105: + char* exclude_adapters_str;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #193: FILE: profiles/input/manager.c:105: + char* exclude_adapters_str;$ ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar" #193: FILE: profiles/input/manager.c:105: + char* exclude_adapters_str; ERROR:CODE_INDENT: code indent should use tabs where possible #194: FILE: profiles/input/manager.c:106: + char** exclude_adapters;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #194: FILE: profiles/input/manager.c:106: + char** exclude_adapters;$ ERROR:POINTER_LOCATION: "foo** bar" should be "foo **bar" #194: FILE: profiles/input/manager.c:106: + char** exclude_adapters; ERROR:CODE_INDENT: code indent should use tabs where possible #195: FILE: profiles/input/manager.c:107: + gsize num_exclude_adapters;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #195: FILE: profiles/input/manager.c:107: + gsize num_exclude_adapters;$ ERROR:CODE_INDENT: code indent should use tabs where possible #203: FILE: profiles/input/manager.c:146: + g_key_file_set_list_separator(config, ',');$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #203: FILE: profiles/input/manager.c:146: + g_key_file_set_list_separator(config, ',');$ ERROR:CODE_INDENT: code indent should use tabs where possible #205: FILE: profiles/input/manager.c:148: + exclude_adapters_str = g_key_file_get_string(config, "General",$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #205: FILE: profiles/input/manager.c:148: + exclude_adapters_str = g_key_file_get_string(config, "General",$ ERROR:CODE_INDENT: code indent should use tabs where possible #206: FILE: profiles/input/manager.c:149: + "ExcludeAdapters", &err);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #206: FILE: profiles/input/manager.c:149: + "ExcludeAdapters", &err);$ ERROR:CODE_INDENT: code indent should use tabs where possible #207: FILE: profiles/input/manager.c:150: + exclude_adapters = g_key_file_get_string_list(config, "General",$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #207: FILE: profiles/input/manager.c:150: + exclude_adapters = g_key_file_get_string_list(config, "General",$ ERROR:CODE_INDENT: code indent should use tabs where possible #208: FILE: profiles/input/manager.c:151: + "ExcludeAdapters", &num_exclude_adapters, &err);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #208: FILE: profiles/input/manager.c:151: + "ExcludeAdapters", &num_exclude_adapters, &err);$ WARNING:LONG_LINE: line length of 84 exceeds 80 columns #210: FILE: profiles/input/manager.c:153: + DBG("input.conf: ExcludeAdapters=%s", exclude_adapters_str); /github/workspace/src/12912286.patch total: 25 errors, 28 warnings, 108 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/12912286.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. ############################## Test: Build - Make - FAIL Desc: Build the BlueZ source tree Output: tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12426:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12426 | int main(int argc, char *argv[]) | ^~~~ profiles/input/manager.c: In function ‘hid_server_probe’: profiles/input/manager.c:45:22: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare] 45 | for(int i = 0; i < num_exclude_adapters; i++) | ^ cc1: all warnings being treated as errors make[1]: *** [Makefile:9627: profiles/input/bluetoothd-manager.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4324: all] Error 2 ############################## Test: Make Check - FAIL Desc: Run 'make check' Output: unit/test-avdtp.c: In function ‘main’: unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 766 | int main(int argc, char *argv[]) | ^~~~ unit/test-avrcp.c: In function ‘main’: unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 989 | int main(int argc, char *argv[]) | ^~~~ profiles/input/manager.c: In function ‘hid_server_probe’: profiles/input/manager.c:45:22: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare] 45 | for(int i = 0; i < num_exclude_adapters; i++) | ^ cc1: all warnings being treated as errors make[1]: *** [Makefile:9627: profiles/input/bluetoothd-manager.o] Error 1 make: *** [Makefile:11320: check] Error 2 ############################## Test: Make Check w/Valgrind - FAIL Desc: Run 'make check' with Valgrind Output: tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12426:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12426 | int main(int argc, char *argv[]) | ^~~~ profiles/input/manager.c: In function ‘hid_server_probe’: profiles/input/manager.c:45:22: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare] 45 | for(int i = 0; i < num_exclude_adapters; i++) | ^ cc1: all warnings being treated as errors make[1]: *** [Makefile:9627: profiles/input/bluetoothd-manager.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4324: all] Error 2 ############################## Test: Build w/ext ELL - Make - FAIL Desc: Build BlueZ source with '--enable-external-ell' configuration Output: profiles/input/manager.c: In function ‘hid_server_probe’: profiles/input/manager.c:45:22: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare] 45 | for(int i = 0; i < num_exclude_adapters; i++) | ^ cc1: all warnings being treated as errors make[1]: *** [Makefile:9627: profiles/input/bluetoothd-manager.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4324: all] Error 2 ############################## Test: Scan Build - FAIL Desc: Run Scan Build with patches Output: profiles/input/manager.c: In function ‘hid_server_probe’: profiles/input/manager.c:45:22: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare] 45 | for(int i = 0; i < num_exclude_adapters; i++) | ^ cc1: all warnings being treated as errors make[1]: *** [Makefile:9627: profiles/input/bluetoothd-manager.o] Error 1 make: *** [Makefile:4324: all] Error 2 --- Regards, Linux Bluetooth
diff --git a/profiles/input/device.c b/profiles/input/device.c index e2ac6ea60..ec6ed4e9a 100644 --- a/profiles/input/device.c +++ b/profiles/input/device.c @@ -82,6 +82,8 @@ struct input_device { static int idle_timeout = 0; static bool uhid_enabled = false; static bool classic_bonded_only = false; +static char** exclude_adapters; +static gsize num_exclude_adapters; void input_set_idle_timeout(int timeout) { @@ -103,6 +105,26 @@ bool input_get_classic_bonded_only(void) return classic_bonded_only; } +char** input_get_exclude_adapters(void) +{ + return exclude_adapters; +} + +void input_set_exclude_adapters(char** adapters) +{ + exclude_adapters = adapters; +} + +gsize input_get_num_exclude_adapters(void) +{ + return num_exclude_adapters; +} + +void input_set_num_exclude_adapters(gsize num) +{ + num_exclude_adapters = num; +} + static void input_device_enter_reconnect_mode(struct input_device *idev); static int connection_disconnect(struct input_device *idev, uint32_t flags); static int uhid_disconnect(struct input_device *idev); diff --git a/profiles/input/device.h b/profiles/input/device.h index cf0389417..58b95d68e 100644 --- a/profiles/input/device.h +++ b/profiles/input/device.h @@ -19,6 +19,10 @@ void input_enable_userspace_hid(bool state); void input_set_classic_bonded_only(bool state); bool input_get_classic_bonded_only(void); void input_set_auto_sec(bool state); +char** input_get_exclude_adapters(void); +void input_set_exclude_adapters(char** address); +gsize input_get_num_exclude_adapters(void); +void input_set_num_exclude_adapters(gsize address); int input_device_register(struct btd_service *service); void input_device_unregister(struct btd_service *service); diff --git a/profiles/input/input.conf b/profiles/input/input.conf index 4c70bc561..c8ec5ee30 100644 --- a/profiles/input/input.conf +++ b/profiles/input/input.conf @@ -24,3 +24,7 @@ # Enables upgrades of security automatically if required. # Defaults to true to maximize device compatibility. #LEAutoSecurity=true + +# Exclude adapters +# Disables input plugin on adapters with specified bdaddrs +#ExcludeAdapters=00:00:00:00:00:00,00:00:00:00:00:01 diff --git a/profiles/input/manager.c b/profiles/input/manager.c index 92789a003..3715fb1ec 100644 --- a/profiles/input/manager.c +++ b/profiles/input/manager.c @@ -32,7 +32,25 @@ static int hid_server_probe(struct btd_profile *p, struct btd_adapter *adapter) { - return server_start(btd_adapter_get_address(adapter)); + const bdaddr_t* address; + char addr[18]; + char** exclude_adapters; + gsize num_exclude_adapters; + + address = btd_adapter_get_address(adapter); + ba2str(address, addr); + exclude_adapters = input_get_exclude_adapters(); + num_exclude_adapters = input_get_num_exclude_adapters(); + + for(int i = 0; i < num_exclude_adapters; i++) + { + if(strcmp(addr, exclude_adapters[i])) + { + return 0; + } + } + + return server_start(address); } static void hid_server_remove(struct btd_profile *p, @@ -80,9 +98,13 @@ static int input_init(void) GKeyFile *config; GError *err = NULL; + DBG("CONFIGDIR: %s", CONFIGDIR); config = load_config_file(CONFIGDIR "/input.conf"); if (config) { int idle_timeout; + char* exclude_adapters_str; + char** exclude_adapters; + gsize num_exclude_adapters; gboolean uhid_enabled, classic_bonded_only, auto_sec; idle_timeout = g_key_file_get_integer(config, "General", @@ -121,6 +143,18 @@ static int input_init(void) } else g_clear_error(&err); + g_key_file_set_list_separator(config, ','); + + exclude_adapters_str = g_key_file_get_string(config, "General", + "ExcludeAdapters", &err); + exclude_adapters = g_key_file_get_string_list(config, "General", + "ExcludeAdapters", &num_exclude_adapters, &err); + if (!err) { + DBG("input.conf: ExcludeAdapters=%s", exclude_adapters_str); + input_set_exclude_adapters(exclude_adapters); + input_set_num_exclude_adapters(num_exclude_adapters); + } else + g_clear_error(&err); } btd_profile_register(&input_profile);