Hi Gustavo,
On 09/27/2011 04:04 PM, Gustavo F. Padovan wrote:
> From: "Gustavo F. Padovan" <[email protected]>
>
> Support to disable the SAP modem from the sap plugin
> ---
> plugins/bluetooth.h | 1 +
> plugins/telit.c | 30 ++++++++++++++++++++++++++++++
> 2 files changed, 31 insertions(+), 0 deletions(-)
>
> diff --git a/plugins/bluetooth.h b/plugins/bluetooth.h
> index 6cde7bc..96e3215 100644
> --- a/plugins/bluetooth.h
> +++ b/plugins/bluetooth.h
> @@ -46,6 +46,7 @@ struct bluetooth_profile {
> struct bluetooth_sap_driver {
> const char *name;
> int (*enable) (struct ofono_modem *modem);
> + int (*disable) (struct ofono_modem *modem);
> };
>
> struct server;
> diff --git a/plugins/telit.c b/plugins/telit.c
> index a5f9941..b9a5b23 100644
> --- a/plugins/telit.c
> +++ b/plugins/telit.c
> @@ -139,6 +139,20 @@ static void rsen_enable_cb(gboolean ok, GAtResult
> *result, gpointer user_data)
> }
> }
>
> +static void rsen_disable_cb(gboolean ok, GAtResult *result, gpointer
> user_data)
> +{
> + struct ofono_modem *modem = user_data;
> + struct telit_data *data = ofono_modem_get_data(modem);
> +
> + DBG("%p", modem);
> +
> + g_at_chat_unref(data->chat);
> + data->chat = NULL;
> +
> + if (ok)
> + ofono_modem_set_powered(modem, FALSE);
> +}
> +
> static int telit_sap_open()
> {
> const char *device = "/dev/ttyUSB4";
> @@ -191,9 +205,25 @@ static int telit_sap_enable(struct ofono_modem *modem)
> return fd;
> }
>
> +static int telit_sap_disable(struct ofono_modem *modem)
> +{
> + struct telit_data *data = ofono_modem_get_data(modem);
> +
> + DBG("%p", modem);
> +
> + g_at_chat_cancel_all(data->chat);
> + g_at_chat_unregister_all(data->chat);
> +
> + g_at_chat_send(data->chat, "AT#RSEN=0", rsen_prefix,
> + rsen_disable_cb, modem, NULL);
> +
> + return 0;
Do you mean to return -EINPROGRESS here?
> +}
> +
> static struct bluetooth_sap_driver sap_driver = {
> .name = "telit",
> .enable = telit_sap_enable,
> + .disable = telit_sap_disable,
> };
>
> static int telit_probe(struct ofono_modem *modem)
Regards,
-Denis
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono