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

2021-04-08 Thread laforge
laforge has submitted this change. ( 
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
Related: OS#1704
---
M firmware/libcommon/source/card_emu.c
M firmware/libcommon/source/mode_cardemu.c
2 files changed, 5 insertions(+), 3 deletions(-)

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



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: 3
Gerrit-Owner: laforge 
Gerrit-Reviewer: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: tsaitgaist 
Gerrit-MessageType: merged


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

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

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


Patch Set 2: Code-Review+2


--
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: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: tsaitgaist 
Gerrit-Comment-Date: Thu, 08 Apr 2021 21:28:34 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


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

2021-04-06 Thread laforge
Hello Jenkins Builder,

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

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

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

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
Related: OS#1704
---
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/2
--
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: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


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