Re: [PATCH] Add send_method_call to g_dbus

2010-04-21 Thread Kalle Valo
Denis Kenzior denk...@gmail.com writes:

 Hi Kalle,

Hi Denis,

 Gustavo F. Padovan gust...@padovan.org writes:
  Puting send_method_call and send_method_call_with_reply on g_dbus will
  avoid some code duplication and will make things easier mainly for the
  Bluetooth plugins (HFP, DUN, SAP) inside oFono.
 
 Sorry, totally unrelated to this patch, but is there a BT DUN plugin for
 ofono available somewhere? I would love to test it.
 

 There is none yet, but it is something we're planning to implement.  But just 
 to make sure we're all talking about the same thing, what DUN profile role 
 (client or server?) are you actually interested in?

Good point, I should be more clear here. I'm talking about the client
mode.

I would like to connect my laptop to Internet through my N900 using no
cables and I think BT DUN client mode is the easiest choise here. At
least I have BT DUN already working in N900.

 The oFono plugin will be for the server role, the client role will
 probably be a plugin in BlueZ.

But who, and how, will issue the necessary AT commands and run the PPP
stack in the BT DUN client mode? Wouldn't it be easiest if ofono would
do that? (Just asking.)

A kind request to the list maintainers: please disable the reply-to
header, it just makes things difficult. I prefer to have CCs so that I
get replies to my inbox and answer quickly. This is how all kernel
mailing lists work I know of work.


-- 
Kalle Valo
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] Fix Let data device be optional for mbm driver

2010-04-21 Thread Denis Kenzior
Hi Zhenhua,

 ttyACM0 is described as 'Dell Wireless 5530 HSPA Mobile Broadband
 Minicard Modem'.
 
 ttyACM1 is described as 'Dell Wireless 5530 HSPA Mobile Broadband
 Minicard Modem 2'.

Patch has been applied.  Thanks.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] ppp: implement MRU option

2010-04-21 Thread Kristen Carlson Accardi
If the peer requests a MRU option, set the mtu for the network
phase.  When we are in link establishment phase, we should
continue to behave as if no option has been set and the peer
should use the default MRU.

This option is required for the Huawei E160G modem.
---
 gatchat/gatppp.c  |   16 
 gatchat/ppp.h |2 ++
 gatchat/ppp_lcp.c |4 
 gatchat/ppp_net.c |   13 +++--
 4 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c
index e1e49e6..b7834e3 100644
--- a/gatchat/gatppp.c
+++ b/gatchat/gatppp.c
@@ -40,6 +40,7 @@
 #include ppp.h
 
 #define DEFAULT_MRU1500
+#define DEFAULT_MTU1500
 
 #define BUFFERSZ   (DEFAULT_MRU * 2)
 
@@ -58,6 +59,7 @@ struct _GAtPPP {
guint8 buffer[BUFFERSZ];
int index;
gint mru;
+   gint mtu;
char username[256];
char password[256];
guint32 xmit_accm[8];
@@ -407,6 +409,8 @@ void ppp_net_up_notify(GAtPPP *ppp, const char *ip,
 {
ppp-net = ppp_net_new(ppp);
 
+   ppp_net_set_mtu(ppp-net, ppp-mtu);
+
if (ppp-connect_cb == NULL)
return;
 
@@ -435,6 +439,17 @@ void ppp_set_xmit_accm(GAtPPP *ppp, guint32 accm)
ppp-xmit_accm[0] = accm;
 }
 
+/*
+ * The only time we use other than default MTU is when we are in
+ * the network phase.
+ */
+void ppp_set_mtu(GAtPPP *ppp, const guint8 *data)
+{
+   guint16 mtu = get_host_short(data);
+
+   ppp-mtu = mtu;
+}
+
 /* Administrative Open */
 void g_at_ppp_open(GAtPPP *ppp)
 {
@@ -576,6 +591,7 @@ GAtPPP *g_at_ppp_new(GIOChannel *modem)
 
/* set options to defaults */
ppp-mru = DEFAULT_MRU;
+   ppp-mtu = DEFAULT_MTU;
ppp-recv_accm = ~0U;
ppp-xmit_accm[0] = ~0U;
ppp-xmit_accm[3] = 0x6000; /* 0x7d, 0x7e */
diff --git a/gatchat/ppp.h b/gatchat/ppp.h
index a8a0486..07483a9 100644
--- a/gatchat/ppp.h
+++ b/gatchat/ppp.h
@@ -103,6 +103,7 @@ struct ppp_net *ppp_net_new(GAtPPP *ppp);
 const char *ppp_net_get_interface(struct ppp_net *net);
 void ppp_net_process_packet(struct ppp_net *net, guint8 *packet);
 void ppp_net_free(struct ppp_net *net);
+void ppp_net_set_mtu(struct ppp_net *net, guint16 mtu);
 
 /* PPP functions related to main GAtPPP object */
 void ppp_debug(GAtPPP *ppp, const char *str);
@@ -115,3 +116,4 @@ void ppp_net_up_notify(GAtPPP *ppp, const char *ip,
 void ppp_net_down_notify(GAtPPP *ppp);
 void ppp_set_recv_accm(GAtPPP *ppp, guint32 accm);
 void ppp_set_xmit_accm(GAtPPP *ppp, guint32 accm);
+void ppp_set_mtu(GAtPPP *ppp, const guint8 *data);
diff --git a/gatchat/ppp_lcp.c b/gatchat/ppp_lcp.c
index 5cf5656..8639c6c 100644
--- a/gatchat/ppp_lcp.c
+++ b/gatchat/ppp_lcp.c
@@ -197,6 +197,7 @@ static enum rcr_result lcp_rcr(struct pppcp_data *pppcp,
case ACCM:
case PFC:
case ACFC:
+   case MRU:
break;
 
case MAGIC_NUMBER:
@@ -226,6 +227,9 @@ static enum rcr_result lcp_rcr(struct pppcp_data *pppcp,
case AUTH_PROTO:
ppp_set_auth(ppp, ppp_option_iter_get_data(iter));
break;
+   case MRU:
+   ppp_set_mtu(ppp, ppp_option_iter_get_data(iter));
+   break;
case MAGIC_NUMBER:
case PFC:
case ACFC:
diff --git a/gatchat/ppp_net.c b/gatchat/ppp_net.c
index 325e859..c1f2eb4 100644
--- a/gatchat/ppp_net.c
+++ b/gatchat/ppp_net.c
@@ -38,7 +38,6 @@
 #include gatppp.h
 #include ppp.h
 
-/* XXX should be maximum IP Packet size */
 #define MAX_PACKET 1500
 
 struct ppp_net {
@@ -46,8 +45,17 @@ struct ppp_net {
char *if_name;
GIOChannel *channel;
gint watch;
+   gint mtu;
 };
 
+void ppp_net_set_mtu(struct ppp_net *net, guint16 mtu)
+{
+   if (net == NULL)
+   return;
+
+   net-mtu = mtu;
+}
+
 void ppp_net_process_packet(struct ppp_net *net, guint8 *packet)
 {
GError *error = NULL;
@@ -80,7 +88,7 @@ static gboolean ppp_net_callback(GIOChannel *channel, 
GIOCondition cond,
 
if (cond  G_IO_IN) {
/* leave space to add PPP protocol field */
-   status = g_io_channel_read_chars(channel, buf + 2, MAX_PACKET,
+   status = g_io_channel_read_chars(channel, buf + 2, net-mtu,
bytes_read, error);
if (bytes_read  0) {
ppp-proto = htons(PPP_IP_PROTO);
@@ -140,6 +148,7 @@ struct ppp_net *ppp_net_new(GAtPPP *ppp)
ppp_net_callback, net);
net-ppp = ppp;
 
+   net-mtu = MAX_PACKET;
return net;
 
 error:
-- 
1.6.6.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


RE: How to handle pins?

2010-04-21 Thread Xu, Martin
 -Original Message-
 From: connman-boun...@connman.net
 [mailto:connman-boun...@connman.net] On Behalf Of Daniel Wagner
 Sent: Wednesday, April 21, 2010 2:14 PM
 To: conn...@connman.net
 Subject: How to handle pins?
 
 Hi,
 
 I was able to get connman with ofono working with my Option
 modem. Though one of the problem I had to workaround was the pin
 entering. When the device is attached to the computer, ofono
 identifies it as:
 
 $ ./list-modems
 [ /hso0 ]
 Powered = 1
 Interfaces = org.ofono.SimManager
 Model = GlobeTrotter HSUPA Modem
 Manufacturer = Option N.V.
 Serial = 351721030157214,PK29997020
 Revision = 2.12.0.0Hd (Date: Oct 29 2009, Time: 09:56:48)
 [ org.ofono.SimManager ]
 SubscriberNumbers =
 LockedPins = pin
 PinRequired = pin
 Present = 1
 
 
 connman ignores this device until the GPRS interface shows up. This
 wont happend until the pin is entered. In my ignorance I have tried
I think maybe pin can be handled at ofono side. 

 modify connmand that way, that it shows the modem as device (with a
 new property PinRequired) even when the GPRS interface is not yet
 available. Though I had to hackaround with the IMSI (which is used as
 unique identifier for the dbus paths) is only available after the pin
 has been entered. Maybe the serial number could be used instead of the
 IMSI instead?
I am afraid that IMSI is the best identifier, and serial number is implemented 
by manufacturer, and sometime not unique.
Anyway it is the issue we need to resolve. So I also copy it to oFono maillist 
for comments. ;-)

 
 I'm not sure if I'm going the right road. What is the great master
 plan to handle this?
 
 cheers,
 daniel
 
 ps: btw here is the current hack:
 
 diff --git a/plugins/ofono.c b/plugins/ofono.c
 index d0f358e..bd443f1 100644
 --- a/plugins/ofono.c
 +++ b/plugins/ofono.c
 @@ -843,7 +843,7 @@ done:
  }
 
  static void add_device(const char *path, const char *imsi,
 - unsigned char mnc_length)
 +unsigned char mnc_length, const char 
 *pin_required)
  {
   struct modem_data *modem;
   struct connman_device *device;
 @@ -877,6 +877,8 @@ static void add_device(const char *path, const char
 *imsi,
   g_free(mcc_mnc);
   }
 
 + connman_device_set_string(device, PinRequired, pin_required);
 +
   if (connman_device_register(device)  0) {
   connman_device_unref(device);
   return;
 @@ -890,7 +892,8 @@ static void add_device(const char *path, const char
 *imsi,
  static void sim_properties_reply(DBusPendingCall *call, void *user_data)
  {
   const char *path = user_data;
 - const char *imsi;
 + char *imsi = foo;
 + char *pin_required = ;
   /* If MobileNetworkCodeLength is not provided, mnc_length is 0 */
   unsigned char mnc_length = 0;
   DBusMessage *reply;
 @@ -923,11 +926,13 @@ static void sim_properties_reply(DBusPendingCall
 *call, void *user_data)
   else if (g_str_equal(key, MobileNetworkCodeLength) == TRUE)
   dbus_message_iter_get_basic(value,
   (void *) mnc_length);
 + else if (g_str_equal(key, PinRequired) == TRUE)
 + dbus_message_iter_get_basic(value, pin_required);
 
   dbus_message_iter_next(dict);
   }
 
 - add_device(path, imsi, mnc_length);
 + add_device(path, imsi, mnc_length, pin_required);
 
  done:
   dbus_message_unref(reply);
 @@ -935,7 +940,7 @@ done:
   dbus_pending_call_unref(call);
  }
 
 -static void get_imsi(const char *path)
 +static void get_sim_properties(const char *path)
  {
   DBusMessage *message;
   DBusPendingCall *call;
 @@ -1036,6 +1041,7 @@ static struct modem_data *add_modem(const char
 *path)
   return modem;
  }
 
 +/*
  static gboolean modem_has_gprs(DBusMessageIter *array)
  {
   DBusMessageIter entry;
 @@ -1055,6 +1061,7 @@ static gboolean modem_has_gprs(DBusMessageIter
 *array)
 
   return FALSE;
  }
 +*/
 
  static void modem_properties_reply(DBusPendingCall *call, void *user_data)
  {
 @@ -1093,8 +1100,7 @@ static void
 modem_properties_reply(DBusPendingCall *call, void *user_data)
   break;
   }
   } else if (g_str_equal(key, Interfaces) == TRUE) {
 - if (modem_has_gprs(value) == TRUE)
 - get_imsi(path);
 + get_sim_properties(path);
   }
 
   dbus_message_iter_next(dict);
 @@ -1333,10 +1339,9 @@ static gboolean modem_changed(DBusConnection
 *connection, DBusMessage *message,
 
   modem_remove_device(modem);
   } else if (g_str_equal(key, Interfaces) == TRUE) {
 - if (modem_has_gprs(value) == TRUE) {
 - if (modem-device == NULL)
 - get_imsi(modem-path);