* [PATCH_v2] plugins: update ofono rule and udev for using speedupcdma
@ 2011-07-20 10:51 Guillaume Zajac
2011-07-20 11:02 ` Marcel Holtmann
2011-07-20 11:03 ` [PATCH_v3] speedupcdma: add speedup cdma skeleton plugin Guillaume Zajac
0 siblings, 2 replies; 6+ messages in thread
From: Guillaume Zajac @ 2011-07-20 10:51 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1434 bytes --]
---
plugins/ofono.rules | 9 ++++++---
plugins/udev.c | 2 ++
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/plugins/ofono.rules b/plugins/ofono.rules
index 1aef4bd..54df1bc 100644
--- a/plugins/ofono.rules
+++ b/plugins/ofono.rules
@@ -420,10 +420,13 @@ ATTRS{idVendor}=="19d2", ENV{OFONO_DRIVER}="zte"
ATTRS{idVendor}=="19d2", ATTRS{serial}=="1234567890ABCDEF", ENV{ID_SERIAL_SHORT}=""
-# SpeedUp
-ATTRS{idVendor}=="1c9e", ENV{OFONO_DRIVER}="speedup"
+# SpeedUp 7300
+ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9e00", ENV{OFONO_DRIVER}="speedupcdma"
+
+# SpeedUp 9800
+ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9800", ENV{OFONO_DRIVER}="speedup"
-ATTRS{idVendor}=="1c9e", ATTRS{serial}=="1234567890ABCDEF", ENV{ID_SERIAL_SHORT}=""
+ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9800", ATTRS{serial}=="1234567890ABCDEF", ENV{ID_SERIAL_SHORT}=""
ATTRS{idVendor}=="2020", ENV{OFONO_DRIVER}="speedup"
diff --git a/plugins/udev.c b/plugins/udev.c
index a28bea7..b50ca2f 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -793,6 +793,8 @@ done:
add_linktop(modem, udev_device);
else if (g_strcmp0(driver, "speedup") == 0)
add_speedup(modem, udev_device);
+ else if (g_strcmp0(driver, "speedupcdma") == 0)
+ add_speedup(modem, udev_device);
}
static gboolean devpath_remove(gpointer key, gpointer value, gpointer user_data)
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH_v2] plugins: update ofono rule and udev for using speedupcdma
2011-07-20 10:51 [PATCH_v2] plugins: update ofono rule and udev for using speedupcdma Guillaume Zajac
@ 2011-07-20 11:02 ` Marcel Holtmann
2011-07-20 11:07 ` Guillaume Zajac
2011-07-20 11:03 ` [PATCH_v3] speedupcdma: add speedup cdma skeleton plugin Guillaume Zajac
1 sibling, 1 reply; 6+ messages in thread
From: Marcel Holtmann @ 2011-07-20 11:02 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]
Hi Guillaume,
> -# SpeedUp
> -ATTRS{idVendor}=="1c9e", ENV{OFONO_DRIVER}="speedup"
> +# SpeedUp 7300
> +ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9e00", ENV{OFONO_DRIVER}="speedupcdma"
> +
> +# SpeedUp 9800
> +ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9800", ENV{OFONO_DRIVER}="speedup"
>
> -ATTRS{idVendor}=="1c9e", ATTRS{serial}=="1234567890ABCDEF", ENV{ID_SERIAL_SHORT}=""
> +ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9800", ATTRS{serial}=="1234567890ABCDEF", ENV{ID_SERIAL_SHORT}=""
is the serial number really fake. Adding the content of usb-devices
script for this specific modem would help here.
Or has this just been copied over from the Huawei entries and we missed
it in the review?
> ATTRS{idVendor}=="2020", ENV{OFONO_DRIVER}="speedup"
>
> diff --git a/plugins/udev.c b/plugins/udev.c
> index a28bea7..b50ca2f 100644
> --- a/plugins/udev.c
> +++ b/plugins/udev.c
> @@ -793,6 +793,8 @@ done:
> add_linktop(modem, udev_device);
> else if (g_strcmp0(driver, "speedup") == 0)
> add_speedup(modem, udev_device);
> + else if (g_strcmp0(driver, "speedupcdma") == 0)
> + add_speedup(modem, udev_device);
Coding style mistake here. Tabs vs spaces.
Regards
Marcel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH_v3] speedupcdma: add speedup cdma skeleton plugin
2011-07-20 10:51 [PATCH_v2] plugins: update ofono rule and udev for using speedupcdma Guillaume Zajac
2011-07-20 11:02 ` Marcel Holtmann
@ 2011-07-20 11:03 ` Guillaume Zajac
2011-07-20 11:47 ` Marcel Holtmann
1 sibling, 1 reply; 6+ messages in thread
From: Guillaume Zajac @ 2011-07-20 11:03 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 5990 bytes --]
Remove unused variable into speedupcdma_remove()
---
Makefile.am | 3 +
plugins/speedupcdma.c | 207 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 210 insertions(+), 0 deletions(-)
create mode 100644 plugins/speedupcdma.c
diff --git a/Makefile.am b/Makefile.am
index a4e6c95..4b72091 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -336,6 +336,9 @@ builtin_sources += plugins/telit.c
builtin_modules += speedup
builtin_sources += plugins/speedup.c
+builtin_modules += speedupcdma
+builtin_sources += plugins/speedupcdma.c
+
if BLUETOOTH
builtin_modules += bluetooth
builtin_sources += plugins/bluetooth.c plugins/bluetooth.h
diff --git a/plugins/speedupcdma.c b/plugins/speedupcdma.c
new file mode 100644
index 0000000..9da6200
--- /dev/null
+++ b/plugins/speedupcdma.c
@@ -0,0 +1,207 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#include <glib.h>
+#include <gatchat.h>
+#include <gattty.h>
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include <ofono/plugin.h>
+#include <ofono/modem.h>
+#include <ofono/devinfo.h>
+#include <ofono/cdma-connman.h>
+#include <ofono/log.h>
+
+#include <drivers/atmodem/atutil.h>
+
+static const char *none_prefix[] = { NULL };
+
+struct speedupcdma_data {
+ GAtChat *chat;
+};
+
+static void speedupcdma_debug(const char *str, void *data)
+{
+ const char *prefix = data;
+
+ ofono_info("%s%s", prefix, str);
+}
+
+static int speedupcdma_probe(struct ofono_modem *modem)
+{
+ struct speedupcdma_data *data;
+
+ DBG("%p", modem);
+
+ data = g_try_new0(struct speedupcdma_data, 1);
+ if (data == NULL)
+ return -ENOMEM;
+
+ ofono_modem_set_data(modem, data);
+
+ return 0;
+}
+
+static void speedupcdma_remove(struct ofono_modem *modem)
+{
+ DBG("%p", modem);
+
+ ofono_modem_set_data(modem, NULL);
+}
+
+static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+
+ DBG("");
+
+ if (!ok) {
+ struct speedupcdma_data *data = ofono_modem_get_data(modem);
+
+ g_at_chat_unref(data->chat);
+ data->chat == NULL;
+
+ ofono_modem_set_powered(modem, FALSE);
+ return;
+ }
+
+ ofono_modem_set_powered(modem, TRUE);
+}
+
+static int speedupcdma_enable(struct ofono_modem *modem)
+{
+ struct speedupcdma_data *data = ofono_modem_get_data(modem);
+ GAtSyntax *syntax;
+ GIOChannel *channel;
+ const char *modem_path;
+
+ modem_path = ofono_modem_get_string(modem, "Modem");
+ if (modem_path == NULL)
+ return -EINVAL;
+
+ DBG("path is: %s", modem_path);
+
+ channel = g_at_tty_open(modem_path, NULL);
+ if (channel == NULL)
+ return -EIO;
+
+ syntax = g_at_syntax_new_gsm_permissive();
+ data->chat = g_at_chat_new(channel, syntax);
+ g_at_syntax_unref(syntax);
+
+ g_io_channel_unref(channel);
+
+ if (data->chat == NULL)
+ return -ENOMEM;
+
+ if (getenv("OFONO_AT_DEBUG"))
+ g_at_chat_set_debug(data->chat, speedupcdma_debug, "Modem: ");
+
+ g_at_chat_send(data->chat, "ATE0 +CMEE=1", none_prefix,
+ NULL, NULL, NULL);
+
+ g_at_chat_send(data->chat, "AT+CFUN=1", none_prefix,
+ cfun_enable, modem, NULL);
+
+ return -EINPROGRESS;
+}
+
+static void cfun_disable(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct speedupcdma_data *data = ofono_modem_get_data(modem);
+
+ DBG("");
+
+ g_at_chat_unref(data->chat);
+ data->chat = NULL;
+
+ if (ok)
+ ofono_modem_set_powered(modem, FALSE);
+}
+
+static int speedupcdma_disable(struct ofono_modem *modem)
+{
+ struct speedupcdma_data *data = ofono_modem_get_data(modem);
+
+ DBG("%p", modem);
+
+ g_at_chat_send(data->chat, "AT+CFUN=0", none_prefix,
+ cfun_disable, modem, NULL);
+
+ return -EINPROGRESS;
+}
+
+static void speedupcdma_pre_sim(struct ofono_modem *modem)
+{
+ struct speedupcdma_data *data = ofono_modem_get_data(modem);
+
+ DBG("%p", modem);
+
+ ofono_devinfo_create(modem, 0, "cdmamodem", data->chat);
+}
+
+static void speedupcdma_post_sim(struct ofono_modem *modem)
+{
+ DBG("%p", modem);
+}
+
+static void speedupcdma_post_online(struct ofono_modem *modem)
+{
+ struct speedupcdma_data *data = ofono_modem_get_data(modem);
+
+ DBG("%p", modem);
+
+ ofono_cdma_connman_create(modem, 0, "cdmamodem", data->chat);
+}
+
+static struct ofono_modem_driver speedupcdma_driver = {
+ .name = "speedupcdma",
+ .probe = speedupcdma_probe,
+ .remove = speedupcdma_remove,
+ .enable = speedupcdma_enable,
+ .disable = speedupcdma_disable,
+ .pre_sim = speedupcdma_pre_sim,
+ .post_sim = speedupcdma_post_sim,
+ .post_online = speedupcdma_post_online,
+};
+
+static int speedupcdma_init(void)
+{
+ return ofono_modem_driver_register(&speedupcdma_driver);
+}
+
+static void speedupcdma_exit(void)
+{
+ ofono_modem_driver_unregister(&speedupcdma_driver);
+}
+
+OFONO_PLUGIN_DEFINE(speedupcdma, "Speedup CDMA modem driver", VERSION,
+ OFONO_PLUGIN_PRIORITY_DEFAULT,
+ speedupcdma_init, speedupcdma_exit)
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH_v2] plugins: update ofono rule and udev for using speedupcdma
2011-07-20 11:02 ` Marcel Holtmann
@ 2011-07-20 11:07 ` Guillaume Zajac
2011-07-20 11:47 ` Marcel Holtmann
0 siblings, 1 reply; 6+ messages in thread
From: Guillaume Zajac @ 2011-07-20 11:07 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2006 bytes --]
Hi Marcel,
On 20/07/2011 13:02, Marcel Holtmann wrote:
> Hi Guillaume,
>
>> -# SpeedUp
>> -ATTRS{idVendor}=="1c9e", ENV{OFONO_DRIVER}="speedup"
>> +# SpeedUp 7300
>> +ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9e00", ENV{OFONO_DRIVER}="speedupcdma"
>> +
>> +# SpeedUp 9800
>> +ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9800", ENV{OFONO_DRIVER}="speedup"
>>
>> -ATTRS{idVendor}=="1c9e", ATTRS{serial}=="1234567890ABCDEF", ENV{ID_SERIAL_SHORT}=""
>> +ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9800", ATTRS{serial}=="1234567890ABCDEF", ENV{ID_SERIAL_SHORT}=""
> is the serial number really fake. Adding the content of usb-devices
> script for this specific modem would help here.
>
> Or has this just been copied over from the Huawei entries and we missed
> it in the review?
Sorry I committed a wrong patch, I will send you the right version of
this patch later.
This serial, is not a fake, in using usb-devices with the dongle I got
before usb_modeswitch:
T: Bus=02 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 84 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=1c9e ProdID=9800 Rev=00.00
S: Manufacturer=USB Modem
S: Product=USB Modem
S: SerialNumber=1234567890ABCDEF
C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
I: If#= 1 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
>
>> ATTRS{idVendor}=="2020", ENV{OFONO_DRIVER}="speedup"
>>
>> diff --git a/plugins/udev.c b/plugins/udev.c
>> index a28bea7..b50ca2f 100644
>> --- a/plugins/udev.c
>> +++ b/plugins/udev.c
>> @@ -793,6 +793,8 @@ done:
>> add_linktop(modem, udev_device);
>> else if (g_strcmp0(driver, "speedup") == 0)
>> add_speedup(modem, udev_device);
>> + else if (g_strcmp0(driver, "speedupcdma") == 0)
>> + add_speedup(modem, udev_device);
> Coding style mistake here. Tabs vs spaces.
>
> Regards
>
> Marcel
>
Kind regards,
Guillaume
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH_v2] plugins: update ofono rule and udev for using speedupcdma
2011-07-20 11:07 ` Guillaume Zajac
@ 2011-07-20 11:47 ` Marcel Holtmann
0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2011-07-20 11:47 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1602 bytes --]
Hi Guillaume,
> >> -# SpeedUp
> >> -ATTRS{idVendor}=="1c9e", ENV{OFONO_DRIVER}="speedup"
> >> +# SpeedUp 7300
> >> +ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9e00", ENV{OFONO_DRIVER}="speedupcdma"
> >> +
> >> +# SpeedUp 9800
> >> +ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9800", ENV{OFONO_DRIVER}="speedup"
> >>
> >> -ATTRS{idVendor}=="1c9e", ATTRS{serial}=="1234567890ABCDEF", ENV{ID_SERIAL_SHORT}=""
> >> +ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9800", ATTRS{serial}=="1234567890ABCDEF", ENV{ID_SERIAL_SHORT}=""
> > is the serial number really fake. Adding the content of usb-devices
> > script for this specific modem would help here.
> >
> > Or has this just been copied over from the Huawei entries and we missed
> > it in the review?
>
> Sorry I committed a wrong patch, I will send you the right version of
> this patch later.
> This serial, is not a fake, in using usb-devices with the dongle I got
> before usb_modeswitch:
>
> T: Bus=02 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 84 Spd=480 MxCh= 0
> D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
> P: Vendor=1c9e ProdID=9800 Rev=00.00
> S: Manufacturer=USB Modem
> S: Product=USB Modem
> S: SerialNumber=1234567890ABCDEF
> C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
> I: If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
> I: If#= 1 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
this is a fake serial number, but that is fine, it is before the mode
switch to TTY mode. I care about the serial number after mode switch.
Regards
Marcel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH_v3] speedupcdma: add speedup cdma skeleton plugin
2011-07-20 11:03 ` [PATCH_v3] speedupcdma: add speedup cdma skeleton plugin Guillaume Zajac
@ 2011-07-20 11:47 ` Marcel Holtmann
0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2011-07-20 11:47 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 324 bytes --]
Hi Guillaume,
> Remove unused variable into speedupcdma_remove()
<snip>
> +static void speedupcdma_remove(struct ofono_modem *modem)
> +{
> + DBG("%p", modem);
> +
> + ofono_modem_set_data(modem, NULL);
> +}
You do actually have to free the data. Otherwise you are leaking memory.
Regards
Marcel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-07-20 11:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-20 10:51 [PATCH_v2] plugins: update ofono rule and udev for using speedupcdma Guillaume Zajac
2011-07-20 11:02 ` Marcel Holtmann
2011-07-20 11:07 ` Guillaume Zajac
2011-07-20 11:47 ` Marcel Holtmann
2011-07-20 11:03 ` [PATCH_v3] speedupcdma: add speedup cdma skeleton plugin Guillaume Zajac
2011-07-20 11:47 ` Marcel Holtmann
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.