2 * Copyright (C) 2009 Johannes Berg <johannes@sipsolutions.net>
4 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation;
8 * version 2.1 of the License (not later!)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, see <http://www.gnu.org/licenses>
18 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 #include "event-parse.h"
25 #include "trace-seq.h"
29 static void print_string(struct trace_seq
*s
, struct tep_event
*event
,
30 const char *name
, const void *data
)
32 struct tep_format_field
*f
= tep_find_field(event
, name
);
37 trace_seq_printf(s
, "NOTFOUND:%s", name
);
44 if (!strncmp(f
->type
, "__data_loc", 10)) {
46 if (tep_read_number_field(f
, data
, &v
)) {
47 trace_seq_printf(s
, "invalid_data_loc");
54 trace_seq_printf(s
, "%.*s", length
, (char *)data
+ offset
);
57 #define SF(fn) tep_print_num_field(s, fn ":%d", event, fn, record, 0)
58 #define SFX(fn) tep_print_num_field(s, fn ":%#x", event, fn, record, 0)
59 #define SP() trace_seq_putc(s, ' ')
61 static int drv_bss_info_changed(struct trace_seq
*s
,
62 struct tep_record
*record
,
63 struct tep_event
*event
, void *context
)
65 void *data
= record
->data
;
67 print_string(s
, event
, "wiphy_name", data
);
68 trace_seq_printf(s
, " vif:");
69 print_string(s
, event
, "vif_name", data
);
70 tep_print_num_field(s
, "(%d)", event
, "vif_type", record
, 1);
72 trace_seq_printf(s
, "\n%*s", INDENT
, "");
77 SF("shortslot"); SP();
79 trace_seq_printf(s
, "\n%*s", INDENT
, "");
81 SFX("assoc_cap"); SP();
82 SFX("basic_rates"); SP();
84 trace_seq_printf(s
, "\n%*s", INDENT
, "");
85 SF("ht_operation_mode");
90 int TEP_PLUGIN_LOADER(struct tep_handle
*tep
)
92 tep_register_event_handler(tep
, -1, "mac80211",
93 "drv_bss_info_changed",
94 drv_bss_info_changed
, NULL
);
98 void TEP_PLUGIN_UNLOADER(struct tep_handle
*tep
)
100 tep_unregister_event_handler(tep
, -1, "mac80211",
101 "drv_bss_info_changed",
102 drv_bss_info_changed
, NULL
);