All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] fix SIM file reading on MC7304 modem
@ 2017-02-17 15:06 Christophe Ronco
  2017-02-17 15:06 ` [PATCH 1/1] qmimodem: fix sim file reading on MC7304 Christophe Ronco
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe Ronco @ 2017-02-17 15:06 UTC (permalink / raw)
  To: ofono

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

I always had errors when reading SIM files on modem MC7304.
Failing function in qmimodem driver is qmi_read_attributes.
Using OFONO_QMI_DEBUG, response from modem is
UIM_resp msg=36 len=7 [client=1,type=2,tid=274,len=19]
QMI:        {type=2,error=INTERNAL}

Using qmicli (and AT command), I am able to read the same file:
qmicli -d /dev/cdc-wdm0 --uim-get-file-attributes=0x3f00,0x7fff,0x6fad
[(null)] Successfully got file '/dev/cdc-wdm0' attributes from the UIM:
Card result:
        SW1: '0x90'
        SW2: '0x00'
File attributes:
        File size: 4
        File ID: 28589
        File type: transparent
        Record size: 0
        Record count: 0
        Read security attributes: (always) (null)
        Write security attributes: (single) adm
        Increase security attributes: (always) (null)
        Deactivate security attributes: (single) adm
        Activate security attributes: (single) adm
        Raw:    62:17:82:02:41:21:83:02:6F:AD:8A:01:05:8B:03:6F:06:01:80:02:00:04:88:01:18

I ended up trying to do it using qmicli and comparing binary commands sent by
ofono qmimodem driver and qmicli.

Command sent by qmimodem driver in qmi_read_attributes function
01 1b 00 00 0b 01
00 12 01 24 00 0f 00 "Get File Attributes" (0x0024), length 15
01 02 00 06 00 : "Session Information" (0x01), session_type = 'Card on slot 1' application_identifier = ''
02 07 00 ad 6f 04 00 3f ff 7f: "File" (0x02)

Command sent by qmicli:
01:1B:00:00:0B:01:
00:01:00:24:00:0F:00: "Get File Attributes" (0x0024), length 15
02:07:00:AD:6F:04:00:3F:FF:7F: "File" (0x02)
01:02:00:00:00 "Session Information" (0x01) session_type = 'primary-gw-provisioning' application_identifier = ''

So difference seemed to be session_type value in "Session Information" parameter.
I have no idea what this parameter really means. I changed that to set 
session_type to 'primary-gw-provisioning' in qmimodem driver and ... it fixed
the bug.
I have also tested the fix on a MC7430.


Christophe Ronco (1):
  qmimodem: fix sim file reading on MC7304

 drivers/qmimodem/sim.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.11.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] qmimodem: fix sim file reading on MC7304
  2017-02-17 15:06 [PATCH 0/1] fix SIM file reading on MC7304 modem Christophe Ronco
@ 2017-02-17 15:06 ` Christophe Ronco
  2017-02-17 17:18   ` Denis Kenzior
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe Ronco @ 2017-02-17 15:06 UTC (permalink / raw)
  To: ofono

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

Command read_file_info on MC7304 always fails.
Using qmicli or AT command, I am able to read file info.
Qmicli command is:
qmicli -d /dev/cdc-wdm0 --uim-get-file-attributes=0x3f00,0x7fff,0x6fad
[(null)] Successfully got file '/dev/cdc-wdm0' attributes from the UIM:
Card result:
        SW1: '0x90'
        SW2: '0x00'
File attributes:
        File size: 4
        File ID: 28589
        File type: transparent
        Record size: 0
        Record count: 0
        Read security attributes: (always) (null)
        Write security attributes: (single) adm
        Increase security attributes: (always) (null)
        Deactivate security attributes: (single) adm
        Activate security attributes: (single) adm
        Raw:    62:17:82:02:41:21:83:02:6F:AD:8A:01:05:8B:...

After a check of parameters sent by qmimodem driver and qmicli,
the only difference is on parameter "Session Information".
Session type sent by qmimodem driver is 'Card on slot 1'.
Session type sent by qmicli command is 'primary-gw-provisioning'.
Changing session type in qmimodem driver fixed problem (on this modem).

Comparing with what is done by qmili command
---
 drivers/qmimodem/sim.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/qmimodem/sim.c b/drivers/qmimodem/sim.c
index 602e5296..8d400288 100644
--- a/drivers/qmimodem/sim.c
+++ b/drivers/qmimodem/sim.c
@@ -168,7 +168,7 @@ static void qmi_read_attributes(struct ofono_sim *sim, int fileid,
 {
 	struct sim_data *data = ofono_sim_get_data(sim);
 	struct cb_data *cbd = cb_data_new(cb, user_data);
-	unsigned char aid_data[2] = { 0x06, 0x00 };
+	unsigned char aid_data[2] = { 0x00, 0x00 };
 	unsigned char fileid_data[9];
 	int fileid_len;
 	struct qmi_param *param;
@@ -233,7 +233,7 @@ static void qmi_read_transparent(struct ofono_sim *sim,
 {
 	struct sim_data *data = ofono_sim_get_data(sim);
 	struct cb_data *cbd = cb_data_new(cb, user_data);
-	unsigned char aid_data[2] = { 0x06, 0x00 };
+	unsigned char aid_data[2] = { 0x00, 0x00 };
 	unsigned char read_data[4];
 	unsigned char fileid_data[9];
 	int fileid_len;
@@ -279,7 +279,7 @@ static void qmi_read_record(struct ofono_sim *sim,
 {
 	struct sim_data *data = ofono_sim_get_data(sim);
 	struct cb_data *cbd = cb_data_new(cb, user_data);
-	unsigned char aid_data[2] = { 0x06, 0x00 };
+	unsigned char aid_data[2] = { 0x00, 0x00 };
 	unsigned char read_data[4];
 	unsigned char fileid_data[9];
 	int fileid_len;
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] qmimodem: fix sim file reading on MC7304
  2017-02-17 15:06 ` [PATCH 1/1] qmimodem: fix sim file reading on MC7304 Christophe Ronco
@ 2017-02-17 17:18   ` Denis Kenzior
  0 siblings, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2017-02-17 17:18 UTC (permalink / raw)
  To: ofono

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

Hi Christophe,

On 02/17/2017 09:06 AM, Christophe Ronco wrote:
> Command read_file_info on MC7304 always fails.
> Using qmicli or AT command, I am able to read file info.
> Qmicli command is:
> qmicli -d /dev/cdc-wdm0 --uim-get-file-attributes=0x3f00,0x7fff,0x6fad
> [(null)] Successfully got file '/dev/cdc-wdm0' attributes from the UIM:
> Card result:
>         SW1: '0x90'
>         SW2: '0x00'
> File attributes:
>         File size: 4
>         File ID: 28589
>         File type: transparent
>         Record size: 0
>         Record count: 0
>         Read security attributes: (always) (null)
>         Write security attributes: (single) adm
>         Increase security attributes: (always) (null)
>         Deactivate security attributes: (single) adm
>         Activate security attributes: (single) adm
>         Raw:    62:17:82:02:41:21:83:02:6F:AD:8A:01:05:8B:...
>
> After a check of parameters sent by qmimodem driver and qmicli,
> the only difference is on parameter "Session Information".
> Session type sent by qmimodem driver is 'Card on slot 1'.
> Session type sent by qmicli command is 'primary-gw-provisioning'.
> Changing session type in qmimodem driver fixed problem (on this modem).
>
> Comparing with what is done by qmili command
> ---
>  drivers/qmimodem/sim.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>

Applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-17 17:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-17 15:06 [PATCH 0/1] fix SIM file reading on MC7304 modem Christophe Ronco
2017-02-17 15:06 ` [PATCH 1/1] qmimodem: fix sim file reading on MC7304 Christophe Ronco
2017-02-17 17:18   ` Denis Kenzior

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.