debug logs

This commit is contained in:
2025-10-30 01:35:36 +08:00
parent 342e18c37e
commit f6a0dff2b8
6 changed files with 59 additions and 0 deletions

View File

@@ -234,6 +234,7 @@ void __ofono_history_sms_send_pending(struct ofono_modem *modem,
static void history_sms_send_status(struct ofono_atom *atom, void *data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_history_context *context = __ofono_atom_get_data(atom);
struct history_sms_foreach_data *hfd = data;
@@ -249,6 +250,7 @@ void __ofono_history_sms_send_status(struct ofono_modem *modem,
time_t when,
enum ofono_history_sms_status status)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct history_sms_foreach_data hfd;
hfd.uuid = uuid;
@@ -263,6 +265,7 @@ void __ofono_history_sms_send_status(struct ofono_modem *modem,
int ofono_history_driver_register(const struct ofono_history_driver *driver)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBG("driver: %p name: %s", driver, driver->name);
history_drivers = g_slist_prepend(history_drivers, (void *) driver);
@@ -272,6 +275,7 @@ int ofono_history_driver_register(const struct ofono_history_driver *driver)
void ofono_history_driver_unregister(const struct ofono_history_driver *driver)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBG("driver: %p name: %s", driver, driver->name);
history_drivers = g_slist_remove(history_drivers, driver);

View File

@@ -51,6 +51,7 @@ static unsigned int find_next_zero_bit(const unsigned long *addr,
unsigned int size,
unsigned int offset)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
const unsigned long *p = addr + offset / BITS_PER_LONG;
unsigned int result = offset & ~(BITS_PER_LONG-1);
unsigned long tmp;
@@ -100,6 +101,7 @@ found_middle:
struct idmap *idmap_new_from_range(unsigned int min, unsigned int max)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct idmap *ret = g_new0(struct idmap, 1);
unsigned int size = max - min + 1;
@@ -114,17 +116,20 @@ struct idmap *idmap_new_from_range(unsigned int min, unsigned int max)
struct idmap *idmap_new(unsigned int size)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return idmap_new_from_range(1, size);
}
void idmap_free(struct idmap *idmap)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_free(idmap->bits);
g_free(idmap);
}
void idmap_put(struct idmap *idmap, unsigned int id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
unsigned int offset = (id - idmap->min) / BITS_PER_LONG;
id -= idmap->min;
@@ -139,6 +144,7 @@ void idmap_put(struct idmap *idmap, unsigned int id)
unsigned int idmap_alloc(struct idmap *idmap)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
unsigned int bit;
unsigned int offset;
@@ -155,6 +161,7 @@ unsigned int idmap_alloc(struct idmap *idmap)
void idmap_take(struct idmap *idmap, unsigned int id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
unsigned int bit = id - idmap->min;
unsigned int offset;
@@ -167,6 +174,7 @@ void idmap_take(struct idmap *idmap, unsigned int id)
int idmap_find(struct idmap *idmap, unsigned int id)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
unsigned int bit = id - idmap->min;
unsigned int offset;
@@ -184,6 +192,7 @@ int idmap_find(struct idmap *idmap, unsigned int id)
*/
unsigned int idmap_alloc_next(struct idmap *idmap, unsigned int last)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
unsigned int bit;
unsigned int offset;
@@ -204,10 +213,12 @@ unsigned int idmap_alloc_next(struct idmap *idmap, unsigned int last)
unsigned int idmap_get_min(struct idmap *idmap)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return idmap->min;
}
unsigned int idmap_get_max(struct idmap *idmap)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return idmap->max;
}

View File

@@ -54,6 +54,7 @@ struct ofono_location_reporting {
static const char *location_reporting_type_to_string(
enum ofono_location_reporting_type type)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
switch (type) {
case OFONO_LOCATION_REPORTING_TYPE_NMEA:
return "nmea";
@@ -66,6 +67,7 @@ static DBusMessage *location_reporting_get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_location_reporting *lr = data;
DBusMessage *reply;
DBusMessageIter iter;
@@ -95,6 +97,7 @@ static DBusMessage *location_reporting_get_properties(DBusConnection *conn,
static void client_remove(struct ofono_location_reporting *lr)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBusConnection *conn = ofono_dbus_get_connection();
if (lr->disconnect_watch) {
@@ -107,6 +110,7 @@ static void client_remove(struct ofono_location_reporting *lr)
static void signal_enabled(const struct ofono_location_reporting *lr)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBusConnection *conn = ofono_dbus_get_connection();
const char *path = __ofono_atom_get_path(lr->atom);
dbus_bool_t value = lr->enabled;
@@ -119,6 +123,7 @@ static void signal_enabled(const struct ofono_location_reporting *lr)
static void client_exited_disable_cb(const struct ofono_error *error,
void *data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_location_reporting *lr = data;
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
@@ -134,6 +139,7 @@ static void client_exited_disable_cb(const struct ofono_error *error,
static void client_exited(DBusConnection *conn, void *data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_location_reporting *lr = data;
lr->disconnect_watch = 0;
@@ -144,6 +150,7 @@ static void client_exited(DBusConnection *conn, void *data)
static void location_reporting_disable_cb(const struct ofono_error *error,
void *data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_location_reporting *lr = data;
DBusMessage *reply;
@@ -167,6 +174,7 @@ static void location_reporting_disable_cb(const struct ofono_error *error,
static void location_reporting_enable_cb(const struct ofono_error *error,
int fd, void *data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_location_reporting *lr = data;
DBusConnection *conn = ofono_dbus_get_connection();
DBusMessage *reply;
@@ -196,6 +204,7 @@ static void location_reporting_enable_cb(const struct ofono_error *error,
static DBusMessage *location_reporting_request(DBusConnection *conn,
DBusMessage *msg, void *data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_location_reporting *lr = data;
if (lr->pending != NULL)
@@ -214,6 +223,7 @@ static DBusMessage *location_reporting_request(DBusConnection *conn,
static DBusMessage *location_reporting_release(DBusConnection *conn,
DBusMessage *msg, void *data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_location_reporting *lr = data;
const char *caller = dbus_message_get_sender(msg);
@@ -260,6 +270,7 @@ static const GDBusSignalTable location_reporting_signals[] = {
int ofono_location_reporting_driver_register(
const struct ofono_location_reporting_driver *d)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBG("driver: %p, name: %s", d, d->name);
if (d == NULL || d->probe == NULL)
@@ -273,6 +284,7 @@ int ofono_location_reporting_driver_register(
void ofono_location_reporting_driver_unregister(
const struct ofono_location_reporting_driver *d)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBG("driver: %p, name: %s", d, d->name);
if (d == NULL)
@@ -284,11 +296,13 @@ void ofono_location_reporting_driver_unregister(
struct ofono_modem *ofono_location_reporting_get_modem(
struct ofono_location_reporting *lr)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return __ofono_atom_get_modem(lr->atom);
}
static void location_reporting_unregister(struct ofono_atom *atom)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_location_reporting *lr = __ofono_atom_get_data(atom);
const char *path = __ofono_atom_get_path(lr->atom);
DBusConnection *conn = ofono_dbus_get_connection();
@@ -301,6 +315,7 @@ static void location_reporting_unregister(struct ofono_atom *atom)
static void location_reporting_remove(struct ofono_atom *atom)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_location_reporting *lr = __ofono_atom_get_data(atom);
DBG("atom: %p", atom);
@@ -319,6 +334,7 @@ struct ofono_location_reporting *ofono_location_reporting_create(
unsigned int vendor,
const char *driver, void *data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_location_reporting *lr;
GSList *l;
@@ -355,6 +371,7 @@ struct ofono_location_reporting *ofono_location_reporting_create(
void ofono_location_reporting_register(struct ofono_location_reporting *lr)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBusConnection *conn = ofono_dbus_get_connection();
struct ofono_modem *modem = __ofono_atom_get_modem(lr->atom);
const char *path = __ofono_atom_get_path(lr->atom);
@@ -375,16 +392,19 @@ void ofono_location_reporting_register(struct ofono_location_reporting *lr)
void ofono_location_reporting_remove(struct ofono_location_reporting *lr)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
__ofono_atom_free(lr->atom);
}
void ofono_location_reporting_set_data(struct ofono_location_reporting *lr,
void *data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
lr->driver_data = data;
}
void *ofono_location_reporting_get_data(struct ofono_location_reporting *lr)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return lr->driver_data;
}

View File

@@ -61,6 +61,7 @@ static GSList *g_drivers = NULL;
static void lte_load_settings(struct ofono_lte *lte)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
char *apn;
char *proto_str;
char *auth_method_str;
@@ -122,6 +123,7 @@ static void lte_load_settings(struct ofono_lte *lte)
static DBusMessage *lte_get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_lte *lte = data;
const char *proto = gprs_proto_to_string(lte->info.proto);
const char *apn = lte->info.apn;
@@ -158,6 +160,7 @@ static DBusMessage *lte_get_properties(DBusConnection *conn,
static void lte_set_default_attach_info_cb(const struct ofono_error *error,
void *data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_lte *lte = data;
const char *path = __ofono_atom_get_path(lte->atom);
DBusConnection *conn = ofono_dbus_get_connection();
@@ -223,6 +226,7 @@ static void lte_set_default_attach_info_cb(const struct ofono_error *error,
static DBusMessage *lte_set_property(DBusConnection *conn,
DBusMessage *msg, void *data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_lte *lte = data;
DBusMessageIter iter;
DBusMessageIter var;
@@ -330,6 +334,7 @@ static const GDBusSignalTable lte_signals[] = {
static void lte_atom_remove(struct ofono_atom *atom)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_lte *lte = __ofono_atom_get_data(atom);
DBG("atom: %p", atom);
@@ -355,6 +360,7 @@ struct ofono_lte *ofono_lte_create(struct ofono_modem *modem,
unsigned int vendor,
const char *driver, void *data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_lte *lte;
GSList *l;
@@ -389,6 +395,7 @@ struct ofono_lte *ofono_lte_create(struct ofono_modem *modem,
int ofono_lte_driver_register(const struct ofono_lte_driver *d)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBG("driver: %p, name: %s", d, d->name);
if (d->probe == NULL)
@@ -401,6 +408,7 @@ int ofono_lte_driver_register(const struct ofono_lte_driver *d)
void ofono_lte_driver_unregister(const struct ofono_lte_driver *d)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBG("driver: %p, name: %s", d, d->name);
g_drivers = g_slist_remove(g_drivers, (void *) d);
@@ -408,6 +416,7 @@ void ofono_lte_driver_unregister(const struct ofono_lte_driver *d)
static void lte_atom_unregister(struct ofono_atom *atom)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBusConnection *conn = ofono_dbus_get_connection();
struct ofono_modem *modem = __ofono_atom_get_modem(atom);
const char *path = __ofono_atom_get_path(atom);
@@ -418,6 +427,7 @@ static void lte_atom_unregister(struct ofono_atom *atom)
static void ofono_lte_finish_register(struct ofono_lte *lte)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBusConnection *conn = ofono_dbus_get_connection();
struct ofono_modem *modem = __ofono_atom_get_modem(lte->atom);
const char *path = __ofono_atom_get_path(lte->atom);
@@ -439,6 +449,7 @@ static void ofono_lte_finish_register(struct ofono_lte *lte)
static void lte_init_default_attach_info_cb(const struct ofono_error *error,
void *data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_lte *lte = data;
ofono_lte_finish_register(lte);
@@ -446,6 +457,7 @@ static void lte_init_default_attach_info_cb(const struct ofono_error *error,
void ofono_lte_register(struct ofono_lte *lte)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct ofono_modem *modem = __ofono_atom_get_modem(lte->atom);
struct ofono_sim *sim = __ofono_atom_find(OFONO_ATOM_TYPE_SIM, modem);
const char *imsi = ofono_sim_get_imsi(sim);
@@ -469,20 +481,24 @@ void ofono_lte_register(struct ofono_lte *lte)
void ofono_lte_remove(struct ofono_lte *lte)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
__ofono_atom_free(lte->atom);
}
void ofono_lte_set_data(struct ofono_lte *lte, void *data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
lte->driver_data = data;
}
void *ofono_lte_get_data(const struct ofono_lte *lte)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return lte->driver_data;
}
struct ofono_modem *ofono_lte_get_modem(const struct ofono_lte *lte)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
return __ofono_atom_get_modem(lte->atom);
}

View File

@@ -46,11 +46,13 @@ static GMainLoop *event_loop;
void __ofono_exit(void)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
g_main_loop_quit(event_loop);
}
static gboolean quit_eventloop(gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
__ofono_exit();
return FALSE;
}
@@ -60,6 +62,7 @@ static unsigned int __terminated = 0;
static gboolean signal_handler(GIOChannel *channel, GIOCondition cond,
gpointer user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
struct signalfd_siginfo si;
ssize_t result;
int fd;
@@ -92,6 +95,7 @@ static gboolean signal_handler(GIOChannel *channel, GIOCondition cond,
static guint setup_signalfd(void)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GIOChannel *channel;
guint source;
sigset_t mask;
@@ -129,6 +133,7 @@ static guint setup_signalfd(void)
static void system_bus_disconnected(DBusConnection *conn, void *user_data)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
ofono_error("System bus has disconnected!");
g_main_loop_quit(event_loop);
@@ -144,6 +149,7 @@ static gboolean option_backtrace = TRUE;
static gboolean parse_debug(const char *key, const char *value,
gpointer user_data, GError **error)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
if (value) {
if (option_debug) {
char *prev = option_debug;
@@ -208,6 +214,7 @@ static GSourceFuncs event_funcs = {
int main(int argc, char **argv)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
GOptionContext *context;
GError *err = NULL;
DBusConnection *conn;

View File

@@ -31,6 +31,7 @@
static void append_modem(struct ofono_modem *modem, void *userdata)
{
DBG("func:%s,line:%d,file:%s", __func__, __LINE__, __FILE__);
DBusMessageIter *array = userdata;
const char *path = ofono_modem_get_path(modem);
DBusMessageIter entry, dict;