Ejemplo n.º 1
0
static int ril_enable(struct ofono_modem *modem)
{
	struct ril_data *rd = ofono_modem_get_data(modem);

	DBG("");

	rd->ril = g_ril_new("/tmp/rild", OFONO_RIL_VENDOR_AOSP);
	if (rd->ril == NULL) {
		ofono_error("g_ril_new() failed to create modem!");
		return -EIO;
	}

	if (getenv("OFONO_RIL_TRACE"))
		g_ril_set_trace(rd->ril, TRUE);

	if (getenv("OFONO_RIL_HEX_TRACE"))
		g_ril_set_debugf(rd->ril, ril_debug, "IntelModem:");

	g_ril_register(rd->ril, RIL_UNSOL_RIL_CONNECTED,
						ril_connected, modem);

	g_ril_register(rd->ril, RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED,
					ril_radio_state_changed, modem);

	return -EINPROGRESS;
}
Ejemplo n.º 2
0
Archivo: mtk.c Proyecto: semafor/ofono
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);
}
Ejemplo n.º 3
0
Archivo: ril.c Proyecto: endocode/ofono
static int create_gril(struct ofono_modem *modem)
{
	struct ril_data *rd = ofono_modem_get_data(modem);
	int slot_id = ofono_modem_get_integer(modem, "Slot");

	ofono_info("Using %s as socket for slot %d.",
					RILD_CMD_SOCKET[slot_id], slot_id);

	/* RIL expects user radio to connect to the socket */
	rd->ril = g_ril_new_with_ucred(RILD_CMD_SOCKET[slot_id],
						OFONO_RIL_VENDOR_AOSP,
						RADIO_UID, RADIO_GID);

	/* 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 (rd->ril == NULL) {
		ofono_error("g_ril_new() failed to create modem!");
		return -EIO;
	}
	g_ril_set_slot(rd->ril, slot_id);

	if (getenv("OFONO_RIL_TRACE"))
		g_ril_set_trace(rd->ril, TRUE);

	if (getenv("OFONO_RIL_HEX_TRACE"))
		g_ril_set_debugf(rd->ril, ril_debug, GRIL_HEX_PREFIX[slot_id]);

	g_ril_register(rd->ril, RIL_UNSOL_RIL_CONNECTED,
			ril_connected, modem);

	g_ril_register(rd->ril, RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED,
			ril_radio_state_changed, modem);

	return 0;
}
Ejemplo n.º 4
0
Archivo: ril.c Proyecto: CODeRUS/ofono
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;
}
Ejemplo n.º 5
0
Archivo: ril.c Proyecto: jpakkane/ofono
static int ril_enable(struct ofono_modem *modem)
{
	struct ril_data *ril = ofono_modem_get_data(modem);

	DBG("");

	ril->modem = g_ril_new(RILD_CMD_SOCKET);

	/* 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);

	g_ril_register(ril->modem, RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED,
			ril_radio_state_changed, modem);

	ofono_devinfo_create(modem, 0, RILMODEM, ril->modem);

	return -EINPROGRESS;
}
Ejemplo n.º 6
0
Archivo: mtk.c Proyecto: semafor/ofono
static int create_gril(struct ofono_modem *modem)
{
	struct mtk_data *md = ofono_modem_get_data(modem);
	struct socket_data *sock;
	int sock_num;

	DBG("slot %d", md->slot);

	if (md->ril != NULL)
		return 0;

	sock = g_try_malloc0(sizeof(*sock));
	if (sock == NULL) {
		ofono_error("%s: Cannot allocate socket_data", __func__);
		return -ENOMEM;
	}

	if (md->slot == MULTISIM_SLOT_0) {
		sock_num = SOCKET_NUM_FOR_DBG_0;
		sock->path = sock_slot_0;
	} else {
		sock_num = SOCKET_NUM_FOR_DBG_1;
		sock->path = sock_slot_1;
	}

	/* Opens the socket to RIL */
	sock->ril = g_ril_new(sock->path, OFONO_RIL_VENDOR_MTK);

	/*
	 * 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 (sock->ril == NULL) {
		ofono_error("g_ril_new() failed to connect to %s!", sock->path);
		g_free(sock);
		return -EIO;
	} else if (md->slot == MULTISIM_SLOT_0) {
		sock_0 = sock;
	} else {
		sock_1 = sock;
	}

	sock->radio_state = RADIO_STATE_UNAVAILABLE;
	sock->radio_state_ev_id =
		g_ril_register(sock->ril,
				RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED,
				radio_state_changed, sock);

	g_ril_register(sock->ril, MTK_RIL_UNSOL_RESPONSE_PLMN_CHANGED,
			plmn_changed, modem);
	g_ril_register(sock->ril, MTK_RIL_UNSOL_RESPONSE_REGISTRATION_SUSPENDED,
			reg_suspended, modem);

	/* sock_num is negative to avoid confusion with physical slots */
	g_ril_set_slot(sock->ril, sock_num);

	g_ril_set_vendor_print_msg_id_funcs(sock->ril,
						mtk_request_id_to_string,
						mtk_unsol_request_to_string);

	if (getenv("OFONO_RIL_TRACE"))
		g_ril_set_trace(sock->ril, TRUE);

	if (getenv("OFONO_RIL_HEX_TRACE"))
		g_ril_set_debugf(sock->ril, mtk_debug, (char *) sock->path);

	return 0;
}