static void start_slot(struct mtk_data *md, struct socket_data *sock, const char *hex_prefix) { ofono_info("Physical slot %d in socket %s", md->slot, sock->path); md->ril = sock->ril; md->radio_state = sock->radio_state; g_ril_set_slot(md->ril, md->slot); if (getenv("OFONO_RIL_TRACE")) g_ril_set_trace(md->ril, TRUE); if (getenv("OFONO_RIL_HEX_TRACE")) g_ril_set_debugf(md->ril, mtk_debug, (char *) hex_prefix); g_ril_set_disconnect_function(md->ril, socket_disconnected, md->modem); g_ril_unregister(sock->ril, sock->radio_state_ev_id); g_ril_register(md->ril, RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED, mtk_radio_state_changed, md->modem); mtk_connected(md->modem); }
static int create_gril(struct ofono_modem *modem) { DBG(" modem: %p", modem); struct ril_data *ril = ofono_modem_get_data(modem); /* RIL expects user radio */ ril_switchUser(); char *path = ril_socket_path(); ril->modem = g_ril_new(path); g_free(path); path = NULL; g_ril_set_disconnect_function(ril->modem, gril_disconnected, modem); /* NOTE: Since AT modems open a tty, and then call * g_at_chat_new(), they're able to return -EIO if * the first fails, and -ENOMEM if the second fails. * in our case, we already return -EIO if the ril_new * fails. If this is important, we can create a ril_socket * abstraction... ( probaby not a bad idea ). */ if (ril->modem == NULL) { DBG("g_ril_new() failed to create modem!"); return -EIO; } if (getenv("OFONO_RIL_TRACE")) g_ril_set_trace(ril->modem, TRUE); if (getenv("OFONO_RIL_HEX_TRACE")) g_ril_set_debugf(ril->modem, ril_debug, "Device: "); g_ril_register(ril->modem, RIL_UNSOL_RIL_CONNECTED, ril_connected, modem); ofono_devinfo_create(modem, 0, "rilmodem", ril->modem); return 0; }