Change in osmo-bsc[master]: generate_ma_for_ts: check num_cell_arfcns to guarantee no out-of-boun...

2021-04-05 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/20290 )

Change subject: generate_ma_for_ts: check num_cell_arfcns to guarantee no 
out-of-bounds access
..


Patch Set 1: Code-Review-2

So, I ended up spending more time on it and taking a more radical approach:

https://gerrit.osmocom.org/c/osmo-bsc/+/23645 [hopping] vty: ensure no 
duplicate hopping ARFCN entries [NEW]
https://gerrit.osmocom.org/c/osmo-bsc/+/23646 [hopping] 
generate_cell_chan_list(): make some pointers const [NEW]
https://gerrit.osmocom.org/c/osmo-bsc/+/23647 [hopping] 
gsm48_send_rr_ass_cmd(): use Cell Channel Description from SI1 [NEW]
https://gerrit.osmocom.org/c/osmo-bsc/+/23648 [hopping] generate_ma_for_ts() 
returns no meaningful value [NEW]
https://gerrit.osmocom.org/c/osmo-bsc/+/23649 [hopping] Rework generation of 
Cell/Mobile Allocation [NEW]
https://gerrit.osmocom.org/c/osmo-bsc/+/23650 [hopping] bootstrap_rsl(): do not 
call generate_ma_for_ts() again [NEW]

TL;DR, the idea is to mitigate the possibility of having more than 64 ARFCNs in 
the Channel Allocation during the configuration, rather than surprising the 
user at run-time.


--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/20290
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I2ee8e8b4ba5e16b955685ba42bd58dc2ea08720f
Gerrit-Change-Number: 20290
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Assignee: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: lynxis lazus 
Gerrit-CC: laforge 
Gerrit-Comment-Date: Tue, 06 Apr 2021 03:04:51 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-bsc[master]: [hopping] generate_ma_for_ts() returns no meaningful value

2021-04-05 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/23648 )


Change subject: [hopping] generate_ma_for_ts() returns no meaningful value
..

[hopping] generate_ma_for_ts() returns no meaningful value

Change-Id: Ic3ba3323459bba1336adb1f902cb2371edea1f71
---
M src/osmo-bsc/osmo_bsc_main.c
1 file changed, 2 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/48/23648/1

diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index ec07410..6c7c275 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -256,7 +256,7 @@
 }

 /* Produce a MA as specified in 10.5.2.21 */
-static int generate_ma_for_ts(struct gsm_bts_trx_ts *ts)
+static void generate_ma_for_ts(struct gsm_bts_trx_ts *ts)
 {
/* we have three bitvecs: the per-timeslot ARFCNs, the cell chan ARFCNs
 * and the MA */
@@ -271,7 +271,7 @@
memset(ma->data, 0, ma->data_len);

if (!ts->hopping.enabled)
-   return 0;
+   return;

/* count the number of ARFCNs in the cell channel allocation */
num_cell_arfcns = 0;
@@ -303,8 +303,6 @@
else
bitvec_set_bit_pos(ma, ma->cur_bit, 0);
}
-
-   return 0;
 }

 static void bootstrap_rsl(struct gsm_bts_trx *trx)

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/23648
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic3ba3323459bba1336adb1f902cb2371edea1f71
Gerrit-Change-Number: 23648
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-MessageType: newchange


Change in osmo-bsc[master]: [hopping] bootstrap_rsl(): do not call generate_ma_for_ts() again

2021-04-05 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/23650 )


Change subject: [hopping] bootstrap_rsl(): do not call generate_ma_for_ts() 
again
..

[hopping] bootstrap_rsl(): do not call generate_ma_for_ts() again

It's already being called in inp_sig_cb(), once the A-bis/OML link
is established.  There is no need to do this on the A-bis/RSL link
establishment again.

Change-Id: I435018f439181cdd046ca99fe7e01ac85e226cce
---
M src/osmo-bsc/osmo_bsc_main.c
1 file changed, 0 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/50/23650/1

diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 2b4224f..5426b1e 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -357,7 +357,6 @@

for (i = 0; i < ARRAY_SIZE(trx->ts); i++) {
struct gsm_bts_trx_ts *ts = >ts[i];
-   generate_ma_for_ts(ts);
OSMO_ASSERT(ts->fi);
osmo_fsm_inst_dispatch(ts->fi, TS_EV_RSL_READY, NULL);
}

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/23650
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I435018f439181cdd046ca99fe7e01ac85e226cce
Gerrit-Change-Number: 23650
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-MessageType: newchange


Change in osmo-bsc[master]: [hopping] generate_cell_chan_list(): make some pointers const

2021-04-05 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/23646 )


Change subject: [hopping] generate_cell_chan_list(): make some pointers const
..

[hopping] generate_cell_chan_list(): make some pointers const

Change-Id: Ied4ee60224d71567ec613942ba1c03088e9b02f3
---
M src/osmo-bsc/system_information.c
1 file changed, 2 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/46/23646/1

diff --git a/src/osmo-bsc/system_information.c 
b/src/osmo-bsc/system_information.c
index 5357d20..e2ac04d 100644
--- a/src/osmo-bsc/system_information.c
+++ b/src/osmo-bsc/system_information.c
@@ -577,8 +577,8 @@
 /* generate a cell channel list as per Section 10.5.2.1b of 04.08 */
 int generate_cell_chan_list(uint8_t *chan_list, struct gsm_bts *bts)
 {
-   struct gsm_bts_trx *trx;
struct bitvec *bv = >si_common.cell_alloc;
+   const struct gsm_bts_trx *trx;

/* Zero-initialize the bit-vector */
memset(bv->data, 0, bv->data_len);
@@ -589,7 +589,7 @@
/* Always add the TRX's ARFCN */
bitvec_set_bit_pos(bv, trx->arfcn, 1);
for (i = 0; i < ARRAY_SIZE(trx->ts); i++) {
-   struct gsm_bts_trx_ts *ts = >ts[i];
+   const struct gsm_bts_trx_ts *ts = >ts[i];
/* Add any ARFCNs present in hopping channels */
for (j = 0; j < 1024; j++) {
if (bitvec_get_bit_pos(>hopping.arfcns, j))

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/23646
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ied4ee60224d71567ec613942ba1c03088e9b02f3
Gerrit-Change-Number: 23646
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-MessageType: newchange


Change in osmo-bsc[master]: [hopping] Rework generation of Cell/Mobile Allocation

2021-04-05 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/23649 )


Change subject: [hopping] Rework generation of Cell/Mobile Allocation
..

[hopping] Rework generation of Cell/Mobile Allocation

Calculating the Cell Allocation (basically a bit-vector of all the
frequencies allocated to a cell) on the OML link establishment has
several downsides and potential problems:

  * Theoretically, more than 64 ARFCNs can be allocated for a cell
via the VTY interface.  The problem here is that the Mobile
Allocation IE cannot contain more than 64 channels.

  * The BSC's operator will neither be warned by the interactive
VTY shell during configuration, nor during the startup.

  * The BSC will accept such a configuration, but then will be
unable to encode the Mobile Allocation IEs at run-time.

This change aims to improve the situation by separating part of
the logic from generate_cell_chan_list(), and invoking this
part directly from the VTY commands.  This way it will become
impossible to configure more than 64 ARFCNs, neither via the
config file, nor interactively from the VTY.

Change-Id: I98211fb0684a973239f5760e1de52a24a1f4c33c
---
M include/osmocom/bsc/bts.h
M include/osmocom/bsc/system_information.h
M src/osmo-bsc/bsc_vty.c
M src/osmo-bsc/osmo_bsc_main.c
M src/osmo-bsc/system_information.c
5 files changed, 92 insertions(+), 35 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/49/23649/1

diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h
index c8cf8b3..c03c75e 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -451,6 +451,7 @@
struct bitvec si5_neigh_list;
struct osmo_earfcn_si2q si2quater_neigh_list;
size_t uarfcn_length; /* index for uarfcn and scramble lists */
+   size_t cell_chan_num; /* number of channels in Cell Allocation 
*/
struct {
/* bitmask large enough for all possible ARFCN's */
uint8_t neigh_list[1024/8];
diff --git a/include/osmocom/bsc/system_information.h 
b/include/osmocom/bsc/system_information.h
index 35892d9..e86a349 100644
--- a/include/osmocom/bsc/system_information.h
+++ b/include/osmocom/bsc/system_information.h
@@ -7,6 +7,7 @@

 struct gsm_bts;

+int generate_cell_chan_alloc(struct gsm_bts *bts);
 int generate_cell_chan_list(uint8_t *chan_list, struct gsm_bts *bts);
 int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type type);
 size_t si2q_earfcn_count(const struct osmo_earfcn_si2q *e);
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 6a6411f..5eb2393 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -5334,6 +5334,12 @@

trx->arfcn = arfcn;

+   /* Update Cell Allocation (list of all the frequencies allocated to a 
cell) */
+   if (generate_cell_chan_alloc(trx->bts) != 0) {
+   vty_out(vty, "%% Failed to re-generate Cell Allocation%s", 
VTY_NEWLINE);
+   return CMD_WARNING;
+   }
+
/* FIXME: patch ARFCN into SYSTEM INFORMATION */
/* FIXME: use OML layer to update the ARFCN */
/* FIXME: use RSL layer to update SYSTEM INFORMATION */
@@ -5604,6 +5610,13 @@

bitvec_set_bit_pos(>hopping.arfcns, arfcn, 1);

+   /* Update Cell Allocation (list of all the frequencies allocated to a 
cell) */
+   if (generate_cell_chan_alloc(ts->trx->bts) != 0) {
+   vty_out(vty, "%% Failed to re-generate Cell Allocation%s", 
VTY_NEWLINE);
+   bitvec_set_bit_pos(>hopping.arfcns, arfcn, ZERO); /* 
roll-back */
+   return CMD_WARNING;
+   }
+
return CMD_SUCCESS;
 }

@@ -5630,6 +5643,13 @@

bitvec_set_bit_pos(>hopping.arfcns, arfcn, 0);

+   /* Update Cell Allocation (list of all the frequencies allocated to a 
cell) */
+   if (generate_cell_chan_alloc(ts->trx->bts) != 0) {
+   vty_out(vty, "%% Failed to re-generate Cell Allocation%s", 
VTY_NEWLINE);
+   /* It's unlikely to happen on removal, so we don't roll-back */
+   return CMD_WARNING;
+   }
+
return CMD_SUCCESS;
 }

@@ -5644,6 +5664,13 @@

bitvec_zero(>hopping.arfcns);

+   /* Update Cell Allocation (list of all the frequencies allocated to a 
cell) */
+   if (generate_cell_chan_alloc(ts->trx->bts) != 0) {
+   vty_out(vty, "%% Failed to re-generate Cell Allocation%s", 
VTY_NEWLINE);
+   /* It's unlikely to happen on removal, so we don't roll-back */
+   return CMD_WARNING;
+   }
+
return CMD_SUCCESS;
 }

diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 6c7c275..2b4224f 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -260,10 +260,10 @@
 {
/* we have three bitvecs: the per-timeslot 

Change in osmo-bsc[master]: [hopping] gsm48_send_rr_ass_cmd(): use Cell Channel Description from SI1

2021-04-05 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/23647 )


Change subject: [hopping] gsm48_send_rr_ass_cmd(): use Cell Channel Description 
from SI1
..

[hopping] gsm48_send_rr_ass_cmd(): use Cell Channel Description from SI1

Calling generate_cell_chan_list() on each Assignment Command is
quite expensive, because this function basically re-constructs
the Cell Allocation (using bitvec API) and the Frequency List
from scratch.  This IE can be borrowed from pre-calculated
SI1 message, so let's do this.

Change-Id: I9c8c5ae9059ff096765412b3f3c7181a94163afc
---
M src/osmo-bsc/gsm_04_08_rr.c
1 file changed, 5 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/47/23647/1

diff --git a/src/osmo-bsc/gsm_04_08_rr.c b/src/osmo-bsc/gsm_04_08_rr.c
index a448126..4a47c66 100644
--- a/src/osmo-bsc/gsm_04_08_rr.c
+++ b/src/osmo-bsc/gsm_04_08_rr.c
@@ -592,9 +592,11 @@

/* Cell Channel Description (freq. hopping), TV (see 3GPP TS 44.018, 
10.5.2.1b) */
if (lchan->ts->hopping.enabled) {
-   uint8_t *chan_desc = msgb_put(msg, 1 + 16); /* tag + fixed 
length */
-   generate_cell_chan_list(chan_desc + 1, 
dest_lchan->ts->trx->bts);
-   chan_desc[0] = GSM48_IE_CELL_CH_DESC;
+   const struct gsm48_system_information_type_1 *si1 = \
+   GSM_BTS_SI(lchan->ts->trx->bts, 1);
+   msgb_tv_fixed_put(msg, GSM48_IE_CELL_CH_DESC,
+ sizeof(si1->cell_channel_description),
+ si1->cell_channel_description);
}

msgb_tv_put(msg, GSM48_IE_CHANMODE_1, lchan->tch_mode);

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/23647
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I9c8c5ae9059ff096765412b3f3c7181a94163afc
Gerrit-Change-Number: 23647
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-MessageType: newchange


Change in osmo-bsc[master]: [hopping] vty: ensure no duplicate hopping ARFCN entries

2021-04-05 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/23645 )


Change subject: [hopping] vty: ensure no duplicate hopping ARFCN entries
..

[hopping] vty: ensure no duplicate hopping ARFCN entries

Change-Id: Ie27c859e3f16ada08a5cdc8ab4ac6e20a885a378
---
M src/osmo-bsc/bsc_vty.c
1 file changed, 10 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/45/23645/1

diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 91eaee0..6a6411f 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -5597,6 +5597,11 @@
return CMD_WARNING;
}

+   if (bitvec_get_bit_pos(>hopping.arfcns, arfcn) == ONE) {
+   vty_out(vty, "%% ARFCN %" PRIu16 " is already set%s", arfcn, 
VTY_NEWLINE);
+   return CMD_WARNING;
+   }
+
bitvec_set_bit_pos(>hopping.arfcns, arfcn, 1);

return CMD_SUCCESS;
@@ -5618,6 +5623,11 @@
return CMD_WARNING;
}

+   if (bitvec_get_bit_pos(>hopping.arfcns, arfcn) != ONE) {
+   vty_out(vty, "%% ARFCN %" PRIu16 " is not set%s", arfcn, 
VTY_NEWLINE);
+   return CMD_WARNING;
+   }
+
bitvec_set_bit_pos(>hopping.arfcns, arfcn, 0);

return CMD_SUCCESS;

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/23645
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ie27c859e3f16ada08a5cdc8ab4ac6e20a885a378
Gerrit-Change-Number: 23645
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-MessageType: newchange


Build failure of network:osmocom:nightly/simtrace2 in Debian_9.0/armv7l

2021-04-05 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/simtrace2/Debian_9.0/armv7l

Package network:osmocom:nightly/simtrace2 failed to build in Debian_9.0/armv7l

Check out the package for editing:
  osc checkout network:osmocom:nightly simtrace2

Last lines of build log:
[  493s] [COMPILING ./atmel_softpack_libraries/usb/device/dfu/dfu_driver.c]
[  494s] Memory region Used Size  Region Size  %age Used
[  494s]  rom:   16400 B16 KB100.10%
[  494s]  ram:   11688 B48 KB 
23.78/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: warning: 
changing start of section .stack by 4 bytes
[  494s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  494s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
bin/qmod-dfu-flash.elf section `.text' will not fit in region `rom'
[  494s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  494s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  494s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  494s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: region 
`rom' overflowed by 16 bytes
[  494s] collect2: error: ld returned 1 exit status
[  494s] %
[  494s] Makefile:238: recipe for target 'flash' failed
[  494s] make[2]: *** [flash] Error 1
[  494s] make[2]: Leaving directory '/usr/src/packages/BUILD/firmware'
[  494s] Makefile:13: recipe for target 'fw-qmod-dfu' failed
[  494s] make[1]: *** [fw-qmod-dfu] Error 2
[  494s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[  494s] dh_auto_build: make -j1 returned exit code 2
[  494s] debian/rules:16: recipe for target 'build' failed
[  494s] make: *** [build] Error 2
[  494s] dpkg-buildpackage: error: debian/rules build gave error exit status 2
[  494s] ### VM INTERACTION START ###
[  498s] [  425.943267] sysrq: SysRq : Power Off
[  498s] [  426.132954] reboot: Power down
[  498s] ### VM INTERACTION END ###
[  498s] 
[  498s] armbuild21 failed "build simtrace2_0.7.0.88.7a3d.dsc" at Tue Apr  6 
01:50:53 UTC 2021.
[  498s] 

-- 
Configure notifications at https://build.opensuse.org/my/subscriptions
openSUSE Build Service (https://build.opensuse.org/)


Build failure of network:osmocom:nightly/simtrace2 in Debian_9.0/aarch64

2021-04-05 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/simtrace2/Debian_9.0/aarch64

Package network:osmocom:nightly/simtrace2 failed to build in Debian_9.0/aarch64

Check out the package for editing:
  osc checkout network:osmocom:nightly simtrace2

Last lines of build log:
[  145s] [COMPILING ./atmel_softpack_libraries/usb/device/dfu/dfu_driver.c]
[  146s] Memory region Used Size  Region Size  %age Used
[  146s]  rom:   16400 B16 KB100.10%
[  146s]  ram:   11688 B48 KB 
23.78/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: warning: 
changing start of section .stack by 4 bytes
[  146s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  146s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
bin/qmod-dfu-flash.elf section `.text' will not fit in region `rom'
[  146s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  146s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  146s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  146s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: region 
`rom' overflowed by 16 bytes
[  146s] collect2: error: ld returned 1 exit status
[  146s] %
[  146s] Makefile:238: recipe for target 'flash' failed
[  146s] make[2]: *** [flash] Error 1
[  146s] make[2]: Leaving directory '/usr/src/packages/BUILD/firmware'
[  146s] Makefile:13: recipe for target 'fw-qmod-dfu' failed
[  146s] make[1]: *** [fw-qmod-dfu] Error 2
[  146s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[  146s] dh_auto_build: make -j1 returned exit code 2
[  146s] debian/rules:16: recipe for target 'build' failed
[  146s] make: *** [build] Error 2
[  146s] dpkg-buildpackage: error: debian/rules build gave error exit status 2
[  146s] ### VM INTERACTION START ###
[  149s] [  138.003931] sysrq: Power Off
[  149s] [  138.041713] reboot: Power down
[  149s] ### VM INTERACTION END ###
[  149s] 
[  149s] obs-arm-8 failed "build simtrace2_0.7.0.88.7a3d.dsc" at Tue Apr  6 
01:37:49 UTC 2021.
[  149s] 

-- 
Configure notifications at https://build.opensuse.org/my/subscriptions
openSUSE Build Service (https://build.opensuse.org/)


Build failure of network:osmocom:nightly/simtrace2 in xUbuntu_20.04/x86_64

2021-04-05 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/simtrace2/xUbuntu_20.04/x86_64

Package network:osmocom:nightly/simtrace2 failed to build in 
xUbuntu_20.04/x86_64

Check out the package for editing:
  osc checkout network:osmocom:nightly simtrace2

Last lines of build log:
[  155s] [COMPILING apps/dfu/main.c]
[  156s] [COMPILING ./atmel_softpack_libraries/usb/device/dfu/dfu.c]
[  156s] [COMPILING ./atmel_softpack_libraries/usb/device/dfu/dfu_desc.c]
[  156s] [COMPILING ./atmel_softpack_libraries/usb/device/dfu/dfu_driver.c]
[  156s] Memory region Used Size  Region Size  %age Used
[  156s]  rom:   16628 B16 KB101.49%
[  156s]  ram:   11688 B48 KB 
23.78/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: warning: 
changing start of section .stack by 4 bytes
[  156s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  156s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: 
bin/qmod-dfu-flash.elf section `.text' will not fit in region `rom'
[  156s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  156s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  156s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  156s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: region 
`rom' overflowed by 244 bytes
[  156s] collect2: error: ld returned 1 exit status
[  156s] %
[  156s] make[2]: *** [Makefile:238: flash] Error 1
[  156s] make[2]: Leaving directory '/usr/src/packages/BUILD/firmware'
[  156s] make[1]: *** [Makefile:13: fw-qmod-dfu] Error 2
[  156s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[  156s] dh_auto_build: error: make -j1 returned exit code 2
[  156s] make: *** [debian/rules:16: build] Error 25
[  156s] dpkg-buildpackage: error: debian/rules build subprocess returned exit 
status 2
[  156s] ### VM INTERACTION START ###
[  159s] [  144.075536] sysrq: Power Off
[  159s] [  144.079772] reboot: Power down
[  159s] ### VM INTERACTION END ###
[  159s] 
[  159s] cloud117 failed "build simtrace2_0.7.0.88.7a3d.dsc" at Tue Apr  6 
01:37:42 UTC 2021.
[  159s] 

-- 
Configure notifications at https://build.opensuse.org/my/subscriptions
openSUSE Build Service (https://build.opensuse.org/)


Build failure of network:osmocom:nightly/simtrace2 in xUbuntu_18.04/x86_64

2021-04-05 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/simtrace2/xUbuntu_18.04/x86_64

Package network:osmocom:nightly/simtrace2 failed to build in 
xUbuntu_18.04/x86_64

Check out the package for editing:
  osc checkout network:osmocom:nightly simtrace2

Last lines of build log:
[  110s] [COMPILING ./atmel_softpack_libraries/usb/device/dfu/dfu_driver.c]
[  110s] Memory region Used Size  Region Size  %age Used
[  110s]  rom:   16400 B16 KB100.10%
[  110s]  ram:   11688 B48 KB 
23.78/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: warning: 
changing start of section .stack by 4 bytes
[  110s] /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  110s] /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: 
bin/qmod-dfu-flash.elf section `.text' will not fit in region `rom'
[  110s] /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  110s] /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  110s] /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  110s] /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: region 
`rom' overflowed by 16 bytes
[  110s] collect2: error: ld returned 1 exit status
[  110s] %
[  110s] Makefile:238: recipe for target 'flash' failed
[  110s] make[2]: *** [flash] Error 1
[  110s] make[2]: Leaving directory '/usr/src/packages/BUILD/firmware'
[  110s] Makefile:13: recipe for target 'fw-qmod-dfu' failed
[  110s] make[1]: *** [fw-qmod-dfu] Error 2
[  110s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[  110s] dh_auto_build: make -j1 returned exit code 2
[  110s] debian/rules:16: recipe for target 'build' failed
[  110s] make: *** [build] Error 2
[  110s] dpkg-buildpackage: error: debian/rules build subprocess returned exit 
status 2
[  111s] ### VM INTERACTION START ###
[  114s] [  105.138785] sysrq: Power Off
[  114s] [  105.141747] reboot: Power down
[  114s] ### VM INTERACTION END ###
[  114s] 
[  114s] old-atreju2 failed "build simtrace2_0.7.0.88.7a3d.dsc" at Tue Apr  6 
01:36:18 UTC 2021.
[  114s] 

-- 
Configure notifications at https://build.opensuse.org/my/subscriptions
openSUSE Build Service (https://build.opensuse.org/)


Build failure of network:osmocom:nightly/simtrace2 in xUbuntu_20.10/x86_64

2021-04-05 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/simtrace2/xUbuntu_20.10/x86_64

Package network:osmocom:nightly/simtrace2 failed to build in 
xUbuntu_20.10/x86_64

Check out the package for editing:
  osc checkout network:osmocom:nightly simtrace2

Last lines of build log:
[  110s] [COMPILING libboard/qmod/source/board_qmod.c]
[  110s] [COMPILING libboard/qmod/source/card_pres.c]
[  110s] [COMPILING libboard/qmod/source/i2c.c]
[  110s] [COMPILING libboard/qmod/source/wwan_led.c]
[  111s] [COMPILING libboard/qmod/source/wwan_perst.c]
[  111s] [COMPILING apps/dfu/main.c]
[  111s] [COMPILING ./atmel_softpack_libraries/usb/device/dfu/dfu.c]
[  111s] [COMPILING ./atmel_softpack_libraries/usb/device/dfu/dfu_desc.c]
[  111s] [COMPILING ./atmel_softpack_libraries/usb/device/dfu/dfu_driver.c]
[  111s] Memory region Used Size  Region Size  %age Used
[  111s]  rom:   16628 B16 KB101.49%
[  111s]  ram:   11680 B48 KB 
23.76/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: 
bin/qmod-dfu-flash.elf section `.text' will not fit in region `rom'
[  111s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: region 
`rom' overflowed by 244 bytes
[  111s] collect2: error: ld returned 1 exit status
[  111s] %
[  111s] make[2]: *** [Makefile:238: flash] Error 1
[  111s] make[2]: Leaving directory '/usr/src/packages/BUILD/firmware'
[  111s] make[1]: *** [Makefile:13: fw-qmod-dfu] Error 2
[  111s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[  111s] dh_auto_build: error: make -j1 returned exit code 2
[  111s] make: *** [debian/rules:16: build] Error 25
[  111s] dpkg-buildpackage: error: debian/rules build subprocess returned exit 
status 2
[  111s] ### VM INTERACTION START ###
[  114s] [  104.246052] sysrq: Power Off
[  114s] [  104.250542] reboot: Power down
[  114s] ### VM INTERACTION END ###
[  114s] 
[  114s] sheep86 failed "build simtrace2_0.7.0.88.7a3d.dsc" at Tue Apr  6 
01:36:19 UTC 2021.
[  114s] 

-- 
Configure notifications at https://build.opensuse.org/my/subscriptions
openSUSE Build Service (https://build.opensuse.org/)


Build failure of network:osmocom:nightly/simtrace2 in Debian_9.0/x86_64

2021-04-05 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/simtrace2/Debian_9.0/x86_64

Package network:osmocom:nightly/simtrace2 failed to build in Debian_9.0/x86_64

Check out the package for editing:
  osc checkout network:osmocom:nightly simtrace2

Last lines of build log:
[  108s] [COMPILING ./atmel_softpack_libraries/usb/device/dfu/dfu_driver.c]
[  108s] Memory region Used Size  Region Size  %age Used
[  108s]  rom:   16400 B16 KB100.10%
[  108s]  ram:   11688 B48 KB 
23.78/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: warning: 
changing start of section .stack by 4 bytes
[  108s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  109s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
bin/qmod-dfu-flash.elf section `.text' will not fit in region `rom'
[  109s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  109s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  109s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  109s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: region 
`rom' overflowed by 16 bytes
[  109s] collect2: error: ld returned 1 exit status
[  109s] %
[  109s] Makefile:238: recipe for target 'flash' failed
[  109s] make[2]: *** [flash] Error 1
[  109s] make[2]: Leaving directory '/usr/src/packages/BUILD/firmware'
[  109s] Makefile:13: recipe for target 'fw-qmod-dfu' failed
[  109s] make[1]: *** [fw-qmod-dfu] Error 2
[  109s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[  109s] dh_auto_build: make -j1 returned exit code 2
[  109s] debian/rules:16: recipe for target 'build' failed
[  109s] make: *** [build] Error 2
[  109s] dpkg-buildpackage: error: debian/rules build gave error exit status 2
[  109s] ### VM INTERACTION START ###
[  112s] [   96.425958] sysrq: Power Off
[  112s] [   96.433081] reboot: Power down
[  112s] ### VM INTERACTION END ###
[  112s] 
[  112s] cloud137 failed "build simtrace2_0.7.0.88.7a3d.dsc" at Tue Apr  6 
01:33:48 UTC 2021.
[  112s] 

-- 
Configure notifications at https://build.opensuse.org/my/subscriptions
openSUSE Build Service (https://build.opensuse.org/)


Build failure of network:osmocom:nightly/simtrace2 in Debian_9.0/i586

2021-04-05 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/simtrace2/Debian_9.0/i586

Package network:osmocom:nightly/simtrace2 failed to build in Debian_9.0/i586

Check out the package for editing:
  osc checkout network:osmocom:nightly simtrace2

Last lines of build log:
[  100s] [COMPILING ./atmel_softpack_libraries/usb/device/dfu/dfu_driver.c]
[  101s] Memory region Used Size  Region Size  %age Used
[  101s]  rom:   16400 B16 KB100.10%
[  101s]  ram:   11688 B48 KB 
23.78/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: warning: 
changing start of section .stack by 4 bytes
[  101s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  101s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
bin/qmod-dfu-flash.elf section `.text' will not fit in region `rom'
[  101s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  101s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  101s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: 
warning: changing start of section .stack by 4 bytes
[  101s] /usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: region 
`rom' overflowed by 16 bytes
[  101s] collect2: error: ld returned 1 exit status
[  101s] %
[  101s] Makefile:238: recipe for target 'flash' failed
[  101s] make[2]: *** [flash] Error 1
[  101s] make[2]: Leaving directory '/usr/src/packages/BUILD/firmware'
[  101s] Makefile:13: recipe for target 'fw-qmod-dfu' failed
[  101s] make[1]: *** [fw-qmod-dfu] Error 2
[  101s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[  101s] dh_auto_build: make -j1 returned exit code 2
[  101s] debian/rules:16: recipe for target 'build' failed
[  101s] make: *** [build] Error 2
[  101s] dpkg-buildpackage: error: debian/rules build gave error exit status 2
[  101s] ### VM INTERACTION START ###
[  104s] [   94.886149] sysrq: Power Off
[  104s] [   94.893591] reboot: Power down
[  104s] ### VM INTERACTION END ###
[  104s] 
[  104s] lamb52 failed "build simtrace2_0.7.0.88.7a3d.dsc" at Tue Apr  6 
01:33:31 UTC 2021.
[  104s] 

-- 
Configure notifications at https://build.opensuse.org/my/subscriptions
openSUSE Build Service (https://build.opensuse.org/)


Change in simtrace2[master]: cardemu: different init for simtrace board which uses uart timers

2021-04-05 Thread laforge
laforge has abandoned this change. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23617 )

Change subject: cardemu: different init for simtrace board which uses uart 
timers
..


Abandoned

not needed
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23617
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I464f0ce1ec5e60be5f9377186b7d13a5e6dc637e
Gerrit-Change-Number: 23617
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: tsaitgaist 
Gerrit-MessageType: abandon


Change in simtrace2[master]: cardem: ignore set ATR

2021-04-05 Thread laforge
laforge has abandoned this change. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23623 )

Change subject: cardem: ignore set ATR
..


Abandoned

PPS with baud rate chage has been confirmed working with new USART timer
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23623
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: Ibf7c6b83d2cf68172c7aa25116d838e24a95d5fe
Gerrit-Change-Number: 23623
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: tsaitgaist 
Gerrit-MessageType: abandon


Change in simtrace2[master]: Revert "add library providing ISO 7816-3 utilities"

2021-04-05 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23636 )

Change subject: Revert "add library providing ISO 7816-3 utilities"
..

Revert "add library providing ISO 7816-3 utilities"

This reverts commit 4a29f64cbe12ca9fbddd66ae10b614388fef5e9b.

The code replicates to a large extent what is already present in iso7816_fidi.c
and I have serious doubts about the correctness of the computation in
its iso7816_3_calculate_wt() function.

Change-Id: I80dab4401d13306d573a6a35ce8729d2acc141e4
---
D firmware/libcommon/include/iso7816_3.h
D firmware/libcommon/source/iso7816_3.c
2 files changed, 0 insertions(+), 229 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/firmware/libcommon/include/iso7816_3.h 
b/firmware/libcommon/include/iso7816_3.h
deleted file mode 100644
index e6c1b4f..000
--- a/firmware/libcommon/include/iso7816_3.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2019 sysmocom -s.f.m.c. GmbH, Author: Kevin Redon 

- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * 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 Street, Fifth Floor, Boston, MA  02110-1301, 
USA.
-*/
-
-/* this library provides utilities to handle the ISO-7816 part 3 communication 
aspects (e.g. related
- * to F and D) */
-
-#pragma once
-
-#include 
-#include 
-
-/*! default clock rate conversion integer Fd.
- *  ISO/IEC 7816-3:2006(E) section 8.1 */
-#define ISO7816_3_DEFAULT_FD 372
-
-/*! default baud rate adjustment factor Dd.
- *  ISO/IEC 7816-3:2006(E) section 8.1 */
-#define ISO7816_3_DEFAULT_DD 1
-
-/*! default clock rate conversion integer Fi.
- *  ISO/IEC 7816-3:2006(E) section 8.3
- *  \note non-default value is optionally specified in TA1 */
-#define ISO7816_3_DEFAULT_FI 372
-
-/*! default baud rate adjustment factor Di.
- *  ISO/IEC 7816-3:2006(E) section 8.3
- *  \note non-default value is optionally specified in TA1 */
-#define ISO7816_3_DEFAULT_DI 1
-
-/*! default maximum clock frequency, in Hz.
- *  ISO/IEC 7816-3:2006(E) section 8.3
- *  \note non-default value is optionally specified in TA1 */
-#define ISO7816_3_DEFAULT_FMAX 500UL
-
-/*! default Waiting Integer (WI) value for T=0.
- *  ISO/IEC 7816-3:2006(E) section 10.2
- *  \note non-default value is optionally specified in TC2 */
-#define ISO7816_3_DEFAULT_WI 10
-
-/*! default Waiting Time (WT) value, in ETU.
- *  ISO/IEC 7816-3:2006(E) section 8.1
- *  \note depends on Fi, Di, and WI if protocol T=0 is selected */
-#define ISO7816_3_DEFAULT_WT 9600
-
-extern const uint16_t iso7816_3_fi_table[];
-
-extern const uint32_t iso7816_3_fmax_table[];
-
-extern const uint8_t iso7816_3_di_table[];
-
-bool iso7816_3_valid_f(uint16_t f);
-
-bool iso7816_3_valid_d(uint8_t d);
-
-int32_t iso7816_3_calculate_wt(uint8_t wi, uint16_t fi, uint8_t di, uint16_t 
f, uint8_t d);
diff --git a/firmware/libcommon/source/iso7816_3.c 
b/firmware/libcommon/source/iso7816_3.c
deleted file mode 100644
index ccdff68..000
--- a/firmware/libcommon/source/iso7816_3.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (C) 2019 sysmocom -s.f.m.c. GmbH, Author: Kevin Redon 

- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * 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 Street, Fifth Floor, Boston, MA  02110-1301, 
USA.
-*/
-#include 
-#include 
-
-#include "utils.h"
-#include "iso7816_3.h"
-
-/*! Table of clock rate conversion integer F indexed by Fi.
- *  \note Fi is indicated in TA1, but the same table is used for F and Fn 
during PPS
- *  ISO/IEC 7816-3:2006(E) table 7 */
-const uint16_t iso7816_3_fi_table[16] = {
-   372, 372, 558, 744, 1116, 1488, 1860, 0,
-   0, 512, 768, 1024, 1536, 2048, 0, 0
-};
-
-/*! Table of maximum clock frequency f_max in Hz indexed by Fi.

Change in simtrace2[master]: Revert "add ISO 7816-3 library to remsim project"

2021-04-05 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23635 )

Change subject: Revert "add ISO 7816-3 library to remsim project"
..

Revert "add ISO 7816-3 library to remsim project"

This reverts commit 4a58c08d671adc928fea9dc12018c26818f24d4e.

The code replicates to a large extent what is already present in iso7816_fidi.c
and I have serious doubts about the correctness of the computation in
its iso7816_3_calculate_wt() function.

Change-Id: I3f26da4e9aa8d7b0f4b4b7992269cf365a643ec7
---
M firmware/apps/cardem/Makefile
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/firmware/apps/cardem/Makefile b/firmware/apps/cardem/Makefile
index d5f68a5..75c43e8 100644
--- a/firmware/apps/cardem/Makefile
+++ b/firmware/apps/cardem/Makefile
@@ -1,3 +1,3 @@
 C_FILES += $(C_LIBUSB_RT)

-C_FILES += card_emu.c cciddriver.c iso7816_3.c iso7816_4.c iso7816_fidi.c 
mitm.c mode_cardemu.c mode_ccid.c simtrace_iso7816.c sniffer.c tc_etu.c usb.c
+C_FILES += card_emu.c cciddriver.c iso7816_4.c iso7816_fidi.c mitm.c 
mode_cardemu.c mode_ccid.c simtrace_iso7816.c sniffer.c tc_etu.c usb.c

--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23635
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I3f26da4e9aa8d7b0f4b4b7992269cf365a643ec7
Gerrit-Change-Number: 23635
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in simtrace2[master]: simtrace2-cardem-pcsc: Make it work again

2021-04-05 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23634 )

Change subject: simtrace2-cardem-pcsc: Make it work again
..

simtrace2-cardem-pcsc: Make it work again

* support Interrupt STATUS notifications
* use osmocom libusb abstraction
* use asynchronous URBs for interrupt + bulk

Change-Id: Ib04798572295f25477719124530b6584780c5b75
---
M host/src/simtrace2-cardem-pcsc.c
1 file changed, 159 insertions(+), 23 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/host/src/simtrace2-cardem-pcsc.c b/host/src/simtrace2-cardem-pcsc.c
index f11330c..543780f 100644
--- a/host/src/simtrace2-cardem-pcsc.c
+++ b/host/src/simtrace2-cardem-pcsc.c
@@ -47,11 +47,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 

 #define ATR_MAX_LEN 33

+#define LOGCI(ci, lvl, fmt, args ...) printf(fmt, ## args)

 /* reasonable ATR offering all protocols and voltages
  * smartphones might not care, but other readers do
@@ -180,6 +182,9 @@
case SIMTRACE_MSGT_DO_CEMU_RX_DATA:
rc = process_do_rx_da(ci, buf, len);
break;
+   case SIMTRACE_MSGT_BD_CEMU_CONFIG:
+   /* firmware confirms configuration change; ignore */
+   break;
default:
printf("unknown simtrace msg type 0x%02x\n", sh->msg_type);
rc = -1;
@@ -189,6 +194,144 @@
return rc;
 }

+/*! \brief Process a STATUS message on IRQ endpoint from the SIMtrace2 */
+static int process_irq_status(struct osmo_st2_cardem_inst *ci, const uint8_t 
*buf, int len)
+{
+   const struct cardemu_usb_msg_status *status = (struct 
cardemu_usb_msg_status *) buf;
+
+   LOGCI(ci, LOGL_INFO, "SIMtrace IRQ STATUS: flags=0x%x, fi=%u, di=%u, 
wi=%u wtime=%u\n",
+   status->flags, status->fi, status->di, status->wi,
+   status->waiting_time);
+
+   return 0;
+}
+
+static int process_usb_msg_irq(struct osmo_st2_cardem_inst *ci, const uint8_t 
*buf, unsigned int len)
+{
+   struct simtrace_msg_hdr *sh = (struct simtrace_msg_hdr *)buf;
+   int rc;
+
+   LOGCI(ci, LOGL_INFO, "SIMtrace IRQ %s\n", osmo_hexdump(buf, len));
+
+   buf += sizeof(*sh);
+
+   switch (sh->msg_type) {
+   case SIMTRACE_MSGT_BD_CEMU_STATUS:
+   rc = process_irq_status(ci, buf, len);
+   break;
+   default:
+   LOGCI(ci, LOGL_ERROR, "unknown simtrace msg type 0x%02x\n", 
sh->msg_type);
+   rc = -1;
+   break;
+   }
+
+   return rc;
+}
+
+static void usb_in_xfer_cb(struct libusb_transfer *xfer)
+{
+   struct osmo_st2_cardem_inst *ci = xfer->user_data;
+   int rc;
+
+   switch (xfer->status) {
+   case LIBUSB_TRANSFER_COMPLETED:
+   /* hand the message up the stack */
+   process_usb_msg(ci, xfer->buffer, xfer->actual_length);
+   break;
+   case LIBUSB_TRANSFER_NO_DEVICE:
+   LOGCI(ci, LOGL_FATAL, "USB device disappeared\n");
+   exit(1);
+   break;
+   default:
+   LOGCI(ci, LOGL_FATAL, "USB IN transfer failed, status=%u\n", 
xfer->status);
+   exit(1);
+   break;
+   }
+
+   /* re-submit the IN transfer */
+   rc = libusb_submit_transfer(xfer);
+   OSMO_ASSERT(rc == 0);
+}
+
+
+static void allocate_and_submit_in(struct osmo_st2_cardem_inst *ci)
+{
+   struct osmo_st2_transport *transp = ci->slot->transp;
+   struct libusb_transfer *xfer;
+   int rc;
+
+   xfer = libusb_alloc_transfer(0);
+   OSMO_ASSERT(xfer);
+   xfer->dev_handle = transp->usb_devh;
+   xfer->flags = 0;
+   xfer->type = LIBUSB_TRANSFER_TYPE_BULK;
+   xfer->endpoint = transp->usb_ep.in;
+   xfer->timeout = 0;
+   xfer->user_data = ci;
+   xfer->length = 16*256;
+
+   xfer->buffer = libusb_dev_mem_alloc(xfer->dev_handle, xfer->length);
+   OSMO_ASSERT(xfer->buffer);
+   xfer->callback = usb_in_xfer_cb;
+
+   /* submit the IN transfer */
+   rc = libusb_submit_transfer(xfer);
+   OSMO_ASSERT(rc == 0);
+}
+
+
+static void usb_irq_xfer_cb(struct libusb_transfer *xfer)
+{
+   struct osmo_st2_cardem_inst *ci = xfer->user_data;
+   int rc;
+
+   switch (xfer->status) {
+   case LIBUSB_TRANSFER_COMPLETED:
+   process_usb_msg_irq(ci, xfer->buffer, xfer->actual_length);
+   break;
+   case LIBUSB_TRANSFER_NO_DEVICE:
+   LOGCI(ci, LOGL_FATAL, "USB device disappeared\n");
+   exit(1);
+   break;
+   default:
+   LOGCI(ci, LOGL_FATAL, "USB IN transfer failed, status=%u\n", 
xfer->status);
+   exit(1);
+   break;
+   }
+
+   /* re-submit the IN transfer */
+   rc = libusb_submit_transfer(xfer);
+   OSMO_ASSERT(rc == 0);
+}
+
+

Change in simtrace2[master]: Revert "add library providing ISO 7816-3 utilities"

2021-04-05 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23636 )

Change subject: Revert "add library providing ISO 7816-3 utilities"
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23636
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I80dab4401d13306d573a6a35ce8729d2acc141e4
Gerrit-Change-Number: 23636
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Tue, 06 Apr 2021 00:38:56 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in simtrace2[master]: Revert "add ISO 7816-3 library to remsim project"

2021-04-05 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23635 )

Change subject: Revert "add ISO 7816-3 library to remsim project"
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23635
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I3f26da4e9aa8d7b0f4b4b7992269cf365a643ec7
Gerrit-Change-Number: 23635
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Tue, 06 Apr 2021 00:38:54 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in simtrace2[master]: simtrace2-cardem-pcsc: Make it work again

2021-04-05 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23634 )

Change subject: simtrace2-cardem-pcsc: Make it work again
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23634
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: Ib04798572295f25477719124530b6584780c5b75
Gerrit-Change-Number: 23634
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Tue, 06 Apr 2021 00:38:50 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in simtrace2[master]: card_emu: Fix computation of waiting time

2021-04-05 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23644 )


Change subject: card_emu: Fix computation of waiting time
..

card_emu: Fix computation of waiting time

As we store the waiting time (WT) in 'etu', we must adjust the formula
from ISO 7816-3.  The 'Fi' component in the formula only exists to
compute clock cycles from the etu, which we don't need here.

Without this patch, the waiting time would be way too large (by a factor
of 372 in the default case).

Change-Id: Ia21bc7303f9b38834b5b1753983ed2a99bfc7d95
---
M firmware/libcommon/source/card_emu.c
M firmware/libcommon/source/mode_cardemu.c
2 files changed, 5 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/44/23644/1

diff --git a/firmware/libcommon/source/card_emu.c 
b/firmware/libcommon/source/card_emu.c
index cefc957..bcd5fd6 100644
--- a/firmware/libcommon/source/card_emu.c
+++ b/firmware/libcommon/source/card_emu.c
@@ -505,8 +505,11 @@
}
}
}
-   /* update waiting time (see ISO 7816-3 10.2) */
-   ch->waiting_time = ch->wi * 960 * 
iso7816_3_fi_table[ch->F_index];
+   /* update waiting time (see ISO 7816-3 10.2). We can drop the Fi
+* multiplier as we store the waiting time in units of 'etu', 
and
+* don't really care what the number of clock cycles or the 
absolute
+* wall clock time is */
+   ch->waiting_time = ch->wi * 960;
/* go to next state */
card_set_state(ch, ISO_S_WAIT_TPDU);
return 0;
diff --git a/firmware/libcommon/source/mode_cardemu.c 
b/firmware/libcommon/source/mode_cardemu.c
index 14f62a6..127556c 100644
--- a/firmware/libcommon/source/mode_cardemu.c
+++ b/firmware/libcommon/source/mode_cardemu.c
@@ -225,7 +225,6 @@
want_to_expire = ci->wt.remaining - (ci->wt.total / 2);
} else
want_to_expire = ci->wt.remaining;
-   TRACE_INFO("want_to_expire=%u (total=%u, remaining=%u)\r\n", 
want_to_expire, ci->wt.total, ci->wt.remaining);
/* if value exceeds the USART TO range, use the maximum possible value 
for one round */
return OSMO_MIN(want_to_expire, 0x);
 }

--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23644
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: Ia21bc7303f9b38834b5b1753983ed2a99bfc7d95
Gerrit-Change-Number: 23644
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-CC: Jenkins Builder
Gerrit-MessageType: newchange


Change in simtrace2[master]: card_emu: explicitly initialize PTS and TPDU states

2021-04-05 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23642 )


Change subject: card_emu: explicitly initialize PTS and TPDU states
..

card_emu: explicitly initialize PTS and TPDU states

Those are already initialized at various transitions of the master
7816 FSM, but let's properly initialize them at start-up, too.

Change-Id: I81b2a8ef3284559164700d94717e4ccf008f53df
---
M firmware/libcommon/source/card_emu.c
1 file changed, 3 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/42/23642/1

diff --git a/firmware/libcommon/source/card_emu.c 
b/firmware/libcommon/source/card_emu.c
index 216ffe3..0ba6eb0 100644
--- a/firmware/libcommon/source/card_emu.c
+++ b/firmware/libcommon/source/card_emu.c
@@ -1264,6 +1264,9 @@
ch->atr.len = sizeof(default_atr);
memcpy(ch->atr.atr, default_atr, ch->atr.len);

+   ch->pts.state = PTS_S_WAIT_REQ_PTSS;
+   ch->tpdu.state = TPDU_S_WAIT_CLA;
+
card_handle_reset(ch);

tc_etu_init(ch->tc_chan, ch);

--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23642
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I81b2a8ef3284559164700d94717e4ccf008f53df
Gerrit-Change-Number: 23642
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-CC: Jenkins Builder
Gerrit-MessageType: newchange


Change in simtrace2[master]: card_emu: Fix USART timer, particularly in re-start situations

2021-04-05 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23643 )


Change subject: card_emu: Fix USART timer, particularly in re-start situations
..

card_emu: Fix USART timer, particularly in re-start situations

The existing code started the timer once (and expired once) but didn't
properly handle re-starting of the timer.  Neither did it handle
the 'half time expiration' case.  If we want to call a function after
half the WT expiring, we must of course program the hardware for half
the timeout, and not the full timeout...

Change-Id: Ia999d97f835c27597fcd1cf7ac78bac0ab9c98c1
---
M firmware/libcommon/source/mode_cardemu.c
1 file changed, 40 insertions(+), 12 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/43/23643/1

diff --git a/firmware/libcommon/source/mode_cardemu.c 
b/firmware/libcommon/source/mode_cardemu.c
index 8531eb5..14f62a6 100644
--- a/firmware/libcommon/source/mode_cardemu.c
+++ b/firmware/libcommon/source/mode_cardemu.c
@@ -212,6 +212,23 @@
return 1;
 }

+static uint16_t compute_next_timeout(struct cardem_inst *ci)
+{
+   uint32_t want_to_expire;
+
+   if (ci->wt.total == 0)
+   return 0;
+
+   if (!ci->wt.half_time_notified) {
+   /* we need to make sure to expire after half the total waiting 
time */
+   OSMO_ASSERT(ci->wt.remaining > (ci->wt.total / 2));
+   want_to_expire = ci->wt.remaining - (ci->wt.total / 2);
+   } else
+   want_to_expire = ci->wt.remaining;
+   TRACE_INFO("want_to_expire=%u (total=%u, remaining=%u)\r\n", 
want_to_expire, ci->wt.total, ci->wt.remaining);
+   /* if value exceeds the USART TO range, use the maximum possible value 
for one round */
+   return OSMO_MIN(want_to_expire, 0x);
+}

 /*! common handler if interrupt was received.
  *  \param[in] inst_num Instance number, range 0..1 (some boards only '0' 
permitted) */
@@ -254,6 +271,9 @@
 * how many etu have expired since we last sent a byte.  See section
 * 33.7.3.11 "Receiver Time-out" of the SAM3S8 Data Sheet */
if (csr & US_CSR_TIMEOUT) {
+   /* clear timeout flag (and stop timeout until next character is 
received) */
+   usart->US_CR |= US_CR_STTTO;
+
/* RX has been inactive for some time */
if (ci->wt.remaining <= (usart->US_RTOR & 0x)) {
/* waiting time is over; will stop the timer */
@@ -266,17 +286,26 @@
if (ci->wt.remaining == 0) {
/* let the FSM know that WT has expired */
card_emu_wtime_expired(ci->ch);
-   } else if (ci->wt.remaining <= ci->wt.total / 2 && 
!ci->wt.half_time_notified) {
-   /* let the FS know that half of the WT has expired */
-   card_emu_wtime_half_expired(ci->ch);
-   ci->wt.half_time_notified = true;
+   /* don't automatically re-start in this case */
+   } else {
+   bool half_time_just_reached = false;
+
+   if (ci->wt.remaining <= ci->wt.total / 2 && 
!ci->wt.half_time_notified) {
+   ci->wt.half_time_notified = true;
+   /* don't immediately call 
card_emu_wtime_half_expired(), as that
+* in turn may calls card_emu_uart_update_wt() 
which will change
+* the timeout but would be overridden 4 lines 
below */
+   half_time_just_reached = true;
+   }
+
+   /* update the counter no matter if we reached half time 
or not */
+   usart->US_RTOR = compute_next_timeout(ci);
+   /* restart the counter (if wt is 0, the timeout is not 
started) */
+   usart->US_CR |= US_CR_RETTO;
+
+   if (half_time_just_reached)
+   card_emu_wtime_half_expired(ci->ch);
}
-   /* if value exceeds the USART TO range, use the maximum for now 
*/
-   usart->US_RTOR = OSMO_MIN(ci->wt.remaining, 0x);
-   /* clear timeout flag (and stop timeout until next character is 
received) */
-   usart->US_CR |= US_CR_STTTO;
-   /* restart the counter (it wt is 0, the timeout is not started) 
*/
-   usart->US_CR |= US_CR_RETTO;
}
 }

@@ -336,8 +365,7 @@
/* FIXME: guard against race with interrupt handler */
ci->wt.remaining = ci->wt.total;
ci->wt.half_time_notified = false;
-   /* if value exceeds the USART TO range, use the maximum for now */
-   usart->US_RTOR = OSMO_MIN(ci->wt.remaining, 0x);
+   usart->US_RTOR = compute_next_timeout(ci);
/* 

Change in simtrace2[master]: card_emu: improve reset detection conditions

2021-04-05 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23641 )


Change subject: card_emu: improve reset detection conditions
..

card_emu: improve reset detection conditions

* enter ISO_S_WAIT_RST when RST is asserted
* enter ISO_S_WAIT_ATR only when we RST is released while in state 
ISO_S_WAIT_RST

Change-Id: I620333aa8d45561a8028b948955a27f667b58406
---
M firmware/libcommon/source/card_emu.c
1 file changed, 2 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/41/23641/1

diff --git a/firmware/libcommon/source/card_emu.c 
b/firmware/libcommon/source/card_emu.c
index c5e4cfa..216ffe3 100644
--- a/firmware/libcommon/source/card_emu.c
+++ b/firmware/libcommon/source/card_emu.c
@@ -1102,7 +1102,7 @@
case CARD_IO_RST:
if (active == 0 && ch->in_reset) {
TRACE_INFO("%u: RST released\r\n", ch->num);
-   if (ch->vcc_active && ch->clocked) {
+   if (ch->vcc_active && ch->clocked && ch->state == 
ISO_S_WAIT_RST) {
/* enable the TC/ETU counter once reset has 
been released */
tc_etu_enable(ch->tc_chan);
/* prepare to send the ATR */
@@ -1113,6 +1113,7 @@
TRACE_INFO("%u: RST asserted\r\n", ch->num);
card_handle_reset(ch);
chg_mask |= CEMU_STATUS_F_RESET_ACTIVE;
+   card_set_state(ch, ISO_S_WAIT_RST);
}
ch->in_reset = active;
break;

--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23641
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I620333aa8d45561a8028b948955a27f667b58406
Gerrit-Change-Number: 23641
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-CC: Jenkins Builder
Gerrit-MessageType: newchange


Change in simtrace2[master]: iso7816_fidi: Add iso7816_3_ prefix to symbols; fix terminology

2021-04-05 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23640 )


Change subject: iso7816_fidi: Add iso7816_3_ prefix to symbols; fix terminology
..

iso7816_fidi: Add iso7816_3_ prefix to symbols; fix terminology

Fi/Di are not the index into the table, but the contents of the table
as resolved by Fi_index / Di_index.  Let's clarify the terminology.

Change-Id: If364e08e7c9a3a9707e6d54b9267c6a7c088e415
---
M firmware/libcommon/include/iso7816_fidi.h
M firmware/libcommon/source/card_emu.c
M firmware/libcommon/source/iso7816_fidi.c
M firmware/libcommon/source/simtrace_iso7816.c
M firmware/libcommon/source/sniffer.c
5 files changed, 19 insertions(+), 18 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/40/23640/1

diff --git a/firmware/libcommon/include/iso7816_fidi.h 
b/firmware/libcommon/include/iso7816_fidi.h
index c56478b..19483b0 100644
--- a/firmware/libcommon/include/iso7816_fidi.h
+++ b/firmware/libcommon/include/iso7816_fidi.h
@@ -21,10 +21,10 @@
 #include 

 /* Table 7 of ISO 7816-3:2006 */
-extern const uint16_t fi_table[];
+extern const uint16_t iso7816_3_fi_table[16];

 /* Table 8 from ISO 7816-3:2006 */
-extern const uint8_t di_table[];
+extern const uint8_t iso7816_3_di_table[16];

-/* compute the F/D ratio based on Fi and Di values */
-int compute_fidi_ratio(uint8_t fi, uint8_t di);
+/* compute the F/D ratio based on F_index and D_index values */
+int iso7816_3_compute_fd_ratio(uint8_t f_index, uint8_t d_index);
diff --git a/firmware/libcommon/source/card_emu.c 
b/firmware/libcommon/source/card_emu.c
index 1193121..c5e4cfa 100644
--- a/firmware/libcommon/source/card_emu.c
+++ b/firmware/libcommon/source/card_emu.c
@@ -377,7 +377,7 @@
 {
int rc;

-   rc = compute_fidi_ratio(ch->F_index, ch->D_index);
+   rc = iso7816_3_compute_fd_ratio(ch->F_index, ch->D_index);
if (rc > 0 && rc < 0x400) {
TRACE_INFO("%u: computed F(%u)/D(%u) ratio: %d\r\n", ch->num,
   ch->F_index, ch->D_index, rc);
@@ -508,7 +508,7 @@
}
}
/* update waiting time (see ISO 7816-3 10.2) */
-   ch->waiting_time = ch->wi * 960 * fi_table[ch->F_index];
+   ch->waiting_time = ch->wi * 960 * 
iso7816_3_fi_table[ch->F_index];
tc_etu_set_wtime(ch->tc_chan, ch->waiting_time);
/* go to next state */
card_set_state(ch, ISO_S_WAIT_TPDU);
@@ -647,7 +647,7 @@
ch->F_index = byte >> 4;
ch->D_index = byte & 0xf;
TRACE_DEBUG("%u: found F=%u D=%u\r\n", ch->num,
-   fi_table[ch->F_index], di_table[ch->D_index]);
+   iso7816_3_fi_table[ch->F_index], 
iso7816_3_di_table[ch->D_index]);
/* FIXME: if F or D are 0, become unresponsive to signal error 
condition */
break;
case PTS_S_WAIT_RESP_PTS2:
diff --git a/firmware/libcommon/source/iso7816_fidi.c 
b/firmware/libcommon/source/iso7816_fidi.c
index 1c70467..033a325 100644
--- a/firmware/libcommon/source/iso7816_fidi.c
+++ b/firmware/libcommon/source/iso7816_fidi.c
@@ -23,38 +23,38 @@
 #include "iso7816_fidi.h"

 /* Table 7 of ISO 7816-3:2006 */
-const uint16_t fi_table[] = {
+const uint16_t iso7816_3_fi_table[] = {
372, 372, 558, 744, 1116, 1488, 1860, 0,
0, 512, 768, 1024, 1536, 2048, 0, 0
 };

 /* Table 8 from ISO 7816-3:2006 */
-const uint8_t di_table[] = {
+const uint8_t iso7816_3_di_table[] = {
0, 1, 2, 4, 8, 16, 32, 64,
12, 20, 2, 4, 8, 16, 32, 64,
 };

 /* compute the F/D ratio based on Fi and Di values */
-int compute_fidi_ratio(uint8_t fi, uint8_t di)
+int iso7816_3_compute_fd_ratio(uint8_t f_index, uint8_t d_index)
 {
uint16_t f, d;
int ret;

-   if (fi >= ARRAY_SIZE(fi_table) ||
-   di >= ARRAY_SIZE(di_table))
+   if (f_index >= ARRAY_SIZE(iso7816_3_fi_table) ||
+   d_index >= ARRAY_SIZE(iso7816_3_di_table))
return -EINVAL;

-   f = fi_table[fi];
+   f = iso7816_3_fi_table[f_index];
if (f == 0)
return -EINVAL;

-   d = di_table[di];
+   d = iso7816_3_di_table[d_index];
if (d == 0)
return -EINVAL;

/* See table 7 of ISO 7816-3: From 1000 on we divide by 1/d,
 * which equals a multiplication by d */
-   if (di < 8)
+   if (d_index < 8)
ret = f / d;
else
ret = f * d;
diff --git a/firmware/libcommon/source/simtrace_iso7816.c 
b/firmware/libcommon/source/simtrace_iso7816.c
index 8742696..27677a6 100644
--- a/firmware/libcommon/source/simtrace_iso7816.c
+++ b/firmware/libcommon/source/simtrace_iso7816.c
@@ -125,7 +125,7 @@

uint8_t fi = fidi >> 4;
uint8_t di = fidi & 0xf;
-   int ratio = compute_fidi_ratio(fi, 

Change in simtrace2[master]: card_emu: Clarify and differentiate F/Fi/F_index/Fi_index

2021-04-05 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23639 )


Change subject: card_emu: Clarify and differentiate F/Fi/F_index/Fi_index
..

card_emu: Clarify and differentiate F/Fi/F_index/Fi_index

The ISO7816 spec terms are well-defined, let's not abuse them. We used
to consider "Fi" as the "index into the table of F values", while the
spec actually considers Fi as the initial value for F.

Let's make sure we use the terms quite clearly:
* Fi and Di are the initial values for F and D
* F*_index and D*_index are the indexes into the ISO7816-3 Tables

Furthermore, let's track Fi separately from F, as e.g. the waiting
time definition only considers Fi as indicated in the ATR, despite
an actually different F value might have been negotiated via PTS
meanwhile.

Change-Id: Ieb2425e8380a81b79df7b2bd072902994e9c3ee7
---
M firmware/libcommon/include/simtrace_prot.h
M firmware/libcommon/source/card_emu.c
2 files changed, 52 insertions(+), 26 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/39/23639/1

diff --git a/firmware/libcommon/include/simtrace_prot.h 
b/firmware/libcommon/include/simtrace_prot.h
index eca844a..e550616 100644
--- a/firmware/libcommon/include/simtrace_prot.h
+++ b/firmware/libcommon/include/simtrace_prot.h
@@ -230,11 +230,17 @@
uint32_t flags;
/* phone-applied target voltage in mV */
uint16_t voltage_mv;
-   /* Fi/Di related information */
-   uint8_t fi;
-   uint8_t di;
-   uint8_t wi;
-   uint32_t waiting_time;
+   /* F/D related information. Not actual Fn/Dn values but indexes into 
tables! */
+   union {
+   uint8_t F_index;/* 
+ * (C) 2010-2021 by Harald Welte 
  * (C) 2018 by sysmocom -s.f.m.c. GmbH, Author: Kevin Redon 

  *
  * This program is free software; you can redistribute it and/or modify
@@ -154,19 +154,35 @@
bool in_reset;  /*< if card is in reset (true = RST low/asserted, false 
= RST high/ released) */
bool clocked;   /*< if clock is active ( true = active, false = 
inactive) */

-   /* timing parameters, from PTS */
-   uint8_t Fi;
-   uint8_t Di;
+   /* All below variables with _index suffix are indexes from 0..15 into 
Tables 7 + 8
+* of ISO7816-3. */
+
+   /*! Index to clock rate conversion integer Fi (ISO7816-3 Table 7).
+*  \note this represents the maximum value supported by the card, and 
can be indicated in TA1 */
+   uint8_t Fi_index;
+   /*! Current value of index to clock rate conversion integer F (ISO 
7816-3 Section 7.1). */
+   uint8_t F_index;
+
+   /*! Index to baud rate adjustment factor Di (ISO7816-3 Table 8).
+*  \note this represents the maximum value supported by the card, and 
can be indicated in TA1 */
+   uint8_t Di_index;
+   /*! Current value of index to baud rate adjustment factor D (ISO 7816-3 
Section 7.1). */
+   uint8_t D_index;
+
+   /*! Waiting Integer (ISO7816-3 Section 10.2).
+*  \note this value can be set in TA2 */
uint8_t wi;

+   /*! Waiting Time, in ETU (ISO7816-3 Section 8.1).
+*  \note this depends on Fi, Di, and WI if T=0 is used */
+   uint32_t waiting_time;  /* in etu */
+
uint8_t tc_chan;/* TC channel number */
uint8_t uart_chan;  /* UART channel */

uint8_t in_ep;  /* USB IN EP */
uint8_t irq_ep; /* USB IN EP */

-   uint32_t waiting_time;  /* in etu */
-
/* ATR state machine */
struct {
uint8_t idx;
@@ -361,16 +377,16 @@
 {
int rc;

-   rc = compute_fidi_ratio(ch->Fi, ch->Di);
+   rc = compute_fidi_ratio(ch->F_index, ch->D_index);
if (rc > 0 && rc < 0x400) {
-   TRACE_INFO("%u: computed Fi(%u) Di(%u) ratio: %d\r\n",
-   ch->num, ch->Fi, ch->Di, rc);
+   TRACE_INFO("%u: computed F(%u)/D(%u) ratio: %d\r\n", ch->num,
+  ch->F_index, ch->D_index, rc);
/* make sure UART uses new F/D ratio */
card_emu_uart_update_fidi(ch->uart_chan, rc);
/* notify ETU timer about this */
tc_etu_set_etu(ch->tc_chan, rc);
} else
-   TRACE_INFO("%u: computed FiDi ration %d unsupported\r\n",
+   TRACE_INFO("%u: computed F/D ratio %d unsupported\r\n",
   ch->num, rc);
 }

@@ -395,8 +411,10 @@
break;
case ISO_S_WAIT_ATR:
/* Reset to initial Fi / Di ratio */
-   ch->Fi = 1;
-   ch->Di = 1;
+   ch->Fi_index = ch->F_index = 1;
+   ch->Di_index = ch->D_index = 1;
+   ch->wi = ISO7816_3_DEFAULT_WI;
+   ch->waiting_time = ISO7816_3_INIT_WTIME;
emu_update_fidi(ch);
/* the ATR should only 

Change in simtrace2[master]: card_emu: Rename fi to Fi and di to Di

2021-04-05 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23638 )


Change subject: card_emu: Rename fi to Fi and di to Di
..

card_emu: Rename fi to Fi and di to Di

As we will soon introduce the distinction between Fi and F, we should
use uppercase letters, as lower-case 'f' is defined in ISO7816-3 as
the frequency, which is different from the upper-case 'F'.

Change-Id: Iaede621551520576e9b9af878fa46fbc88e59c2a
---
M firmware/libcommon/source/card_emu.c
1 file changed, 14 insertions(+), 15 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/38/23638/1

diff --git a/firmware/libcommon/source/card_emu.c 
b/firmware/libcommon/source/card_emu.c
index 5ab6cab..5feb157 100644
--- a/firmware/libcommon/source/card_emu.c
+++ b/firmware/libcommon/source/card_emu.c
@@ -155,8 +155,8 @@
bool clocked;   /*< if clock is active ( true = active, false = 
inactive) */

/* timing parameters, from PTS */
-   uint8_t fi;
-   uint8_t di;
+   uint8_t Fi;
+   uint8_t Di;
uint8_t wi;

uint8_t tc_chan;/* TC channel number */
@@ -361,10 +361,10 @@
 {
int rc;

-   rc = compute_fidi_ratio(ch->fi, ch->di);
+   rc = compute_fidi_ratio(ch->Fi, ch->Di);
if (rc > 0 && rc < 0x400) {
TRACE_INFO("%u: computed Fi(%u) Di(%u) ratio: %d\r\n",
-   ch->num, ch->fi, ch->di, rc);
+   ch->num, ch->Fi, ch->Di, rc);
/* make sure UART uses new F/D ratio */
card_emu_uart_update_fidi(ch->uart_chan, rc);
/* notify ETU timer about this */
@@ -395,8 +395,8 @@
break;
case ISO_S_WAIT_ATR:
/* Reset to initial Fi / Di ratio */
-   ch->fi = 1;
-   ch->di = 1;
+   ch->Fi = 1;
+   ch->Di = 1;
emu_update_fidi(ch);
/* the ATR should only be sent 400 to 40k clock cycles after 
the RESET.
 * we use the tc_etu mechanism to wait this time.
@@ -490,7 +490,7 @@
}
}
/* update waiting time (see ISO 7816-3 10.2) */
-   ch->waiting_time = ch->wi * 960 * ch->fi;
+   ch->waiting_time = ch->wi * 960 * ch->Fi;
tc_etu_set_wtime(ch->tc_chan, ch->waiting_time);
/* go to next state */
card_set_state(ch, ISO_S_WAIT_TPDU);
@@ -626,10 +626,9 @@
case PTS_S_WAIT_RESP_PTS1:
byte = ch->pts.resp[_PTS1];
/* This must be TA1 */
-   ch->fi = byte >> 4;
-   ch->di = byte & 0xf;
-   TRACE_DEBUG("%u: found Fi=%u Di=%u\r\n", ch->num,
-   ch->fi, ch->di);
+   ch->Fi = byte >> 4;
+   ch->Di = byte & 0xf;
+   TRACE_DEBUG("%u: found Fi=%u Di=%u\r\n", ch->num, ch->Fi, 
ch->Di);
break;
case PTS_S_WAIT_RESP_PTS2:
byte = ch->pts.resp[_PTS2];
@@ -1025,8 +1024,8 @@
if (ch->in_reset)
sts->flags |= CEMU_STATUS_F_RESET_ACTIVE;
/* FIXME: voltage + card insert */
-   sts->fi = ch->fi;
-   sts->di = ch->di;
+   sts->fi = ch->Fi;
+   sts->di = ch->Di;
sts->wi = ch->wi;
sts->waiting_time = ch->waiting_time;

@@ -1232,8 +1231,8 @@
ch->in_reset = in_reset;
ch->clocked = clocked;

-   ch->fi = 0;
-   ch->di = 1;
+   ch->Fi = 0;
+   ch->Di = 1;
ch->wi = ISO7816_3_DEFAULT_WI;

ch->tc_chan = tc_chan;

--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23638
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: Iaede621551520576e9b9af878fa46fbc88e59c2a
Gerrit-Change-Number: 23638
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-MessageType: newchange


Change in simtrace2[master]: card_emu: waiting_time is stored in etu, not clocks.

2021-04-05 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23637 )


Change subject: card_emu: waiting_time is stored in etu, not clocks.
..

card_emu: waiting_time is stored in etu, not clocks.

The comment didn't reflect the source.  I checked all users and
the code consistently stores the waiting time in units of 'etu'.

Change-Id: I2bc4a7c19cee5fb487ad639ee48ecaea706f6172
---
M firmware/libcommon/source/card_emu.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/37/23637/1

diff --git a/firmware/libcommon/source/card_emu.c 
b/firmware/libcommon/source/card_emu.c
index 269c7c6..5ab6cab 100644
--- a/firmware/libcommon/source/card_emu.c
+++ b/firmware/libcommon/source/card_emu.c
@@ -165,7 +165,7 @@
uint8_t in_ep;  /* USB IN EP */
uint8_t irq_ep; /* USB IN EP */

-   uint32_t waiting_time;  /* in clocks */
+   uint32_t waiting_time;  /* in etu */

/* ATR state machine */
struct {

--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23637
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I2bc4a7c19cee5fb487ad639ee48ecaea706f6172
Gerrit-Change-Number: 23637
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-MessageType: newchange


Change in simtrace2[master]: Revert "add library providing ISO 7816-3 utilities"

2021-04-05 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23636 )


Change subject: Revert "add library providing ISO 7816-3 utilities"
..

Revert "add library providing ISO 7816-3 utilities"

This reverts commit 4a29f64cbe12ca9fbddd66ae10b614388fef5e9b.

The code replicates to a large extent what is already present in iso7816_fidi.c
and I have serious doubts about the correctness of the computation in
its iso7816_3_calculate_wt() function.

Change-Id: I80dab4401d13306d573a6a35ce8729d2acc141e4
---
D firmware/libcommon/include/iso7816_3.h
D firmware/libcommon/source/iso7816_3.c
2 files changed, 0 insertions(+), 229 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/36/23636/1

diff --git a/firmware/libcommon/include/iso7816_3.h 
b/firmware/libcommon/include/iso7816_3.h
deleted file mode 100644
index e6c1b4f..000
--- a/firmware/libcommon/include/iso7816_3.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2019 sysmocom -s.f.m.c. GmbH, Author: Kevin Redon 

- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * 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 Street, Fifth Floor, Boston, MA  02110-1301, 
USA.
-*/
-
-/* this library provides utilities to handle the ISO-7816 part 3 communication 
aspects (e.g. related
- * to F and D) */
-
-#pragma once
-
-#include 
-#include 
-
-/*! default clock rate conversion integer Fd.
- *  ISO/IEC 7816-3:2006(E) section 8.1 */
-#define ISO7816_3_DEFAULT_FD 372
-
-/*! default baud rate adjustment factor Dd.
- *  ISO/IEC 7816-3:2006(E) section 8.1 */
-#define ISO7816_3_DEFAULT_DD 1
-
-/*! default clock rate conversion integer Fi.
- *  ISO/IEC 7816-3:2006(E) section 8.3
- *  \note non-default value is optionally specified in TA1 */
-#define ISO7816_3_DEFAULT_FI 372
-
-/*! default baud rate adjustment factor Di.
- *  ISO/IEC 7816-3:2006(E) section 8.3
- *  \note non-default value is optionally specified in TA1 */
-#define ISO7816_3_DEFAULT_DI 1
-
-/*! default maximum clock frequency, in Hz.
- *  ISO/IEC 7816-3:2006(E) section 8.3
- *  \note non-default value is optionally specified in TA1 */
-#define ISO7816_3_DEFAULT_FMAX 500UL
-
-/*! default Waiting Integer (WI) value for T=0.
- *  ISO/IEC 7816-3:2006(E) section 10.2
- *  \note non-default value is optionally specified in TC2 */
-#define ISO7816_3_DEFAULT_WI 10
-
-/*! default Waiting Time (WT) value, in ETU.
- *  ISO/IEC 7816-3:2006(E) section 8.1
- *  \note depends on Fi, Di, and WI if protocol T=0 is selected */
-#define ISO7816_3_DEFAULT_WT 9600
-
-extern const uint16_t iso7816_3_fi_table[];
-
-extern const uint32_t iso7816_3_fmax_table[];
-
-extern const uint8_t iso7816_3_di_table[];
-
-bool iso7816_3_valid_f(uint16_t f);
-
-bool iso7816_3_valid_d(uint8_t d);
-
-int32_t iso7816_3_calculate_wt(uint8_t wi, uint16_t fi, uint8_t di, uint16_t 
f, uint8_t d);
diff --git a/firmware/libcommon/source/iso7816_3.c 
b/firmware/libcommon/source/iso7816_3.c
deleted file mode 100644
index ccdff68..000
--- a/firmware/libcommon/source/iso7816_3.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (C) 2019 sysmocom -s.f.m.c. GmbH, Author: Kevin Redon 

- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * 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 Street, Fifth Floor, Boston, MA  02110-1301, 
USA.
-*/
-#include 
-#include 
-
-#include "utils.h"
-#include "iso7816_3.h"
-
-/*! Table of clock rate conversion integer F indexed by Fi.
- *  \note Fi is indicated in TA1, but the same table is used for F and Fn 
during PPS
- *  ISO/IEC 7816-3:2006(E) table 7 */
-const uint16_t iso7816_3_fi_table[16] = {
-   372, 372, 558, 744, 1116, 1488, 1860, 0,
-   0, 512, 768, 1024, 1536, 2048, 0, 0
-};
-
-/*! Table of maximum clock frequency f_max in Hz 

Change in simtrace2[master]: Revert "add ISO 7816-3 library to remsim project"

2021-04-05 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23635 )


Change subject: Revert "add ISO 7816-3 library to remsim project"
..

Revert "add ISO 7816-3 library to remsim project"

This reverts commit 4a58c08d671adc928fea9dc12018c26818f24d4e.

The code replicates to a large extent what is already present in iso7816_fidi.c
and I have serious doubts about the correctness of the computation in
its iso7816_3_calculate_wt() function.

Change-Id: I3f26da4e9aa8d7b0f4b4b7992269cf365a643ec7
---
M firmware/apps/cardem/Makefile
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/35/23635/1

diff --git a/firmware/apps/cardem/Makefile b/firmware/apps/cardem/Makefile
index d5f68a5..75c43e8 100644
--- a/firmware/apps/cardem/Makefile
+++ b/firmware/apps/cardem/Makefile
@@ -1,3 +1,3 @@
 C_FILES += $(C_LIBUSB_RT)

-C_FILES += card_emu.c cciddriver.c iso7816_3.c iso7816_4.c iso7816_fidi.c 
mitm.c mode_cardemu.c mode_ccid.c simtrace_iso7816.c sniffer.c tc_etu.c usb.c
+C_FILES += card_emu.c cciddriver.c iso7816_4.c iso7816_fidi.c mitm.c 
mode_cardemu.c mode_ccid.c simtrace_iso7816.c sniffer.c tc_etu.c usb.c

--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23635
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I3f26da4e9aa8d7b0f4b4b7992269cf365a643ec7
Gerrit-Change-Number: 23635
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-MessageType: newchange


Change in simtrace2[master]: simtrace2-cardem-pcsc: Make it work again

2021-04-05 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23634 )


Change subject: simtrace2-cardem-pcsc: Make it work again
..

simtrace2-cardem-pcsc: Make it work again

* support Interrupt STATUS notifications
* use osmocom libusb abstraction
* use asynchronous URBs for interrupt + bulk

Change-Id: Ib04798572295f25477719124530b6584780c5b75
---
M host/src/simtrace2-cardem-pcsc.c
1 file changed, 159 insertions(+), 23 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/34/23634/1

diff --git a/host/src/simtrace2-cardem-pcsc.c b/host/src/simtrace2-cardem-pcsc.c
index f11330c..543780f 100644
--- a/host/src/simtrace2-cardem-pcsc.c
+++ b/host/src/simtrace2-cardem-pcsc.c
@@ -47,11 +47,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 

 #define ATR_MAX_LEN 33

+#define LOGCI(ci, lvl, fmt, args ...) printf(fmt, ## args)

 /* reasonable ATR offering all protocols and voltages
  * smartphones might not care, but other readers do
@@ -180,6 +182,9 @@
case SIMTRACE_MSGT_DO_CEMU_RX_DATA:
rc = process_do_rx_da(ci, buf, len);
break;
+   case SIMTRACE_MSGT_BD_CEMU_CONFIG:
+   /* firmware confirms configuration change; ignore */
+   break;
default:
printf("unknown simtrace msg type 0x%02x\n", sh->msg_type);
rc = -1;
@@ -189,6 +194,144 @@
return rc;
 }

+/*! \brief Process a STATUS message on IRQ endpoint from the SIMtrace2 */
+static int process_irq_status(struct osmo_st2_cardem_inst *ci, const uint8_t 
*buf, int len)
+{
+   const struct cardemu_usb_msg_status *status = (struct 
cardemu_usb_msg_status *) buf;
+
+   LOGCI(ci, LOGL_INFO, "SIMtrace IRQ STATUS: flags=0x%x, fi=%u, di=%u, 
wi=%u wtime=%u\n",
+   status->flags, status->fi, status->di, status->wi,
+   status->waiting_time);
+
+   return 0;
+}
+
+static int process_usb_msg_irq(struct osmo_st2_cardem_inst *ci, const uint8_t 
*buf, unsigned int len)
+{
+   struct simtrace_msg_hdr *sh = (struct simtrace_msg_hdr *)buf;
+   int rc;
+
+   LOGCI(ci, LOGL_INFO, "SIMtrace IRQ %s\n", osmo_hexdump(buf, len));
+
+   buf += sizeof(*sh);
+
+   switch (sh->msg_type) {
+   case SIMTRACE_MSGT_BD_CEMU_STATUS:
+   rc = process_irq_status(ci, buf, len);
+   break;
+   default:
+   LOGCI(ci, LOGL_ERROR, "unknown simtrace msg type 0x%02x\n", 
sh->msg_type);
+   rc = -1;
+   break;
+   }
+
+   return rc;
+}
+
+static void usb_in_xfer_cb(struct libusb_transfer *xfer)
+{
+   struct osmo_st2_cardem_inst *ci = xfer->user_data;
+   int rc;
+
+   switch (xfer->status) {
+   case LIBUSB_TRANSFER_COMPLETED:
+   /* hand the message up the stack */
+   process_usb_msg(ci, xfer->buffer, xfer->actual_length);
+   break;
+   case LIBUSB_TRANSFER_NO_DEVICE:
+   LOGCI(ci, LOGL_FATAL, "USB device disappeared\n");
+   exit(1);
+   break;
+   default:
+   LOGCI(ci, LOGL_FATAL, "USB IN transfer failed, status=%u\n", 
xfer->status);
+   exit(1);
+   break;
+   }
+
+   /* re-submit the IN transfer */
+   rc = libusb_submit_transfer(xfer);
+   OSMO_ASSERT(rc == 0);
+}
+
+
+static void allocate_and_submit_in(struct osmo_st2_cardem_inst *ci)
+{
+   struct osmo_st2_transport *transp = ci->slot->transp;
+   struct libusb_transfer *xfer;
+   int rc;
+
+   xfer = libusb_alloc_transfer(0);
+   OSMO_ASSERT(xfer);
+   xfer->dev_handle = transp->usb_devh;
+   xfer->flags = 0;
+   xfer->type = LIBUSB_TRANSFER_TYPE_BULK;
+   xfer->endpoint = transp->usb_ep.in;
+   xfer->timeout = 0;
+   xfer->user_data = ci;
+   xfer->length = 16*256;
+
+   xfer->buffer = libusb_dev_mem_alloc(xfer->dev_handle, xfer->length);
+   OSMO_ASSERT(xfer->buffer);
+   xfer->callback = usb_in_xfer_cb;
+
+   /* submit the IN transfer */
+   rc = libusb_submit_transfer(xfer);
+   OSMO_ASSERT(rc == 0);
+}
+
+
+static void usb_irq_xfer_cb(struct libusb_transfer *xfer)
+{
+   struct osmo_st2_cardem_inst *ci = xfer->user_data;
+   int rc;
+
+   switch (xfer->status) {
+   case LIBUSB_TRANSFER_COMPLETED:
+   process_usb_msg_irq(ci, xfer->buffer, xfer->actual_length);
+   break;
+   case LIBUSB_TRANSFER_NO_DEVICE:
+   LOGCI(ci, LOGL_FATAL, "USB device disappeared\n");
+   exit(1);
+   break;
+   default:
+   LOGCI(ci, LOGL_FATAL, "USB IN transfer failed, status=%u\n", 
xfer->status);
+   exit(1);
+   break;
+   }
+
+   /* re-submit the IN transfer */
+   rc = libusb_submit_transfer(xfer);
+   OSMO_ASSERT(rc == 0);

Change in simtrace2[master]: card_emu: use edge-triggered VCC ADC logic

2021-04-05 Thread laforge
Hello Jenkins Builder, tsaitgaist,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/simtrace2/+/23616

to look at the new patch set (#3).

Change subject: card_emu: use edge-triggered VCC ADC logic
..

card_emu: use edge-triggered VCC ADC logic

Before this patch, we used to st ci->vcc_active depending on the
instantaneous ADC reading of VCC.  Is it > .5v, we claim VCC is active,
and if it's below, VCC is inactive.

With this patch we move to an edge triggered approach: Only change
ci->vcc_active if the previous reading was different from the current
reading.

FIXME: why?

Change-Id: I71b703162219484e43638f1f2f692e9dd554ef55
---
M firmware/libcommon/source/mode_cardemu.c
1 file changed, 8 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/16/23616/3
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23616
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I71b703162219484e43638f1f2f692e9dd554ef55
Gerrit-Change-Number: 23616
Gerrit-PatchSet: 3
Gerrit-Owner: laforge 
Gerrit-Assignee: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: tsaitgaist 
Gerrit-MessageType: newpatchset


Change in simtrace2[master]: card_emu: Use USART timeout for waiting time

2021-04-05 Thread laforge
Hello Jenkins Builder, tsaitgaist,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/simtrace2/+/23620

to look at the new patch set (#3).

Change subject: card_emu: Use USART timeout for waiting time
..

card_emu: Use USART timeout for waiting time

Instead of using the timer/counter peripheral to handle the waiting time
and corresponding timeout, the USART peripheral internal timeout
mechanism is used.

This is particularly important for the SIMtrace board since there
(contrary to other boards) the I/O signal is not wired to a TIO pin
of the timer/counter block, and hence Rx/Tx data cannot reset that
timer/counter.

As a result of this migration, cardem is now supported not only on
owhw + qmod, but also on the simtrace board.

The guts of this change have been lifted out of Change-Id
Ibcb2c8cace9137695adf5fb3de43566f7cfb93b5 by Kevin Redon, which was
unfortunately touching various different topics at the same time and
hence was split up. Some improvements are the introduction of the
ENABLE_TX_TIMER_ONLY mode, which avoids the USART interrupt handler
getting hammered with TXRDY between release of RST and start of the ATR.

Change-Id: Ibcb2c8cace9137695adf5fb3de43566f7cfb93b5
---
M firmware/apps/cardem/Makefile
M firmware/apps/trace/Makefile
M firmware/apps/triple_play/Makefile
M firmware/libcommon/include/card_emu.h
M firmware/libcommon/source/card_emu.c
M firmware/libcommon/source/mode_cardemu.c
6 files changed, 132 insertions(+), 32 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/20/23620/3
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23620
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: Ibcb2c8cace9137695adf5fb3de43566f7cfb93b5
Gerrit-Change-Number: 23620
Gerrit-PatchSet: 3
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: tsaitgaist 
Gerrit-MessageType: newpatchset


Change in simtrace2[master]: make sim switch board specific

2021-04-05 Thread laforge
Hello Jenkins Builder, tsaitgaist,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/simtrace2/+/23618

to look at the new patch set (#3).

Change subject: make sim switch board specific
..

make sim switch board specific

the simtrace board uses a bus switch not used on qmod and owhw to
switch the SIM between physical and virtual

Change-Id: Ieaf2ed4761fc3e04f33f9aac5c04a768c9a6f71e
---
M firmware/libboard/common/include/sim_switch.h
R firmware/libboard/owhw/source/sim_switch.c
C firmware/libboard/qmod/source/sim_switch.c
A firmware/libboard/simtrace/source/sim_switch.c
4 files changed, 62 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/18/23618/3
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23618
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: Ieaf2ed4761fc3e04f33f9aac5c04a768c9a6f71e
Gerrit-Change-Number: 23618
Gerrit-PatchSet: 3
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: tsaitgaist 
Gerrit-MessageType: newpatchset


Change in pysim[master]: Set uSIM to 'type approval operations' in EF['AD']

2021-04-05 Thread Robert Falkenberg
Robert Falkenberg has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/23632 )

Change subject: Set uSIM to 'type approval operations' in EF['AD']
..


Patch Set 5:

(1 comment)

Thanks_for_the_feedback

https://gerrit.osmocom.org/c/pysim/+/23632/1//COMMIT_MSG
Commit Message:

https://gerrit.osmocom.org/c/pysim/+/23632/1//COMMIT_MSG@7
PS1, Line 7: S
> Do you think it is advisable for all SIM cards of all users to be programmed 
> for 'type approval' at  […]
Good question. The default value depends on the targeted group that uses this 
software. I was thinking of research and development here. The explicit request 
is the best option - full agreement. However, I wanted to be minimally invasive 
in my initial contributions and I didn't want to make offensive changes to the 
method signatures with possibly unexpected side effects.
(Apparently this single line change was already too much either. 
https://osmocom.org/issues/4383 Sorry for that.)

I'm happy to prepare a version with parameters, soon.



--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23632
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie9040c6b127c268878a0845ed73d0918ec6bbb08
Gerrit-Change-Number: 23632
Gerrit-PatchSet: 5
Gerrit-Owner: Robert Falkenberg 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Mon, 05 Apr 2021 19:36:55 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge 
Gerrit-MessageType: comment


Change in pysim[master]: Set uSIM to 'type approval operations' in EF['AD']

2021-04-05 Thread Robert Falkenberg
Hello Jenkins Builder, laforge,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/pysim/+/23632

to look at the new patch set (#5).

Change subject: Set uSIM to 'type approval operations' in EF['AD']
..

Set uSIM to 'type approval operations' in EF['AD']

The ``EF_AD`` field contains administrative data (AD).
It consists of four bytes ``B1``, ``B2``, ``B3``, ``B4``,
and optionally further bytes for future use.

Current implementation only sets the MNC field appropriately
(located in `B4`) and sets all other bits/bytes to 0.

However, `B1` defines the *UE operation mode* as listed below.
For type approval operations (such as testing with a test uSIM),
this value should be set to `0x80` rather than `0x00`(= normal operation).
This may unlock some UE capabilities that are restricted in
normal operation mode.

Excerpt from [ETSI TS 131 102, 
4.2.18](https://www.etsi.org/deliver/etsi_ts/131100_131199/131102/04.15.00_60/ts_131102v041500p.pdf):

```
B1 - UE operation mode:
Coding:
Initial value
- '00' normal operation.
- '80' type approval operations.
- '01' normal operation + specific facilities.
- '81' type approval operations + specific facilities.
- '02' maintenance (off line).
- '04' cell test operation.

B2 - Additional information:
Coding:
Reserved for future use

B3 - Additional information:
Coding:
- B3.b1: OFM setting (Ciphering)
- B3.others: Reserved for future use

B4 - Length of MNC in the IMSI:
Coding:
- B4.b4..B4.b1: length:  '0010' (= 2) or '0011' (=3)
- B4.others: Reserved for future use
```

**Legend:** Byte X, bit Y: BX.bY

Further reading: https://nickvsnetworking.com/usim-basics/


Change-Id: Ie9040c6b127c268878a0845ed73d0918ec6bbb08
---
M pySim/cards.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/32/23632/5
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23632
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie9040c6b127c268878a0845ed73d0918ec6bbb08
Gerrit-Change-Number: 23632
Gerrit-PatchSet: 5
Gerrit-Owner: Robert Falkenberg 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in pysim[master]: Use zero padding for EF['ACC'] field

2021-04-05 Thread Robert Falkenberg
Robert Falkenberg has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/23632 )

Change subject: Use zero padding for EF['ACC'] field
..


Patch Set 4:

Sorry, pushed wrong branch.


--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23632
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie9040c6b127c268878a0845ed73d0918ec6bbb08
Gerrit-Change-Number: 23632
Gerrit-PatchSet: 4
Gerrit-Owner: Robert Falkenberg 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Mon, 05 Apr 2021 19:11:55 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in pysim[master]: Use zero padding for EF['ACC'] field

2021-04-05 Thread Robert Falkenberg
Robert Falkenberg has restored this change. ( 
https://gerrit.osmocom.org/c/pysim/+/23632 )

Change subject: Use zero padding for EF['ACC'] field
..


Restored
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23632
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie9040c6b127c268878a0845ed73d0918ec6bbb08
Gerrit-Change-Number: 23632
Gerrit-PatchSet: 4
Gerrit-Owner: Robert Falkenberg 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: restore


Change in pysim[master]: Use zero padding for EF['ACC'] field

2021-04-05 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/23631 )

Change subject: Use zero padding for EF['ACC'] field
..


Patch Set 2:

> Patch Set 2:
>
> What happened? Jenkins doesen't like it anymore. Where can I find the reason?

First time it was due to some connection problem during the build verification:

Could not install packages due to an EnvironmentError: 404 Client Error: Not 
Found for url: https://pypi.org/simple/pkg-resources/

I tried to re-trigger the build, but now it fails because something has changed 
on the test SIM card(s). I guess we're experiencing this problem 
https://osmocom.org/issues/4383 again.


--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23631
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I1b8dc01a6c48adad1ed8158de59b12519ed688e9
Gerrit-Change-Number: 23631
Gerrit-PatchSet: 2
Gerrit-Owner: Robert Falkenberg 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-CC: fixeria 
Gerrit-Comment-Date: Mon, 05 Apr 2021 17:20:34 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in pysim[master]: Py2 -> Py3: do not inherit classes from object

2021-04-05 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/23633 )


Change subject: Py2 -> Py3: do not inherit classes from object
..

Py2 -> Py3: do not inherit classes from object

https://stackoverflow.com/questions/4015417/why-do-python-classes-inherit-object/45062077

Change-Id: I15003ba591510d68f3235f71526ad5d8a456088e
---
M pySim/card_data.py
M pySim/cards.py
M pySim/commands.py
M pySim/filesystem.py
M pySim/transport/__init__.py
M pySim/transport/calypso.py
6 files changed, 10 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/33/23633/1

diff --git a/pySim/card_data.py b/pySim/card_data.py
index ebc63a6..6c162e8 100644
--- a/pySim/card_data.py
+++ b/pySim/card_data.py
@@ -24,7 +24,7 @@

 card_data_provider = []
 
-class CardData(object):
+class CardData:

VALID_FIELD_NAMES = ['ICCID', 'ADM1', 'IMSI', 'PIN1', 'PIN2', 'PUK1', 
'PUK2']

diff --git a/pySim/cards.py b/pySim/cards.py
index 5eb2884..a9ad7ff 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -29,7 +29,7 @@
 from smartcard.util import toBytes
 from pytlv.TLV import *

-class Card(object):
+class Card:

def __init__(self, scc):
self._scc = scc
diff --git a/pySim/commands.py b/pySim/commands.py
index 7919099..5f60280 100644
--- a/pySim/commands.py
+++ b/pySim/commands.py
@@ -24,7 +24,7 @@
 from pySim.utils import rpad, b2h, sw_match
 from pySim.exceptions import SwMatchError

-class SimCardCommands(object):
+class SimCardCommands:
def __init__(self, transport):
self._tp = transport
self._cla_byte = "a0"
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index 3eea2f4..8324ab1 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -36,7 +36,7 @@
 from pySim.utils import sw_match, h2b, b2h, is_hex
 from pySim.exceptions import *

-class CardFile(object):
+class CardFile:
 """Base class for all objects in the smart card filesystem.
 Serve as a common ancestor to all other file types; rarely used directly.
 """
@@ -799,7 +799,7 @@



-class RuntimeState(object):
+class RuntimeState:
 """Represent the runtime state of a session with a card."""
 def __init__(self, card, profile:'CardProfile'):
 """
@@ -1050,7 +1050,7 @@



-class FileData(object):
+class FileData:
 """Represent the runtime, on-card data."""
 def __init__(self, fdesc):
 self.desc = fdesc
@@ -1076,7 +1076,7 @@
 return (class_str, descr)
 return None

-class CardApplication(object):
+class CardApplication:
 """A card application is represented by an ADF (with contained hierarchy) 
and optionally
some SW definitions."""
 def __init__(self, name, adf:Optional[CardADF]=None, aid:str=None, 
sw:dict=None):
@@ -1109,7 +1109,7 @@
 """
 return interpret_sw(self.sw, sw)

-class CardProfile(object):
+class CardProfile:
 """A Card Profile describes a card, it's filessystem hierarchy, an 
[initial] list of
applications as well as profile-specific SW and shell commands.  Every 
card has
one card profile, but there may be multiple applications within that 
profile."""
diff --git a/pySim/transport/__init__.py b/pySim/transport/__init__.py
index f946af8..d8579a3 100644
--- a/pySim/transport/__init__.py
+++ b/pySim/transport/__init__.py
@@ -23,7 +23,7 @@
 # along with this program.  If not, see .
 #

-class LinkBase(object):
+class LinkBase:
"""Base class for link/transport to card."""

def wait_for_card(self, timeout:int=None, newcardonly:bool=False):
diff --git a/pySim/transport/calypso.py b/pySim/transport/calypso.py
index 467d5ee..49d649d 100644
--- a/pySim/transport/calypso.py
+++ b/pySim/transport/calypso.py
@@ -25,7 +25,7 @@
 from pySim.exceptions import *
 from pySim.utils import h2b, b2h

-class L1CTLMessage(object):
+class L1CTLMessage:

# Every (encoded) L1CTL message has the following structure:
#  - msg_length (2 bytes, net order)

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23633
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I15003ba591510d68f3235f71526ad5d8a456088e
Gerrit-Change-Number: 23633
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-MessageType: newchange


Change in pysim[master]: Use zero padding for EF['ACC'] field

2021-04-05 Thread Robert Falkenberg
Robert Falkenberg has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/23631 )

Change subject: Use zero padding for EF['ACC'] field
..


Patch Set 2:

What happened? Jenkins doesen't like it anymore. Where can I find the reason?


--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23631
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I1b8dc01a6c48adad1ed8158de59b12519ed688e9
Gerrit-Change-Number: 23631
Gerrit-PatchSet: 2
Gerrit-Owner: Robert Falkenberg 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-CC: fixeria 
Gerrit-Comment-Date: Mon, 05 Apr 2021 16:57:07 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in pysim[master]: Use zero padding for EF['ACC'] field

2021-04-05 Thread Robert Falkenberg
Robert Falkenberg has abandoned this change. ( 
https://gerrit.osmocom.org/c/pysim/+/23632 )

Change subject: Use zero padding for EF['ACC'] field
..


Abandoned

Duplicate
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23632
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie9040c6b127c268878a0845ed73d0918ec6bbb08
Gerrit-Change-Number: 23632
Gerrit-PatchSet: 4
Gerrit-Owner: Robert Falkenberg 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: abandon


Change in pysim[master]: Use zero padding for EF['ACC'] field

2021-04-05 Thread Robert Falkenberg
Hello Jenkins Builder, laforge,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/pysim/+/23631

to look at the new patch set (#2).

Change subject: Use zero padding for EF['ACC'] field
..

Use zero padding for EF['ACC'] field

The ``EF_ACC`` field defines the access control class (ACC)
for a subscriber.

Without this patch, the implementation adds padding 1 towards
the most significant bits if the input is shorter than 2 bytes.

However, it should be padded with 0, otherwise additional ACCs
are allocated to the subscriber. (Probably only a single bit
shall be set to 1)

Excerpt from [ETSI TS 131 102, 
4.2.15](https://www.etsi.org/deliver/etsi_ts/131100_131199/131102/04.15.00_60/ts_131102v041500p.pdf):

```
EF_ACC: Two bytes: B1, B2

B1.b8...B1.b4: high priority users (class 15...11)
B1.b3: always 0
B1.b2...B1.b2 and B2.b7...B2.b0: normal priority users (class 9...0) - to be 
evenly distributed across subscribers
```

**Legend:** Byte X, bit Y: BX.bY


Change-Id: I1b8dc01a6c48adad1ed8158de59b12519ed688e9
---
M pySim/cards.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/31/23631/2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23631
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I1b8dc01a6c48adad1ed8158de59b12519ed688e9
Gerrit-Change-Number: 23631
Gerrit-PatchSet: 2
Gerrit-Owner: Robert Falkenberg 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-CC: fixeria 
Gerrit-MessageType: newpatchset


Change in pysim[master]: Use zero padding for EF['ACC'] field

2021-04-05 Thread Robert Falkenberg
Hello Jenkins Builder, laforge,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/pysim/+/23632

to look at the new patch set (#4).

Change subject: Use zero padding for EF['ACC'] field
..

Use zero padding for EF['ACC'] field

The ``EF_ACC`` field defines the access control class (ACC)
for a subscriber.

Without this patch, the implementation adds padding 1 towards
the most significant bits if the input is shorter than 2 bytes.

However, it should be padded with 0, otherwise additional ACCs
are allocated to the subscriber. (Probably only a single bit
shall be set to 1)

Excerpt from [ETSI TS 131 102, 
4.2.15](https://www.etsi.org/deliver/etsi_ts/131100_131199/131102/04.15.00_60/ts_131102v041500p.pdf):

```
EF_ACC: Two bytes: B1, B2

B1.b8...B1.b4: high priority users (class 15...11)
B1.b3: always 0
B1.b2...B1.b2 and B2.b7...B2.b0: normal priority users (class 9...0) - to be 
evenly distributed across subscribers
```

**Legend:** Byte X, bit Y: BX.bY


Change-Id: Ie9040c6b127c268878a0845ed73d0918ec6bbb08
---
M pySim/cards.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/32/23632/4
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23632
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie9040c6b127c268878a0845ed73d0918ec6bbb08
Gerrit-Change-Number: 23632
Gerrit-PatchSet: 4
Gerrit-Owner: Robert Falkenberg 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in pysim[master]: Use zero padding for EF['ACC'] field

2021-04-05 Thread Robert Falkenberg
Hello Jenkins Builder, laforge,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/pysim/+/23632

to look at the new patch set (#3).

Change subject: Use zero padding for EF['ACC'] field
..

Use zero padding for EF['ACC'] field

The ``EF_ACC`` field defines the access control class (ACC) for a subscriber.

Without this patch, the implementation adds padding 1 towards the most 
significant bits if the input is shorter than 2 bytes.

However, it should be padded with 0, otherwise additional ACCs are allocated to 
the subscriber. (Probably only a single bit shall be set to 1)

Excerpt from [ETSI TS 131 102, 
4.2.15](https://www.etsi.org/deliver/etsi_ts/131100_131199/131102/04.15.00_60/ts_131102v041500p.pdf):

```
EF_ACC: Two bytes: B1, B2

B1.b8...B1.b4: high priority users (class 15...11)
B1.b3: always 0
B1.b2...B1.b2 and B2.b7...B2.b0: normal priority users (class 9...0) - to be 
evenly distributed across subscribers
```

**Legend:** Byte X, bit Y: BX.bY


Change-Id: Ie9040c6b127c268878a0845ed73d0918ec6bbb08
---
M pySim/cards.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/32/23632/3
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23632
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie9040c6b127c268878a0845ed73d0918ec6bbb08
Gerrit-Change-Number: 23632
Gerrit-PatchSet: 3
Gerrit-Owner: Robert Falkenberg 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in pysim[master]: Use zero padding for EF['ACC'] field

2021-04-05 Thread Robert Falkenberg
Hello Jenkins Builder, laforge,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/pysim/+/23632

to look at the new patch set (#2).

Change subject: Use zero padding for EF['ACC'] field
..

Use zero padding for EF['ACC'] field

Change-Id: Ie9040c6b127c268878a0845ed73d0918ec6bbb08
---
M pySim/cards.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/32/23632/2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23632
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie9040c6b127c268878a0845ed73d0918ec6bbb08
Gerrit-Change-Number: 23632
Gerrit-PatchSet: 2
Gerrit-Owner: Robert Falkenberg 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in pysim[master]: Use zero padding for EF['ACC'] field

2021-04-05 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/23631 )

Change subject: Use zero padding for EF['ACC'] field
..


Patch Set 1:

> Patch Set 1:
>
> The ``EF_ACC`` field defines the access control class (ACC) for a subscriber.
>
> Current implementation adds padding 1 towards the most significant bits if 
> the input is shorter than 2 bytes.
>
> However, it should be padded with 0, otherwise additional ACCs are allocated 
> to the subscriber. (Probably only a single bit shall be set to 1)
>
> Excerpt from [ETSI TS 131 102, 
> 4.2.15](https://www.etsi.org/deliver/etsi_ts/131100_131199/131102/04.15.00_60/ts_131102v041500p.pdf):
>
> ```
> EF_ACC: Two bytes: B1, B2
>
> B1.b8...B1.b4: high priority users (class 15...11)
> B1.b3: always 0
> B1.b2...B1.b2 and B2.b7...B2.b0: normal priority users (class 9...0) - to be 
> evenly distributed across subscribers
> ```
>
> **Legend:** Byte X, bit Y: BX.bY

This description should be in the commit message.


--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23631
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I1b8dc01a6c48adad1ed8158de59b12519ed688e9
Gerrit-Change-Number: 23631
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Falkenberg 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-CC: fixeria 
Gerrit-Comment-Date: Mon, 05 Apr 2021 15:39:30 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in simtrace2[master]: cardem: Use USART timeout for waiting time

2021-04-05 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/simtrace2/+/23620 )

Change subject: cardem: Use USART timeout for waiting time
..


Patch Set 2:

(5 comments)

https://gerrit.osmocom.org/c/simtrace2/+/23620/2//COMMIT_MSG
Commit Message:

https://gerrit.osmocom.org/c/simtrace2/+/23620/2//COMMIT_MSG@1
PS2, Line 1: Parent: d6005fcd (make sim switch board specific)
actaully, the clock signal is connected (TCLK1).  It's the I/O signal which is 
not connected to any TIO{A,B}1 so we cannot determine when exactly a bit starts 
or ends on the I/O line.


https://gerrit.osmocom.org/c/simtrace2/+/23620/2/firmware/apps/cardem/main.c
File firmware/apps/cardem/main.c:

https://gerrit.osmocom.org/c/simtrace2/+/23620/2/firmware/apps/cardem/main.c@a168
PS2, Line 168: #if 0
unrelated change.


https://gerrit.osmocom.org/c/simtrace2/+/23620/2/firmware/libcommon/include/simtrace_prot.h
File firmware/libcommon/include/simtrace_prot.h:

https://gerrit.osmocom.org/c/simtrace2/+/23620/2/firmware/libcommon/include/simtrace_prot.h@236
PS2, Line 236:  uint3
waiting_time to wt rename should be one purely cosmetic patch (if at all)


https://gerrit.osmocom.org/c/simtrace2/+/23620/2/firmware/libcommon/source/card_emu.c
File firmware/libcommon/source/card_emu.c:

https://gerrit.osmocom.org/c/simtrace2/+/23620/2/firmware/libcommon/source/card_emu.c@424
PS2, Line 424:  if (ISO_S_WAIT_POWER == new_state) {
the UART I/O related changes are independent of the USART timer changes.

To be honest, I don't see how those do anything at all.  The UART I/O lines are 
all routed to the peripheral function via the PIO_PER (peripheral enable 
register).  Unless you disable the peripheral via PIO_PDR, the changes to the 
GPIO output data via PIO_SODR / PIO_CODR done here  are no-ops as the alternate 
function always overrides any configured output levels.  How was this 
tested/validated?  Maybe there are some hardware bugs I'm unaware of?


https://gerrit.osmocom.org/c/simtrace2/+/23620/1/firmware/libcommon/source/mode_cardemu.c
File firmware/libcommon/source/mode_cardemu.c:

https://gerrit.osmocom.org/c/simtrace2/+/23620/1/firmware/libcommon/source/mode_cardemu.c@217
PS1, Line 217: ("%
> not sure we want to make this a non-fatal error. Clearly this should never 
> happen...
Done



--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23620
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: Ibcb2c8cace9137695adf5fb3de43566f7cfb93b5
Gerrit-Change-Number: 23620
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: tsaitgaist 
Gerrit-Comment-Date: Mon, 05 Apr 2021 12:25:41 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge 
Gerrit-MessageType: comment


Change in pysim[master]: Set uSIM to 'type approval operations' in EF['AD']

2021-04-05 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/23632 )

Change subject: Set uSIM to 'type approval operations' in EF['AD']
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/c/pysim/+/23632/1//COMMIT_MSG
Commit Message:

https://gerrit.osmocom.org/c/pysim/+/23632/1//COMMIT_MSG@7
PS1, Line 7: S
Do you think it is advisable for all SIM cards of all users to be programmed 
for 'type approval' at all times?  I think that is a flag which should only be 
set upon explicit request of the user, under certain circumstances.



--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23632
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie9040c6b127c268878a0845ed73d0918ec6bbb08
Gerrit-Change-Number: 23632
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Falkenberg 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Mon, 05 Apr 2021 11:50:32 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in pysim[master]: Use zero padding for EF['ACC'] field

2021-04-05 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/23631 )

Change subject: Use zero padding for EF['ACC'] field
..


Patch Set 1:

(1 comment)

thanks! let's remove the old line rather than commenting it out and get it 
merged.

https://gerrit.osmocom.org/c/pysim/+/23631/1/pySim/cards.py
File pySim/cards.py:

https://gerrit.osmocom.org/c/pysim/+/23631/1/pySim/cards.py@79
PS1, Line 79:   #
let's remove that old line of code.  There's no need to keep it around, the 
history is stored in git.



--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23631
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I1b8dc01a6c48adad1ed8158de59b12519ed688e9
Gerrit-Change-Number: 23631
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Falkenberg 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Mon, 05 Apr 2021 11:49:31 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in pysim[master]: cards.py: unify card programming

2021-04-05 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/15501 )

Change subject: cards.py: unify card programming
..


Patch Set 5:

ping? should we still get this mergd at some point?


--
To view, visit https://gerrit.osmocom.org/c/pysim/+/15501
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ib757b1433c075c635fe43542103acae2167a1a15
Gerrit-Change-Number: 15501
Gerrit-PatchSet: 5
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Mon, 05 Apr 2021 11:47:56 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in pysim[master]: Set uSIM to 'type approval operations' in EF['AD']

2021-04-05 Thread Robert Falkenberg
Robert Falkenberg has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/23632 )

Change subject: Set uSIM to 'type approval operations' in EF['AD']
..


Patch Set 1:

The ``EF_AD`` field contains administrative data (AD).
It consists of four bytes ``B1``, ``B2``, ``B3``, ``B4``, and optionally 
further bytes for future use.

Current implementation only sets the MNC field appropriately (located in `B4`) 
and sets all other bits/bytes to 0.

However, `B1` defines the *UE operation mode* as listed below. For type 
approval operations (such as testing with a test uSIM), this value should be 
set to `0x80` rather than `0x00`(= normal operation).
This may unlock some UE capabilities that are restricted in normal operation 
mode.

Excerpt from [ETSI TS 131 102, 
4.2.18](https://www.etsi.org/deliver/etsi_ts/131100_131199/131102/04.15.00_60/ts_131102v041500p.pdf):

```
B1 - UE operation mode:
Coding:
Initial value
- '00' normal operation.
- '80' type approval operations.
- '01' normal operation + specific facilities.
- '81' type approval operations + specific facilities.
- '02' maintenance (off line).
- '04' cell test operation.

B2 - Additional information:
Coding:
Reserved for future use

B3 - Additional information:
Coding:
- B3.b1: OFM setting (Ciphering)
- B3.others: Reserved for future use

B4 - Length of MNC in the IMSI:
Coding:
- B4.b4..B4.b1: length:  '0010' (= 2) or '0011' (=3)
- B4.others: Reserved for future use
```

**Legend:** Byte X, bit Y: BX.bY

Further reading: https://nickvsnetworking.com/usim-basics/


--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23632
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie9040c6b127c268878a0845ed73d0918ec6bbb08
Gerrit-Change-Number: 23632
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Falkenberg 
Gerrit-CC: Jenkins Builder
Gerrit-Comment-Date: Mon, 05 Apr 2021 06:27:09 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in pysim[master]: Set uSIM to 'type approval operations' in EF['AD']

2021-04-05 Thread Robert Falkenberg
Robert Falkenberg has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/23632 )


Change subject: Set uSIM to 'type approval operations' in EF['AD']
..

Set uSIM to 'type approval operations' in EF['AD']

Change-Id: Ie9040c6b127c268878a0845ed73d0918ec6bbb08
---
M pySim/cards.py
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/32/23632/1

diff --git a/pySim/cards.py b/pySim/cards.py
index 5eb2884..654d3fa 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -167,7 +167,7 @@
if data.lower() == "":
data = ""

-   content = data[0:6] + "%02X" % mnclen
+   content = "80" + data[2:6] + "%02X" % mnclen
data, sw = self._scc.update_binary(EF['AD'], content)
return sw


--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23632
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie9040c6b127c268878a0845ed73d0918ec6bbb08
Gerrit-Change-Number: 23632
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Falkenberg 
Gerrit-MessageType: newchange


Change in pysim[master]: Use zero padding for EF['ACC'] field

2021-04-05 Thread Robert Falkenberg
Robert Falkenberg has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/23631 )

Change subject: Use zero padding for EF['ACC'] field
..


Patch Set 1:

The ``EF_ACC`` field defines the access control class (ACC) for a subscriber.

Current implementation adds padding 1 towards the most significant bits if the 
input is shorter than 2 bytes.

However, it should be padded with 0, otherwise additional ACCs are allocated to 
the subscriber. (Probably only a single bit shall be set to 1)

Excerpt from [ETSI TS 131 102, 
4.2.15](https://www.etsi.org/deliver/etsi_ts/131100_131199/131102/04.15.00_60/ts_131102v041500p.pdf):

```
EF_ACC: Two bytes: B1, B2

B1.b8...B1.b4: high priority users (class 15...11)
B1.b3: always 0
B1.b2...B1.b2 and B2.b7...B2.b0: normal priority users (class 9...0) - to be 
evenly distributed across subscribers
```

**Legend:** Byte X, bit Y: BX.bY


--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23631
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I1b8dc01a6c48adad1ed8158de59b12519ed688e9
Gerrit-Change-Number: 23631
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Falkenberg 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Mon, 05 Apr 2021 06:24:51 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in pysim[master]: Use zero padding for EF['ACC'] field

2021-04-05 Thread Robert Falkenberg
Robert Falkenberg has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/23631 )


Change subject: Use zero padding for EF['ACC'] field
..

Use zero padding for EF['ACC'] field

Change-Id: I1b8dc01a6c48adad1ed8158de59b12519ed688e9
---
M pySim/cards.py
1 file changed, 2 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/31/23631/1

diff --git a/pySim/cards.py b/pySim/cards.py
index 5eb2884..0d5d6b9 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -76,7 +76,8 @@
return sw

def update_acc(self, acc):
-   data, sw = self._scc.update_binary(EF['ACC'], lpad(acc, 4))
+   #data, sw = self._scc.update_binary(EF['ACC'], lpad(acc, 4))
+   data, sw = self._scc.update_binary(EF['ACC'], lpad(acc, 4, 
c='0'))
return sw

def read_hplmn_act(self):

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/23631
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I1b8dc01a6c48adad1ed8158de59b12519ed688e9
Gerrit-Change-Number: 23631
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Falkenberg 
Gerrit-MessageType: newchange