All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH -v5 03/13] telit: add support the enable the SAP client modem
Date: Thu, 29 Sep 2011 10:53:18 -0500	[thread overview]
Message-ID: <4E84946E.4080308@gmail.com> (raw)
In-Reply-To: <1317245061-6312-3-git-send-email-padovan@profusion.mobi>

[-- Attachment #1: Type: text/plain, Size: 3287 bytes --]

Hi Gustavo,

On 09/28/2011 04:24 PM, Gustavo F. Padovan wrote:
> From: "Gustavo F. Padovan" <padovan@profusion.mobi>
> 
> ---
>  plugins/bluetooth.h |    3 +-
>  plugins/telit.c     |  191 ++++++++++++++++++++++++++++++++++++++++++++++++---
>  2 files changed, 184 insertions(+), 10 deletions(-)

Patch has been applied, see below:

> +static int telit_sap_open()
> +{
> +	const char *device = "/dev/ttyUSB4";

This part should probably come from udev or a config file somewhere.
Worst case /etc/ofono/telitsap.conf or something like that.

> +	struct termios ti;
> +	int fd;
> +
> +	DBG("%s", device);
> +
> +	fd = open(device, O_RDWR | O_NOCTTY | O_NONBLOCK);
> +	if (fd < 0)
> +		return -EINVAL;
>  
> +	/* Switch TTY to raw mode */
> +	memset(&ti, 0, sizeof(ti));
> +	cfmakeraw(&ti);
> +
> +	ti.c_cflag |= (B115200 | CLOCAL | CREAD);
> +
> +	tcflush(fd, TCIOFLUSH);
> +	if (tcsetattr(fd, TCSANOW, &ti) < 0) {
> +		close(fd);
> +		return -EBADF;
> +	}
> +
> +	return fd;
>  }
>  
> -static int telit_sap_enable(struct ofono_modem *modem)
> +static int telit_sap_enable(struct ofono_modem *modem,
> +					struct ofono_modem *sap_modem,
> +					int bt_fd)
>  {
>  	struct telit_data *data = ofono_modem_get_data(modem);
> +	int fd;
>  
>  	DBG("%p", modem);
>  
> -	data->chat = open_device(modem, "Data", "Aux: ");
> -	if (data->chat == NULL)
> +	data->aux = open_device(modem, "Data", "Aux: ");
> +	if (data->aux == NULL)
>  		return -EINVAL;
>  
> -	g_at_chat_register(data->chat, "#RSEN:", telit_rsen_notify,
> +	fd = telit_sap_open();
> +	if (fd < 0)
> +		return fd;
> +
> +	data->hw_io = g_io_channel_unix_new(fd);
> +	if (data->hw_io == NULL) {
> +		close(fd);

You weren't closing the aux channel here

> +		return -ENOMEM;
> +	}
> +
> +	g_io_channel_set_encoding(data->hw_io, NULL, NULL);
> +	g_io_channel_set_buffered(data->hw_io, FALSE);
> +	g_io_channel_set_close_on_unref(data->hw_io, TRUE);
> +
> +	data->hw_watch = g_io_add_watch_full(data->hw_io, G_PRIORITY_DEFAULT,
> +				G_IO_HUP | G_IO_ERR | G_IO_NVAL | G_IO_IN,
> +				hw_event_cb, modem, hw_watch_remove);
> +
> +	data->bt_io = g_io_channel_unix_new(bt_fd);
> +	if (data->bt_io == NULL) {
> +		sap_close_io(modem);
> +		return -ENOMEM;
> +	}
> +
> +	g_io_channel_set_encoding(data->bt_io, NULL, NULL);
> +	g_io_channel_set_buffered(data->bt_io, FALSE);
> +	g_io_channel_set_close_on_unref(data->bt_io, TRUE);
> +
> +	data->bt_watch = g_io_add_watch_full(data->bt_io, G_PRIORITY_DEFAULT,
> +				G_IO_HUP | G_IO_ERR | G_IO_NVAL | G_IO_IN,
> +				bt_event_cb, modem, bt_watch_remove);
> +
> +
> +	data->sap_modem = sap_modem;
> +
> +	g_at_chat_register(data->aux, "#RSEN:", telit_rsen_notify,
>  				FALSE, modem, NULL);
>  
> -	g_at_chat_send(data->chat, "AT#NOPT=3", NULL, NULL, NULL, NULL);
> +	g_at_chat_send(data->aux, "AT#NOPT=0", NULL, NULL, NULL, NULL);
>  
>  	/* Set SAP functionality */
> -	g_at_chat_send(data->chat, "AT#RSEN=1,1,0,2,0", rsen_prefix,
> +	g_at_chat_send(data->aux, "AT#RSEN=1,1,0,2,0", rsen_prefix,
>  				rsen_enable_cb, modem, NULL);
>  
>  	return -EINPROGRESS;

So I reflowed this function in a follow on patch, please double check it
for correctness.

Regards,
-Denis

  parent reply	other threads:[~2011-09-29 15:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-28 21:24 [PATCH -v5 01/13] udevng: look also to VID Gustavo F. Padovan
2011-09-28 21:24 ` [PATCH -v5 02/13] sap: remove connect callback if enable fails Gustavo F. Padovan
2011-09-28 21:24   ` [PATCH -v5 03/13] telit: add support the enable the SAP client modem Gustavo F. Padovan
2011-09-28 21:24     ` [PATCH -v5 04/13] sap: enable SAP modem, when BlueZ replies Gustavo F. Padovan
2011-09-28 21:24       ` [PATCH -v5 05/13] telit: add suport the disable SAP client Gustavo F. Padovan
2011-09-28 21:24         ` [PATCH -v5 06/13] sap: add sap modem disable() support Gustavo F. Padovan
2011-09-28 21:24           ` [PATCH -v5 07/13] telit: enable the telit modem after enable SAP client Gustavo F. Padovan
2011-09-28 21:24             ` [PATCH -v5 08/13] telit: add pre_sim support to SAP Client Gustavo F. Padovan
2011-09-28 21:24               ` [PATCH -v5 09/13] telit: add post_sim " Gustavo F. Padovan
2011-09-28 21:24                 ` [PATCH -v5 10/13] telit: add set_online " Gustavo F. Padovan
2011-09-28 21:24                   ` [PATCH -v5 11/13] telit: add post_online " Gustavo F. Padovan
2011-09-28 21:24                     ` [PATCH -v5 12/13] sap: add full support to SAP modem Gustavo F. Padovan
2011-09-28 21:24                       ` [PATCH -v5 13/13] sap: clean up extra blank line Gustavo F. Padovan
2011-09-29 16:22                         ` Denis Kenzior
2011-09-29 16:22                       ` [PATCH -v5 12/13] sap: add full support to SAP modem Denis Kenzior
2011-09-29 16:21                     ` [PATCH -v5 11/13] telit: add post_online to SAP Client Denis Kenzior
2011-09-29 16:20                   ` [PATCH -v5 10/13] telit: add set_online " Denis Kenzior
2011-09-29 16:20                 ` [PATCH -v5 09/13] telit: add post_sim " Denis Kenzior
2011-09-29 16:20               ` [PATCH -v5 08/13] telit: add pre_sim support " Denis Kenzior
2011-09-29 16:19             ` [PATCH -v5 07/13] telit: enable the telit modem after enable SAP client Denis Kenzior
2011-09-29 16:15         ` [PATCH -v5 05/13] telit: add suport the disable " Denis Kenzior
2011-09-29 15:54       ` [PATCH -v5 04/13] sap: enable SAP modem, when BlueZ replies Denis Kenzior
2011-09-29 15:53     ` Denis Kenzior [this message]
2011-09-29 15:50   ` [PATCH -v5 02/13] sap: remove connect callback if enable fails Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E84946E.4080308@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.