diff options
author | Michal Labedzki <michal.labedzki@tieto.com> | 2016-11-03 10:46:25 +0100 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2016-12-05 11:44:00 +0000 |
commit | a7d404a972bc24020bbfe2d64b99e299f2507bdc (patch) | |
tree | 4bc9dd25e7307ce059aff318c9a994430e285349 /extcap | |
parent | e0a4f0c79b68830547dab1baad7641a09b4d93f5 (diff) | |
download | wireshark-a7d404a972bc24020bbfe2d64b99e299f2507bdc.tar.gz |
androiddump: Add support for Bluetooth on Android 7.0
Now "ps" command does not support process name as parameter,
use grep instead.
Change-Id: I0c35bc7d560e237e4140000e67af097744cb2c1b
Reviewed-on: https://code.wireshark.org/review/19087
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'extcap')
-rw-r--r-- | extcap/androiddump.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/extcap/androiddump.c b/extcap/androiddump.c index 7a61cd848b..0af6f2de55 100644 --- a/extcap/androiddump.c +++ b/extcap/androiddump.c @@ -696,6 +696,7 @@ static int register_interfaces(extcap_parameters * extcap_conf, const char *adb_ const char *adb_hcidump_version = "0017""shell:hcidump --version"; const char *adb_ps_droid_bluetooth = "0018""shell:ps droid.bluetooth"; const char *adb_ps_bluetooth_app = "001E""shell:ps com.android.bluetooth"; + const char *adb_ps_with_grep = "0025""shell:ps | grep com.android.bluetooth"; const char *adb_tcpdump_help = "0010""shell:tcpdump -h"; char serial_number[SERIAL_NUMBER_LENGTH_MAX]; size_t serial_number_length; @@ -982,7 +983,9 @@ static int register_interfaces(extcap_parameters * extcap_conf, const char *adb_ return EXIT_CODE_GENERIC; } - if (api_level >= 23) { + if (api_level >= 24) { + response = adb_send_and_read(sock, adb_ps_with_grep, helpful_packet, sizeof(helpful_packet), &data_length); + } else if (api_level >= 23) { response = adb_send_and_read(sock, adb_ps_bluetooth_app, helpful_packet, sizeof(helpful_packet), &data_length); } else response = adb_send_and_read(sock, adb_ps_droid_bluetooth, helpful_packet, sizeof(helpful_packet), &data_length); @@ -999,7 +1002,11 @@ static int register_interfaces(extcap_parameters * extcap_conf, const char *adb_ memset(pid, 0, sizeof(pid)); response[data_length] = '\0'; - data_str = strchr(response, '\n'); + if (api_level >= 24) + data_str = response; + else + data_str = strchr(response, '\n'); + if (data_str && sscanf(data_str, "%*s %s", pid) == 1) { g_debug("Android Bluetooth application PID for %s is %s", serial_number, pid); |