Qt/Bluetooth: HCI Summary: Miscellaneous fixes

1. Count vendor commands once
2. Fill Event column in case of Command Status/Command Complete
   types while displaying command
3. Add missing Status from Connect Complete event
4. Add missing Command Complete events opcodes

Change-Id: Ie5a0e373f92f62fcb890cef7ab54762df3bb8a35
Reviewed-on: https://code.wireshark.org/review/14315
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
This commit is contained in:
Michal Labedzki 2016-01-26 09:02:15 +01:00
parent c785c51137
commit d25bdd7c46
2 changed files with 37 additions and 1 deletions

View File

@ -889,6 +889,7 @@ dissect_bthci_evt_connect_complete(tvbuff_t *tvb, int offset, packet_info *pinfo
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
status = tvb_get_guint8(tvb, offset);
send_hci_summary_status_tap(status, pinfo, bluetooth_data);
offset += 1;
connection_handle = tvb_get_letohs(tvb, offset) & 0x0FFF;
@ -1704,6 +1705,7 @@ dissect_bthci_evt_command_status(tvbuff_t *tvb, int offset, packet_info *pinfo,
tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_EVENT_OPCODE;
tap_hci_summary->ogf = ogf;
tap_hci_summary->ocf = opcode & 0x03ff;
tap_hci_summary->event = 0x0f; /* Command Status */
if (try_val_to_str_ext(opcode, &bthci_cmd_opcode_vals_ext))
tap_hci_summary->name = val_to_str_ext(opcode, &bthci_cmd_opcode_vals_ext, "Unknown 0x%04x");
else
@ -2324,6 +2326,25 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
if (out_opcode)
*out_opcode = opcode;
if (have_tap_listener(bluetooth_hci_summary_tap)) {
bluetooth_hci_summary_tap_t *tap_hci_summary;
tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
tap_hci_summary->interface_id = bluetooth_data->interface_id;
tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_EVENT_OPCODE;
tap_hci_summary->ogf = ogf;
tap_hci_summary->ocf = opcode & 0x03ff;
tap_hci_summary->event = 0x0e; /* Command Complete */
if (try_val_to_str_ext(opcode, &bthci_cmd_opcode_vals_ext))
tap_hci_summary->name = val_to_str_ext(opcode, &bthci_cmd_opcode_vals_ext, "Unknown 0x%04x");
else
tap_hci_summary->name = NULL;
tap_queue_packet(bluetooth_hci_summary_tap, pinfo, tap_hci_summary);
}
interface_id = bluetooth_data->interface_id;
adapter_id = bluetooth_data->adapter_id;
frame_number = pinfo->num;
@ -3258,6 +3279,17 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
proto_tree_add_item(tree, hf_bthci_evt_total_num_data_blocks, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
break;
case 0x100b: /* Read Local Supported Codecs */
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
status = tvb_get_guint8(tvb, offset);
send_hci_summary_status_tap(status, pinfo, bluetooth_data);
offset += 1;
/* TODO: Implement */
proto_tree_add_expert(tree, pinfo, &ei_event_undecoded, tvb, offset, tvb_captured_length_remaining(tvb, offset));
offset += tvb_reported_length_remaining(tvb, offset);
break;
case 0x1007: /* Read Country Code */

View File

@ -371,8 +371,10 @@ gboolean BluetoothHciSummaryDialog::tapPacket(void *tapinfo_ptr, packet_info *pi
for (int i_item = 0; i_item < main_item->childCount(); i_item +=1) {
if (main_item->child(i_item)->text(column_number_opcode) == QString("").sprintf("0x%04X", tap_hci->ogf << 10 | tap_hci->ocf)) {
item = main_item->child(i_item);
if (tap_hci->type == BLUETOOTH_HCI_SUMMARY_VENDOR_OPCODE && tap_hci->name)
if (tap_hci->type == BLUETOOTH_HCI_SUMMARY_VENDOR_OPCODE && tap_hci->name) {
item->setText(column_number_name, tap_hci->name);
item->setText(column_number_occurrence, QString::number(item->text(column_number_occurrence).toInt() - 1));
}
break;
}
}
@ -410,6 +412,8 @@ gboolean BluetoothHciSummaryDialog::tapPacket(void *tapinfo_ptr, packet_info *pi
frame_item->setText(column_number_ogf, QString("").sprintf("0x%02X", tap_hci->ogf));
frame_item->setText(column_number_ocf, QString("").sprintf("0x%04X", tap_hci->ocf));
frame_item->setText(column_number_opcode, QString("").sprintf("0x%04X", tap_hci->ogf << 10 | tap_hci->ocf));
if (tap_hci->type == BLUETOOTH_HCI_SUMMARY_EVENT_OPCODE)
frame_item->setText(column_number_event, QString("").sprintf("0x%02X", tap_hci->event));
item->addChild(frame_item);
item_data = wmem_new(wmem_file_scope(), item_data_t);