[PATCH v2] Add CDMA extension tasks
by Caiwen Zhang
---
TODO | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 76 insertions(+), 0 deletions(-)
diff --git a/TODO b/TODO
index a97f076..b159c07 100644
--- a/TODO
+++ b/TODO
@@ -614,3 +614,79 @@ Miscellaneous
Priority: Low
Complexity: C4
+
+
+CDMA/EVDO
+=========
+
+- Extend modem interface with a 'Type' property to indicate the modem type.
+
+ Priority: High
+ Complexity: C1
+
+- Add CDMA call settings support, include:
+ Call forwarding(include busy, no answer, default and unconditional situation),
+ Calling Number Identification Presentation(CNIP), Calling Number Identification
+ Restriction(CNIR), Do Not Disturb(DND), Call Delivery(CD), Call Waiting(CW),
+ Voice Privacy(VP) etc.
+
+ All these services except VP are achieved through similar way: get relevant feature code
+ -> compose dialing string -> originate a voice call.
+
+ Priority: High
+ Complexity: C2
+
+- Extend radio setting, add CDMA radio access technology support. The CDMA modem preferred
+ technology can be CDMA, HDR or CDMA/HDR hybrid.
+
+ Priority: Medium
+ Complexity: C1
+
+- Add UIM support. UIM support change pin, enter pin, reset pin, set pin lock, get pin lock setting,
+ get pin remain retry time, and get information that stored in UIM, include MCC/MNC, ruimid, IMSI,
+ MDN, PRL version etc.
+
+ Priority: High
+ Complexity: C4
+
+- Add CDMA SMS support, include broadcast short message. In CDMA, broadcast short message is
+ a kind of SMS. CDMA SMS manager atom will support SMS sending and receiving. Many CDMA modems
+ may only support text mode and other modems only support PDU mode. In CDMA SMS manage atom will
+ define a data structure that contain every parameters and subparameters defined in C.S0015. In
+ relative modem driver plug-in, the relevant fields(text mode) or PDU(may be manufacturer
+ specific) will be parsed and filled into the data structure, then it will be proceed in CDMA
+ SMS manager atom.
+
+ Special SMSs, SCPT, CATPT and voice mail notification(VMN)(please refer to C.S0015 section 4.3.8,
+ 4.3.9, 4.3.5)will be processed in ofono, and other messages with a port number (include WAP push
+ message) will be processed by external plug-ins. CDMA SMS manager atom offer an API for register
+ external plug-in.
+
+ Priority: High
+ Complexity: C8
+
+- Add CDMA voice call support. CDMA voice call will support originate/end/hold a call,
+ transfer a call, 3WC(three-way calling), conference call and DTMF. For a voice call, can get
+ its status, CLI and ending result(if it is end).
+
+ Priority: High
+ Complexity: C6
+
+- Add CDMA Data connection support. CDMA data connection manager support start/end a data connect
+ according to the settings from other module(upper layer or ConnMan)and get/set Qos.
+
+ Priority: High
+ Complexity: C4
+
+- Add SIM/UIM data access support. Add a card atom, it will support read/update/delete/add conatact
+ add SMS in SIM/UIM card.
+
+ Priority: High
+ Complexity: C6
+
+- Add CTCC modem driver. The CTCC modem driver will totally obey <China Telecom CDMA terminal
+ requirement specification -- 1xEV-DORevA Data Terminal AT command Interface fascicule V1.1>
+
+ Priority: High
+ Complexity: C10
+
--
1.7.0.4
10 years, 4 months
Atmodem PPP Link establishment issues
by Arun.Ravindran@elektrobit.com
> Hi,
>
> We are using atmodem plugin and are trying to get the PPP up and
> running. I am able to create and activate context, but the PPP link
> establishment seems to have issues.
>
> The list-context script returns:
>
> [ /generic ]
> [ /generic/primarycontext3 ]
> Username =
> Name = Internet access
> Settings = { Interface=ppp0 Netmask=255.255.255.255
> Method=static DomainNameServers=192.89.123.231,192.89.123.230,
> Address=109.240.91.14 }
> Active = 1
> AccessPointName = internet
> Password =
> Type = internet
>
> But for a PPP link, there needs to be two ip addresses, one local and
> one of the peer. Here in the settings you see only one IP address.
>
> I collected the logs during the PPP link establishment, (frames and a
> brief detail about it)
>
> Sent from Ofono:
> Frame: 0x7e 0xff 0x7d 0x23 0xc0 0x21 0x7d 0x21 0x7d 0x21 0x7d 0x20
> 0x7d 0x2a 0x7d 0x22 0x7d 0x26 0x7d 0x20 0x7d 0x20 0x7d 0x20 0x7d 0x20
> 0x58 0x7b 0x7e
> 03 c021 1 (conf req) 1 (id) 0x000a (length) 2 (accm) 6 (length) 0000
> fcs
>
> Recv from Modem:
> Frame: 0x7e 0xff 0x7d 0x23 0xc0 0x21 0x7d 0x21 0x7d 0x21 0x7d 0x20
> 0x7d 0x34 0x7d 0x22 0x7d 0x26 0x7d 0x20 0x7d 0x20 0x7d 0x20 0x7d 0x20
> 0x7d 0x25 0x7d 0x26 0xd2 0x8a 0xde 0xd2 0x7d 0x27 0x7d 0x22 0x7d 0x28
> 0x7d 0x22 0xbf 0x7d 0x35 0x7e
> 3 c021 1 (conf req) 1 (id) 0x0034 2 6 0 0 0 0 5(magic num) 6 d2 8a de
> d2 7(protocol compression) 2 (id) 8 (addr, control compres) 2 fcs
>
>
> Frame: 0x7e 0xff 0x7d 0x23 0xc0 0x21 0x7d 0x22 0x7d 0x21 0x7d 0x20
> 0x7d 0x2a 0x7d 0x22 0x7d 0x26 0x7d 0x20 0x7d 0x20 0x7d 0x20 0x7d 0x20
> 0x31 0x7d 0x2f 0x7e
> 3 c021 2 (conf ack) 1 (id) 0x000a 2 6 0 0 0 0 fcs
>
> Sent from ofono:
> Frame: 0x7e 0xff 0x7d 0x23 0xc0 0x21 0x7d 0x22 0x7d 0x21 0x7d 0x20
> 0x7d 0x34 0x7d 0x22 0x7d 0x26 0x7d 0x20 0x7d 0x20 0x7d 0x20 0x7d 0x20
> 0x7d 0x25 0x7d 0x26 0xd2 0x8a 0xde 0xd2 0x7d 0x27 0x7d 0x22 0x7d 0x28
> 0x7d 0x22 0x54 0x7c 0x7e
> 3 c021 2 (conf ack) 1 0x0034 2 6 0000 5 6 d2 8a de d2 7 2 8 2 fcs
>
>
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x1 0x1 0x0 0x22 0x3 0x6 0x0 0x0 0x0
> 0x0 0x81 0x6 0x0 0x0 0x0 0x0 0x83 0x6 0x0 0x0 0x0 0x0 0x82 0x6 0x0 0x0
> 0x0 0x0 0x84 0x6 0x0 0x0 0x0 0x0 0x80 0x52 0x7e
> 3 8021 1 (conf req) 1 (id) 0x0022 (length) 3 (ip) 6 0000 81(dns1) 6
> 0000 83(nbns1) 6 0000 82(dns2) 6 0000 84 (nbns2) 6 0000 fcs
>
> Recv from Modem:
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x3 0x1 0x0 0x10 0x81 0x6 0xa 0xb 0xc
> 0xd 0x83 0x6 0xa 0xb 0xc 0xe 0x4d 0x4d 0x7e
> 3 8021 3(conf nak) 1 (id) 0x010 81 (dns1) 6 abcd 83 (dns2) 6 abce fcs
>
> Sent from ofono:
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x1 0x2 0x0 0x22 0x3 0x6 0x0 0x0 0x0
> 0x0 0x81 0x6 0xa 0xb 0xc 0xd 0x83 0x6 0xa 0xb 0xc 0xe 0x82 0x6 0x0 0x0
> 0x0 0x0 0x84 0x6 0x0 0x0 0x0 0x0 0xad 0x7a 0x7e
> 3 8021 1 (conf ack) 2 (id) 0x0022 3 6 0000 81 6 abcd 83 6 abce 82 6
> 0000 84 6 0000 fcs
>
> Recv from Modem:
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x3 0x2 0x0 0x10 0x81 0x6 0xa 0xb 0xc
> 0xd 0x83 0x6 0xa 0xb 0xc 0xe 0x33 0x95 0x7e
> 3 8021 3(conf nak) 2 (id) 0x010 81 (dns1) 6 abcd 83 (dns2) 6 abce fcs
>
> Sent from ofono:
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x1 0x3 0x0 0x22 0x3 0x6 0x0 0x0 0x0
> 0x0 0x81 0x6 0xa 0xb 0xc 0xd 0x83 0x6 0xa 0xb 0xc 0xe 0x82 0x6 0x0 0x0
> 0x0 0x0 0x84 0x6 0x0 0x0 0x0 0x0 0xce 0x3a 0x7e
> 3 8021 1 (conf req) 3 (id) 0x0022 3 6 0000 81 6 abcd 83 6 abce 82 6
> 0000 84 6 0000 fcs
>
> Recv from Modem:
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x1 0x1 0x0 0x4 0x0 0xb7 0x7e
> 3 8021 1 (conf req) 1 (id) 0 4 0 fcs
>
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x4 0x3 0x0 0x10 0x82 0x6 0x0 0x0 0x0
> 0x0 0x84 0x6 0x0 0x0 0x0 0x0 0x34 0xcc 0x7e
> 3 8021 4 (conf reject) 3(id) 0x0010 82 6 0000 84 6 0000 fcs
>
> Sent from ofono:
> Frame: 0xff 0x3 0x80 0x21 0x2 0x1 0x0 0x4 0xcd 0x92 0x7e
> 3 8021 2 (conf ack) 1 (id) 0 4
>
> Frame: 0xff 0x3 0x80 0x21 0x1 0x4 0x0 0x16 0x3 0x6 0x0 0x0 0x0 0x0
> 0x81 0x6 0xa 0xb 0xc 0xd 0x83 0x6 0xa 0xb 0xc 0xe 0xe3 0x9 0x7e
> 3 8021 1 (conf req) 4 (id) 0x0016 3 6 0000 81 6 abcd 83 6 abce fcs
>
> Recv from modem:
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x3 0x4 0x0 0x16 0x3 0x6 0x6d 0xf0 0x40
> 0xbe 0x81 0x6 0xc0 0x59 0x7b 0xe7 0x83 0x6 0xc0 0x59 0x7b 0xe6 0xc5
> 0xf1 0x7e
> 3 8021 3 (conf nak) 4 (id) 0x0016 3 (ip) 6 6d f0 40 be 81 (dns1) 6 c0
> 59 7b e7 83 (dns2) 6 c0 59 7b e6 fcs
>
> Sent from ofono:
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x1 0x5 0x0 0x16 0x3 0x6 0x6d 0xf0 0x40
> 0xbe 0x81 0x6 0xc0 0x59 0x7b 0xe7 0x83 0x6 0xc0 0x59 0x7b 0xe6 0x2
> 0x9c 0x7e
> 3 8021 1 (conf req) 5 (id) 0x0016 3 6 6d f0 40 be 81 6 c0 59 7b e7 83
> 6 c0 59 7b e6 fcs
>
> Recv from Modem:
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x2 0x5 0x0 0x16 0x3 0x6 0x6d 0xf0 0x40
> 0xbe 0x81 0x6 0xc0 0x59 0x7b 0xe7 0x83 0x6 0xc0 0x59 0x7b 0xe6 0xf4
> 0x6f 0x7e
> 3 8021 2 (conf ack) 5 (id) 0x0016 3 6 6d f0 40 be 81 6 c0 59 7b e7 83
> 6 c0 59 7b e6 fcs
>
> I could not find any issues in the state transition w.r.t the RFC, but
> I get only one IP address, what is going wrong? Could any one help?
>
>
> ----------------------------------------------------------------------
> -----------------------
>
> Regards
> Arun Ravindran
> Specialist, Elektrobit OYJ
> Keilasatama 5, Espoo
> M: +358403445507
>
----------------------------------------------------------------
Please note: This e-mail may contain confidential information
intended solely for the addressee. If you have received this
e-mail in error, please do not disclose it to anyone, notify
the sender promptly, and delete the message from your system.
Thank you.
10 years, 4 months
Atmodem PPP Link establishment issues
by Arun.Ravindran@elektrobit.com
> Hi,
>
> We are using atmodem plugin and are trying to get the PPP up and
> running. I am able to create and activate context, but the PPP link
> establishment seems to have issues.
>
> The list-context script returns:
>
> [ /generic ]
> [ /generic/primarycontext3 ]
> Username =
> Name = Internet access
> Settings = { Interface=ppp0 Netmask=255.255.255.255
> Method=static DomainNameServers=192.89.123.231,192.89.123.230,
> Address=109.240.91.14 }
> Active = 1
> AccessPointName = internet
> Password =
> Type = internet
>
> But for a PPP link, there needs to be two ip addresses, one local and
> one of the peer. Here in the settings you see only one IP address.
>
> I collected the logs during the PPP link establishment, (frames and a
> brief detail about it)
>
> Sent from Ofono:
> Frame: 0x7e 0xff 0x7d 0x23 0xc0 0x21 0x7d 0x21 0x7d 0x21 0x7d 0x20
> 0x7d 0x2a 0x7d 0x22 0x7d 0x26 0x7d 0x20 0x7d 0x20 0x7d 0x20 0x7d 0x20
> 0x58 0x7b 0x7e
> 03 c021 1 (conf req) 1 (id) 0x000a (length) 2 (accm) 6 (length) 0000
> fcs
>
> Recv from Modem:
> Frame: 0x7e 0xff 0x7d 0x23 0xc0 0x21 0x7d 0x21 0x7d 0x21 0x7d 0x20
> 0x7d 0x34 0x7d 0x22 0x7d 0x26 0x7d 0x20 0x7d 0x20 0x7d 0x20 0x7d 0x20
> 0x7d 0x25 0x7d 0x26 0xd2 0x8a 0xde 0xd2 0x7d 0x27 0x7d 0x22 0x7d 0x28
> 0x7d 0x22 0xbf 0x7d 0x35 0x7e
> 3 c021 1 (conf req) 1 (id) 0x0034 2 6 0 0 0 0 5(magic num) 6 d2 8a de
> d2 7(protocol compression) 2 (id) 8 (addr, control compres) 2 fcs
>
>
> Frame: 0x7e 0xff 0x7d 0x23 0xc0 0x21 0x7d 0x22 0x7d 0x21 0x7d 0x20
> 0x7d 0x2a 0x7d 0x22 0x7d 0x26 0x7d 0x20 0x7d 0x20 0x7d 0x20 0x7d 0x20
> 0x31 0x7d 0x2f 0x7e
> 3 c021 2 (conf ack) 1 (id) 0x000a 2 6 0 0 0 0 fcs
>
> Sent from ofono:
> Frame: 0x7e 0xff 0x7d 0x23 0xc0 0x21 0x7d 0x22 0x7d 0x21 0x7d 0x20
> 0x7d 0x34 0x7d 0x22 0x7d 0x26 0x7d 0x20 0x7d 0x20 0x7d 0x20 0x7d 0x20
> 0x7d 0x25 0x7d 0x26 0xd2 0x8a 0xde 0xd2 0x7d 0x27 0x7d 0x22 0x7d 0x28
> 0x7d 0x22 0x54 0x7c 0x7e
> 3 c021 2 (conf ack) 1 0x0034 2 6 0000 5 6 d2 8a de d2 7 2 8 2 fcs
>
>
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x1 0x1 0x0 0x22 0x3 0x6 0x0 0x0 0x0
> 0x0 0x81 0x6 0x0 0x0 0x0 0x0 0x83 0x6 0x0 0x0 0x0 0x0 0x82 0x6 0x0 0x0
> 0x0 0x0 0x84 0x6 0x0 0x0 0x0 0x0 0x80 0x52 0x7e
> 3 8021 1 (conf req) 1 (id) 0x0022 (length) 3 (ip) 6 0000 81(dns1) 6
> 0000 83(nbns1) 6 0000 82(dns2) 6 0000 84 (nbns2) 6 0000 fcs
>
> Recv from Modem:
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x3 0x1 0x0 0x10 0x81 0x6 0xa 0xb 0xc
> 0xd 0x83 0x6 0xa 0xb 0xc 0xe 0x4d 0x4d 0x7e
> 3 8021 3(conf nak) 1 (id) 0x010 81 (dns1) 6 abcd 83 (dns2) 6 abce fcs
>
> Sent from ofono:
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x1 0x2 0x0 0x22 0x3 0x6 0x0 0x0 0x0
> 0x0 0x81 0x6 0xa 0xb 0xc 0xd 0x83 0x6 0xa 0xb 0xc 0xe 0x82 0x6 0x0 0x0
> 0x0 0x0 0x84 0x6 0x0 0x0 0x0 0x0 0xad 0x7a 0x7e
> 3 8021 1 (conf ack) 2 (id) 0x0022 3 6 0000 81 6 abcd 83 6 abce 82 6
> 0000 84 6 0000 fcs
>
> Recv from Modem:
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x3 0x2 0x0 0x10 0x81 0x6 0xa 0xb 0xc
> 0xd 0x83 0x6 0xa 0xb 0xc 0xe 0x33 0x95 0x7e
> 3 8021 3(conf nak) 2 (id) 0x010 81 (dns1) 6 abcd 83 (dns2) 6 abce fcs
>
> Sent from ofono:
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x1 0x3 0x0 0x22 0x3 0x6 0x0 0x0 0x0
> 0x0 0x81 0x6 0xa 0xb 0xc 0xd 0x83 0x6 0xa 0xb 0xc 0xe 0x82 0x6 0x0 0x0
> 0x0 0x0 0x84 0x6 0x0 0x0 0x0 0x0 0xce 0x3a 0x7e
> 3 8021 1 (conf req) 3 (id) 0x0022 3 6 0000 81 6 abcd 83 6 abce 82 6
> 0000 84 6 0000 fcs
>
> Recv from Modem:
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x1 0x1 0x0 0x4 0x0 0xb7 0x7e
> 3 8021 1 (conf req) 1 (id) 0 4 0 fcs
>
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x4 0x3 0x0 0x10 0x82 0x6 0x0 0x0 0x0
> 0x0 0x84 0x6 0x0 0x0 0x0 0x0 0x34 0xcc 0x7e
> 3 8021 4 (conf reject) 3(id) 0x0010 82 6 0000 84 6 0000 fcs
>
> Sent from ofono:
> Frame: 0xff 0x3 0x80 0x21 0x2 0x1 0x0 0x4 0xcd 0x92 0x7e
> 3 8021 2 (conf ack) 1 (id) 0 4
>
> Frame: 0xff 0x3 0x80 0x21 0x1 0x4 0x0 0x16 0x3 0x6 0x0 0x0 0x0 0x0
> 0x81 0x6 0xa 0xb 0xc 0xd 0x83 0x6 0xa 0xb 0xc 0xe 0xe3 0x9 0x7e
> 3 8021 1 (conf req) 4 (id) 0x0016 3 6 0000 81 6 abcd 83 6 abce fcs
>
> Recv from modem:
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x3 0x4 0x0 0x16 0x3 0x6 0x6d 0xf0 0x40
> 0xbe 0x81 0x6 0xc0 0x59 0x7b 0xe7 0x83 0x6 0xc0 0x59 0x7b 0xe6 0xc5
> 0xf1 0x7e
> 3 8021 3 (conf nak) 4 (id) 0x0016 3 (ip) 6 6d f0 40 be 81 (dns1) 6 c0
> 59 7b e7 83 (dns2) 6 c0 59 7b e6 fcs
>
> Sent from ofono:
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x1 0x5 0x0 0x16 0x3 0x6 0x6d 0xf0 0x40
> 0xbe 0x81 0x6 0xc0 0x59 0x7b 0xe7 0x83 0x6 0xc0 0x59 0x7b 0xe6 0x2
> 0x9c 0x7e
> 3 8021 1 (conf req) 5 (id) 0x0016 3 6 6d f0 40 be 81 6 c0 59 7b e7 83
> 6 c0 59 7b e6 fcs
>
> Recv from Modem:
> Frame: 0x7e 0xff 0x3 0x80 0x21 0x2 0x5 0x0 0x16 0x3 0x6 0x6d 0xf0 0x40
> 0xbe 0x81 0x6 0xc0 0x59 0x7b 0xe7 0x83 0x6 0xc0 0x59 0x7b 0xe6 0xf4
> 0x6f 0x7e
> 3 8021 2 (conf ack) 5 (id) 0x0016 3 6 6d f0 40 be 81 6 c0 59 7b e7 83
> 6 c0 59 7b e6 fcs
>
> I could not find any issues in the state transition w.r.t the RFC, but
> I get only one IP address, what is going wrong? Could any one help?
>
>
> ----------------------------------------------------------------------
> -----------------------
>
> Regards
> Arun Ravindran
> Specialist, Elektrobit OYJ
> Keilasatama 5, Espoo
> M: +358403445507
>
----------------------------------------------------------------
Please note: This e-mail may contain confidential information
intended solely for the addressee. If you have received this
e-mail in error, please do not disclose it to anyone, notify
the sender promptly, and delete the message from your system.
Thank you.
----------------------------------------------------------------
Please note: This e-mail may contain confidential information
intended solely for the addressee. If you have received this
e-mail in error, please do not disclose it to anyone, notify
the sender promptly, and delete the message from your system.
Thank you.
10 years, 4 months
[PATCH v3] atmodem/phonebook: parse text as hexstring
by Thadeu Lima de Souza Cascardo
Some modems omit the quotes when dumping strings in UCS2. Parsing
them as hexstring already does the hex decoding and accepts missing
quotes.
---
drivers/atmodem/phonebook.c | 138 ++++++++++++++++++++----------------------
1 files changed, 66 insertions(+), 72 deletions(-)
diff --git a/drivers/atmodem/phonebook.c b/drivers/atmodem/phonebook.c
index 785d539..1d5e1a9 100644
--- a/drivers/atmodem/phonebook.c
+++ b/drivers/atmodem/phonebook.c
@@ -59,16 +59,49 @@ struct pb_data {
GAtChat *chat;
};
-static char *ucs2_to_utf8(const char *str)
+static void warn_bad()
{
- long len;
- unsigned char *ucs2;
+ ofono_warn("Name field conversion to UTF8 failed, this can indicate a"
+ " problem with modem integration, as this field"
+ " is required by 27.007.");
+}
+
+static gboolean parse_text(GAtResultIter *iter, char **str, int encoding)
+{
+ const char *string;
+ const guint8 *hex;
+ int len;
char *utf8;
- ucs2 = decode_hex(str, -1, &len, 0);
- utf8 = g_convert((char *)ucs2, len, "UTF-8//TRANSLIT", "UCS-2BE",
+ /* charset_current is CHARSET_UCS2, CHARSET_IRA or CHARSET_UTF8 */
+ if (encoding == CHARSET_UCS2) {
+ /*
+ * Some devices omit the quotes, so use hexstring,
+ * which also decode to hex
+ */
+ if (g_at_result_iter_next_hexstring(iter, &hex, &len) == FALSE)
+ return FALSE;
+
+ utf8 = g_convert((const gchar*) hex, len,
+ "UTF-8//TRANSLIT", "UCS-2BE",
NULL, NULL, NULL);
- g_free(ucs2);
- return utf8;
+
+ if (utf8) {
+ *str = utf8;
+ return TRUE;
+ }
+
+ return FALSE;
+ }
+ /*
+ * In the case of IRA charset, assume these are Latin1
+ * characters, same as in UTF8
+ */
+ if (g_at_result_iter_next_string(iter, &string)) {
+ *str = g_strdup(string);
+ return TRUE;
+ }
+
+ return FALSE;
}
static const char *best_charset(int supported)
@@ -110,15 +143,15 @@ static void at_cpbr_notify(GAtResult *result, gpointer user_data)
int index;
const char *number;
int type;
- const char *text;
+ char *text;
int hidden = -1;
- const char *group = NULL;
+ char *group = NULL;
const char *adnumber = NULL;
int adtype = -1;
- const char *secondtext = NULL;
- const char *email = NULL;
- const char *sip_uri = NULL;
- const char *tel_uri = NULL;
+ char *secondtext = NULL;
+ char *email = NULL;
+ char *sip_uri = NULL;
+ char *tel_uri = NULL;
if (!g_at_result_iter_next_number(&iter, &index))
continue;
@@ -129,70 +162,31 @@ static void at_cpbr_notify(GAtResult *result, gpointer user_data)
if (!g_at_result_iter_next_number(&iter, &type))
continue;
- if (!g_at_result_iter_next_string(&iter, &text))
+ if (!parse_text(&iter, &text, current)) {
+ warn_bad();
continue;
+ }
g_at_result_iter_next_number(&iter, &hidden);
- g_at_result_iter_next_string(&iter, &group);
+ parse_text(&iter, &group, current);
g_at_result_iter_next_string(&iter, &adnumber);
g_at_result_iter_next_number(&iter, &adtype);
- g_at_result_iter_next_string(&iter, &secondtext);
- g_at_result_iter_next_string(&iter, &email);
- g_at_result_iter_next_string(&iter, &sip_uri);
- g_at_result_iter_next_string(&iter, &tel_uri);
-
- /* charset_current is either CHARSET_UCS2 or CHARSET_UTF8 */
- if (current == CHARSET_UCS2) {
- char *text_utf8;
- char *group_utf8 = NULL;
- char *secondtext_utf8 = NULL;
- char *email_utf8 = NULL;
- char *sip_uri_utf8 = NULL;
- char *tel_uri_utf8 = NULL;
-
- text_utf8 = ucs2_to_utf8(text);
-
- if (text_utf8 == NULL)
- ofono_warn("Name field conversion to UTF8"
- " failed, this can indicate a"
- " problem with modem"
- " integration, as this field"
- " is required by 27.007."
- " Contents of name reported"
- " by modem: %s", text);
-
- if (group)
- group_utf8 = ucs2_to_utf8(group);
- if (secondtext)
- secondtext_utf8 = ucs2_to_utf8(secondtext);
- if (email)
- email_utf8 = ucs2_to_utf8(email);
- if (sip_uri)
- sip_uri_utf8 = ucs2_to_utf8(sip_uri);
- if (tel_uri)
- tel_uri_utf8 = ucs2_to_utf8(tel_uri);
-
- ofono_phonebook_entry(pb, index, number, type,
- text_utf8, hidden, group_utf8, adnumber,
- adtype, secondtext_utf8, email_utf8,
- sip_uri_utf8, tel_uri_utf8);
-
- g_free(text_utf8);
- g_free(group_utf8);
- g_free(secondtext_utf8);
- g_free(email_utf8);
- g_free(sip_uri_utf8);
- g_free(tel_uri_utf8);
- } else {
- /* In the case of IRA charset, assume these are Latin1
- * characters, same as in UTF8
- */
- ofono_phonebook_entry(pb, index, number, type,
- text, hidden, group, adnumber,
- adtype, secondtext, email,
- sip_uri, tel_uri);
-
- }
+ parse_text(&iter, &secondtext, current);
+ parse_text(&iter, &email, current);
+ parse_text(&iter, &sip_uri, current);
+ parse_text(&iter, &tel_uri, current);
+
+ ofono_phonebook_entry(pb, index, number, type,
+ text, hidden, group, adnumber,
+ adtype, secondtext, email,
+ sip_uri, tel_uri);
+
+ g_free(text);
+ g_free(group);
+ g_free(secondtext);
+ g_free(email);
+ g_free(sip_uri);
+ g_free(tel_uri);
}
}
--
1.7.1
10 years, 4 months
[PATCH v2 1/1] sim: Read EFsst
by Yang Gu
---
src/sim.c | 34 ++++++++++++++++++++++++++++--
src/simutil.c | 18 ++++++++++++++++
src/simutil.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 112 insertions(+), 3 deletions(-)
diff --git a/src/sim.c b/src/sim.c
index f8884a2..6cbb2eb 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -101,6 +101,8 @@ struct ofono_sim {
unsigned char efust_length;
unsigned char *efest;
unsigned char efest_length;
+ unsigned char *efsst;
+ unsigned char efsst_length;
};
struct msisdn_set_request {
@@ -1072,6 +1074,27 @@ static void sim_retrieve_imsi(struct ofono_sim *sim)
sim->driver->read_imsi(sim, sim_imsi_cb, sim);
}
+static void sim_efsst_read_cb(int ok, int length, int record,
+ const unsigned char *data,
+ int record_length, void *userdata)
+{
+ struct ofono_sim *sim = userdata;
+
+ if (!ok)
+ goto out;
+
+ if (length < 2) {
+ ofono_error("EFsst shall contain at least two bytes");
+ goto out;
+ }
+
+ sim->efsst = g_memdup(data, length);
+ sim->efsst_length = length;
+
+out:
+ sim_retrieve_imsi(sim);
+}
+
static void sim_efest_read_cb(int ok, int length, int record,
const unsigned char *data,
int record_length, void *userdata)
@@ -1192,9 +1215,14 @@ static void sim_initialize_after_pin(struct ofono_sim *sim)
sim_cphs_information_read_cb, sim);
/* Also retrieve the GSM service table */
- ofono_sim_read(sim, SIM_EFUST_FILEID,
- OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
- sim_efust_read_cb, sim);
+ if (sim->phase >= OFONO_SIM_PHASE_3G)
+ ofono_sim_read(sim, SIM_EFUST_FILEID,
+ OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
+ sim_efust_read_cb, sim);
+ else
+ ofono_sim_read(sim, SIM_EFSST_FILEID,
+ OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
+ sim_efsst_read_cb, sim);
}
static void sim_pin_query_cb(const struct ofono_error *error,
diff --git a/src/simutil.c b/src/simutil.c
index ac054ae..4af6810 100644
--- a/src/simutil.c
+++ b/src/simutil.c
@@ -1434,3 +1434,21 @@ gboolean sim_est_is_active(unsigned char *efest, unsigned char len,
return (efest[index / 8] >> (index % 8)) & 1;
}
+
+gboolean sim_sst_is_available(unsigned char *efsst, unsigned char len,
+ enum sim_sst_service index)
+{
+ if (index >= len * 4u)
+ return FALSE;
+
+ return (efsst[index / 4] >> ((index % 4) * 2)) & 1;
+}
+
+gboolean sim_sst_is_active(unsigned char *efsst, unsigned char len,
+ enum sim_sst_service index)
+{
+ if (index >= len * 4u)
+ return FALSE;
+
+ return (efsst[index / 4] >> (((index % 4) * 2) + 1)) & 1;
+}
diff --git a/src/simutil.h b/src/simutil.h
index 65e651a..0a94c67 100644
--- a/src/simutil.h
+++ b/src/simutil.h
@@ -28,6 +28,7 @@ enum sim_fileid {
SIM_EF_CPHS_INFORMATION_FILEID = 0x6f16,
SIM_EF_CPHS_MBDN_FILEID = 0x6f17,
SIM_EFUST_FILEID = 0x6f38,
+ SIM_EFSST_FILEID = 0x6f38, /* same as EFust */
SIM_EFMSISDN_FILEID = 0x6f40,
SIM_EFSPN_FILEID = 0x6f46,
SIM_EFSDN_FILEID = 0x6f49,
@@ -154,6 +155,64 @@ enum sim_est_service {
SIM_EST_SERVICE_ACL = 2
};
+/* 51.011 Section 10.3.7 */
+enum sim_sst_service {
+ SIM_SST_SERVICE_CHV1_DISABLE = 0,
+ SIM_SST_SERVICE_ADN = 1,
+ SIM_SST_SERVICE_FDN = 2,
+ SIM_SST_SERVICE_SMS = 3,
+ SIM_SST_SERVICE_AOC = 4,
+ SIM_SST_SERVICE_CCP = 5,
+ SIM_SST_SERVICE_PLMN_SELECTOR = 6,
+ SIM_SST_SERVICE_MSISDN = 8,
+ SIM_SST_SERVICE_EXT_1 = 9,
+ SIM_SST_SERVICE_EXT_2 = 10,
+ SIM_SST_SERVICE_SMSP = 11,
+ SIM_SST_SERVICE_LND = 12,
+ SIM_SST_SERVICE_CBS_ID = 13,
+ SIM_SST_SERVICE_GROUP_ID_LEVEL_1 = 14,
+ SIM_SST_SERVICE_GROUP_ID_LEVEL_2 = 15,
+ SIM_SST_SERVICE_PROVIDER_NAME = 16,
+ SIM_SST_SERVICE_SDN = 17,
+ SIM_SST_SERVICE_EXT_3 = 18,
+ SIM_SST_SERVICE_EFVGCS_EFVGCSS = 20,
+ SIM_SST_SERVICE_EFVBS_EFVBSS = 21,
+ SIM_SST_SERVICE_PRECEDENCE_PREEMPTION = 22,
+ SIM_SST_SERVICE_EMLPP = 23,
+ SIM_SST_SERVICE_DATA_DOWNLOAD_SMS_CB = 24,
+ SIM_SST_SERVICE_DATA_DOWNLOAD_SMS_PP = 25,
+ SIM_SST_SERVICE_MENU_SELECTION = 26,
+ SIM_SST_SERVICE_CALL_CONTROL = 27,
+ SIM_SST_SERVICE_PROACTIVE_SIM = 28,
+ SIM_SST_SERVICE_CBS_ID_RANGE = 29,
+ SIM_SST_SERVICE_BDN = 30,
+ SIM_SST_SERVICE_EXT_4 = 31,
+ SIM_SST_SERVICE_DEPERSONALISATION_CTRL_KEY = 32,
+ SIM_SST_SERVICE_NETWORK_LIST = 33,
+ SIM_SST_SERVICE_SMSR = 34,
+ SIM_SST_SERVICE_NIA = 35,
+ SIM_SST_SERVICE_MO_SMS_SIM = 36,
+ SIM_SST_SERVICE_GPRS = 37,
+ SIM_SST_SERVICE_IMG = 38,
+ SIM_SST_SERVICE_SOLSA = 39,
+ SIM_SST_SERVICE_USSD_CALL_CONTROL = 40,
+ SIM_SST_SERVICE_RUN_AT_COMMAND = 41,
+ SIM_SST_SERVICE_USER_PLMN = 42,
+ SIM_SST_SERVICE_OPERATOR_PLMN = 43,
+ SIM_SST_SERVICE_HPLMN = 44,
+ SIM_SST_SERVICE_CPBCCH = 45,
+ SIM_SST_SERVICE_INVESTIGATION_SCAN = 46,
+ SIM_SST_SERVICE_EXT_CCP = 47,
+ SIM_SST_SERVICE_MEXE = 48,
+ SIM_SST_SERVICE_RPLMN = 49,
+ SIM_SST_SERVICE_PLMN_NETWORK_NAME = 50,
+ SIM_SST_SERVICE_OPERATOR_PLMN_LIST = 51,
+ SIM_SST_SERVICE_MAILBOX_DIALLING_NUMBERS = 52,
+ SIM_SST_SERVICE_MWIS = 53,
+ SIM_SST_SERVICE_CFIS = 54,
+ SIM_SST_SERVICE_PROVIDER_DISPLAY_INFO = 55
+};
+
#define SIM_EFSPN_DC_HOME_PLMN_BIT 0x1
#define SIM_EFSPN_DC_ROAMING_SPN_BIT 0x2
@@ -372,3 +431,7 @@ gboolean sim_ust_is_available(unsigned char *service_ust, unsigned char len,
enum sim_ust_service index);
gboolean sim_est_is_active(unsigned char *service_est, unsigned char len,
enum sim_est_service index);
+gboolean sim_sst_is_available(unsigned char *service_sst, unsigned char len,
+ enum sim_sst_service index);
+gboolean sim_sst_is_active(unsigned char *service_sst, unsigned char len,
+ enum sim_sst_service index);
--
1.7.0.4
10 years, 4 months
[RFC PATCH v3 2/4] smsutil: storing/loading sms status report over reboot
by Petteri Tikander
---
src/smsutil.c | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
src/smsutil.h | 10 +++-
2 files changed, 180 insertions(+), 6 deletions(-)
diff --git a/src/smsutil.c b/src/smsutil.c
index c60b8ec..88c567c 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -33,6 +33,7 @@
#include <unistd.h>
#include <glib.h>
+#include <errno.h>
#include "util.h"
#include "storage.h"
@@ -45,6 +46,9 @@
#define SMS_BACKUP_PATH_DIR SMS_BACKUP_PATH "/%s-%i-%i"
#define SMS_BACKUP_PATH_FILE SMS_BACKUP_PATH_DIR "/%03i"
+#define SMS_SR_BACKUP_PATH STORAGEDIR "/%s/sms_sr"
+#define SMS_SR_BACKUP_PATH_FILE SMS_SR_BACKUP_PATH "/%s-%i"
+
#define SMS_ADDR_FMT "%24[0-9A-F]"
static GSList *sms_assembly_add_fragment_backup(struct sms_assembly *assembly,
@@ -2413,7 +2417,7 @@ static void sms_assembly_backup_free(struct sms_assembly *assembly,
{
char *path;
int seq;
- char straddr[25];
+ DECLARE_SMS_ADDR_STR(straddr);
if (!assembly->imsi)
return;
@@ -2529,7 +2533,8 @@ static GSList *sms_assembly_add_fragment_backup(struct sms_assembly *assembly,
if (ref != node->ref)
continue;
- /* Message Reference and address the same, but max is not
+ /*
+ * Message Reference and address the same, but max is not
* ignore the SMS completely
*/
if (max != node->max_fragments)
@@ -2642,20 +2647,163 @@ void sms_assembly_expire(struct sms_assembly *assembly, time_t before)
}
}
+static void sr_assembly_load_backup(GHashTable *assembly_table,
+ const char *imsi,
+ const struct dirent *addr_dir)
+{
+ struct sms_address addr;
+ DECLARE_SMS_ADDR_STR(straddr);
+ struct id_table_node *node;
+ GHashTable *id_table;
+ int r;
+ char *assembly_table_key;
+ unsigned int *id_table_key;
+ DECLARE_SMS_MSGID_STR(str_msg_id);
+ char *endp;
+ unsigned int msg_id;
+
+ if (addr_dir->d_type != DT_REG)
+ return;
+
+ /*
+ * All SMS-messages under the same IMSI-code are
+ * included in the same directory.
+ * So, SMS-address and message ID are included in the same file name
+ * Max of SMS address size is 12 bytes, hex encoded
+ */
+ if (sscanf(addr_dir->d_name, SMS_ADDR_FMT "-" SMS_MSGID_FMT,
+ straddr, str_msg_id) < 2)
+ return;
+
+ if (sms_assembly_extract_address(straddr, &addr) == FALSE)
+ return;
+
+ errno = 0;
+ msg_id = strtoul(str_msg_id, &endp, 10);
+
+ if (*endp != '\0')
+ return;
+
+ if (errno == ERANGE && msg_id == UINT_MAX)
+ return;
+
+ id_table = g_hash_table_lookup(assembly_table,
+ sms_address_to_string(&addr));
+
+ /* Create hashtable keyed by the to address if required */
+ if (id_table == NULL) {
+ id_table = g_hash_table_new_full(g_int_hash, g_int_equal,
+ g_free, g_free);
+
+ assembly_table_key = g_strdup(sms_address_to_string(&addr));
+ g_hash_table_insert(assembly_table, assembly_table_key,
+ id_table);
+ }
+
+ node = g_new0(struct id_table_node, 1);
+
+ r = read_file((unsigned char *) node,
+ sizeof(struct id_table_node),
+ SMS_SR_BACKUP_PATH "/%s",
+ imsi, addr_dir->d_name);
+
+ if (r < 0) {
+ g_free(node);
+ return;
+ }
+
+ /* Node ready, create key and add them to the table */
+ id_table_key = g_new0(unsigned int, 1);
+ *id_table_key = msg_id;
+
+ g_hash_table_insert(id_table, id_table_key, node);
+}
+
struct status_report_assembly *status_report_assembly_new(const char *imsi)
{
+ char *path;
+ int len;
+ struct dirent **addresses;
struct status_report_assembly *ret =
g_new0(struct status_report_assembly, 1);
ret->assembly_table = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, (GDestroyNotify)g_hash_table_destroy);
- if (imsi)
+ if (imsi) {
ret->imsi = imsi;
+ /* Restore state from backup */
+ path = g_strdup_printf(SMS_SR_BACKUP_PATH, imsi);
+ len = scandir(path, &addresses, NULL, alphasort);
+
+ g_free(path);
+
+ if (len < 0)
+ return ret;
+
+ /*
+ * Go through different addresses. Each address can relate to
+ * 1-n msg_ids.
+ */
+
+ while (len--) {
+ sr_assembly_load_backup(ret->assembly_table, imsi,
+ addresses[len]);
+ g_free(addresses[len]);
+ }
+
+ g_free(addresses);
+ }
+
return ret;
}
+static gboolean sr_assembly_add_fragment_backup(const char *imsi,
+ const struct id_table_node *node,
+ const struct sms_address *addr,
+ unsigned int msg_id)
+{
+ int len = sizeof(struct id_table_node);
+ DECLARE_SMS_ADDR_STR(straddr);
+
+ if (!imsi)
+ return FALSE;
+
+ if (sms_address_to_hex_string(addr, straddr) == FALSE)
+ return FALSE;
+
+ /* storagedir/%s/sms_sr/%s-%i */
+ if (write_file((unsigned char *) node, len, SMS_BACKUP_MODE,
+ SMS_SR_BACKUP_PATH_FILE, imsi,
+ straddr, msg_id) != len)
+ return FALSE;
+
+ return TRUE;
+}
+
+static gboolean sr_assembly_remove_fragment_backup(const char *imsi,
+ const struct id_table_node *node,
+ const struct sms_address *addr,
+ unsigned int msg_id)
+{
+ char *path;
+ DECLARE_SMS_ADDR_STR(straddr);
+
+ if (!imsi)
+ return FALSE;
+
+ if (sms_address_to_hex_string(addr, straddr) == FALSE)
+ return FALSE;
+
+ path = g_strdup_printf(SMS_SR_BACKUP_PATH_FILE, imsi, straddr, msg_id);
+
+ unlink(path);
+ g_free(path);
+
+ return TRUE;
+}
+
void status_report_assembly_free(struct status_report_assembly *assembly)
{
g_hash_table_destroy(assembly->assembly_table);
@@ -2698,6 +2846,7 @@ gboolean status_report_assembly_report(struct status_report_assembly *assembly,
GHashTableIter iter;
gboolean pending;
int i;
+ unsigned int msg_id;
/* We ignore temporary or tempfinal status reports */
if (sr_st_to_delivered(status_report->status_report.st,
@@ -2743,14 +2892,30 @@ gboolean status_report_assembly_report(struct status_report_assembly *assembly,
}
}
- if (pending == TRUE && node->deliverable == TRUE)
+ msg_id = *(unsigned int *) key;
+
+ if (pending == TRUE && node->deliverable == TRUE) {
+ /*
+ * More status reports expected, and already received
+ * reports completed. Update backup file.
+ */
+ sr_assembly_add_fragment_backup(
+ assembly->imsi, node,
+ &status_report->status_report.raddr,
+ msg_id);
+
return FALSE;
+ }
if (out_delivered)
*out_delivered = node->deliverable;
if (out_id)
- *out_id = *((unsigned int *) key);
+ *out_id = msg_id;
+
+ sr_assembly_remove_fragment_backup(assembly->imsi, node,
+ &status_report->status_report.raddr,
+ msg_id);
g_hash_table_iter_remove(&iter);
@@ -2804,6 +2969,7 @@ void status_report_assembly_add_fragment(
node->mrs[offset] |= bit;
node->expiration = expiration;
node->sent_mrs++;
+ sr_assembly_add_fragment_backup(assembly->imsi, node, to, msg_id);
}
void status_report_assembly_expire(struct status_report_assembly *assembly,
diff --git a/src/smsutil.h b/src/smsutil.h
index eb70b6d..e5ef73a 100644
--- a/src/smsutil.h
+++ b/src/smsutil.h
@@ -370,7 +370,7 @@ struct id_table_node {
unsigned char total_mrs;
unsigned char sent_mrs;
gboolean deliverable;
-};
+} __attribute__((packed));
struct status_report_assembly {
const char *imsi;
@@ -437,6 +437,14 @@ gboolean sms_encode(const struct sms *in, int *len, int *tpdu_len,
*/
#define DECLARE_SMS_ADDR_STR(a) char a[25]
+/*
+ * Length is based on the msg_id being 10 digits (max uint)
+ * plus a terminating NUL char. But for more detailed
+ * digit-verification, recerve space for 11 characters plus NUL char.
+ */
+#define DECLARE_SMS_MSGID_STR(a) char a[12]
+#define SMS_MSGID_FMT "%11s"
+
gboolean sms_decode_address_field(const unsigned char *pdu, int len,
int *offset, gboolean sc,
struct sms_address *out);
--
1.6.3.3
10 years, 4 months
[PATCH] mbm: D5530 gets bogus +GCAP, not +CGAP
by Pekka.Pessi@nokia.com
From: Pekka Pessi <Pekka.Pessi(a)nokia.com>
---
plugins/mbm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/plugins/mbm.c b/plugins/mbm.c
index d0e084f..46cf7a0 100644
--- a/plugins/mbm.c
+++ b/plugins/mbm.c
@@ -158,7 +158,7 @@ static void mbm_quirk_d5530(struct ofono_modem *modem)
/* Try to ignore them. */
g_at_chat_register(data->modem_port, "D5530", d5530_notify,
FALSE, NULL, NULL);
- g_at_chat_register(data->modem_port, "+CGAP:", d5530_notify,
+ g_at_chat_register(data->modem_port, "+GCAP:", d5530_notify,
FALSE, NULL, NULL);
}
--
1.7.0.4
10 years, 4 months
[PATCH] voicecall: Add check in dial_request_finish
by Zhenhua Zhang
To avoid signal 11 if no dial_req exists.
---
src/voicecall.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/voicecall.c b/src/voicecall.c
index 6ad58ad..1313129 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -220,6 +220,9 @@ static void dial_request_finish(struct ofono_voicecall *vc, gboolean callback)
{
struct dial_request *dial_req = vc->dial_req;
+ if (dial_req == NULL)
+ return;
+
if (callback && dial_req->cb)
dial_req->cb(dial_req->call ? dial_req->call->call : NULL,
dial_req->user_data);
--
1.7.0.4
10 years, 4 months
[PATCH] Fix crash in voicecall atom
by Aki Niemi
Hot-unplugging isimodem causes a crash in the voicecall atom.
---
src/voicecall.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/voicecall.c b/src/voicecall.c
index 6ad58ad..52311b9 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -220,6 +220,9 @@ static void dial_request_finish(struct ofono_voicecall *vc, gboolean callback)
{
struct dial_request *dial_req = vc->dial_req;
+ if (!dial_req)
+ return;
+
if (callback && dial_req->cb)
dial_req->cb(dial_req->call ? dial_req->call->call : NULL,
dial_req->user_data);
--
1.7.0.4
10 years, 4 months