Compare commits

...

17 Commits

Author SHA1 Message Date
Eric Wild 17a5333bf7 contrib/flash.py: fix typos
Python has no versoin nor printf.

Change-Id: I4fd4d2592b44b3ae827e00ae73d8c451aa2ec18f
2026-08-10 16:13:59 +00:00
Eric Wild 0718caae23 host: simtrace2-sniff: init exit code
Early failure i.e. of libusb return random values as exit code.

Change-Id: If920824d35c1f37efe16440b5fb190ca0fb19148
2026-08-10 16:13:59 +00:00
Eric Wild dffc6601b2 host: simtrace2_api: do not log random memory
tx_cfg->features is logged before the memcpy() that fills it.
Looks like no one is using config.ac --enable-sanitize?

Change-Id: Id8369d312c8600ba9eea80c8f7782f196d7e20d1
2026-08-10 16:13:59 +00:00
Eric Wild 481a738a2d firmware: qmod: fix '@' debug command switching the wrong channel
Apparently copy paste mistake.

Change-Id: I9383adcfffab07ffa5f1fd3505e3aa244fb393ff
2026-08-10 16:13:59 +00:00
Eric Wild 670078b332 firmware: sniffer: honor the ep argument of usb_msg_alloc_hdr()
Even though all callers pass the same endpoint anyway the arg should
be used and not discarded.

Change-Id: I1fa0097b9eef531900b359c7293a6c60040254e4
2026-08-10 16:13:59 +00:00
Eric Wild 028f3b6bf5 firmware: sniffer: do not drop maximum-length ATRs
7816-3 8.1/8.2.1 allow TS plus 32 bytes.
atr_i is a byte count, not an index, process_byte_atr() guards its own
store with the same condition before incrementing, so atr_i reaches 33.

Change-Id: Ic8398cbefc0b522946b6470fd0268fa70662dab1
2026-08-10 16:13:59 +00:00
Eric Wild 2ade068fb6 firmware: sniffer: fix ~INS procedure byte comparison
(~g_tpdu.packet[1]) == byte can never be true.
Unary ~ applies the integer promotions first,
so for tpdu INS = 0xA4 lhs should be 0x5B but as int
it gets zero extended to at least 16 bits and then flipped,
so it is 0xFFFFFF5B = -165, byte promotes to 0..255.

The ack was therefore dead code -> fallthrough to SW1
branch, fails 0x6x/0x9x test, TPDU gets flagged
SNIFF_DATA_FLAG_ERROR_MALFORMED from what I can tell.
But I am losing track of all these arcane issues to be honest.

Narrow the complement back to 8 bits.
Fyi this is unrelated to signedness and not specific to ARM.

Change-Id: I800f50ef35356429d07aa685ea919e70ec34946e
2026-08-10 16:13:59 +00:00
Eric Wild 58438bfdbc firmware: card_emu: fix 7816-3 10.3.2 0=256 case
add_tpdu_byte() accumulates bytes received from the reader, but passes
reader_to_card = 0, but ISO 7816-3 10.3.2 says P3 == 0 means 256 not 0

Only reachable with P3 == 0 in a receive data phase, but
simtrace2-cardem-pcsc only requests PB_AND_RX when there is command data.

Fix this anyway.

Change-Id: I0fa4741bc1293549816595e6b4e8af9e22bcfbc1
2026-08-10 16:13:59 +00:00
Eric Wild f7170aff42 firmware: protect uart_tx_queue against ISR
cardem:
- dispatch_usb_command_cardem() appends to uart_tx_queue from the main loop
- tx_byte_tpdu() dequeues from the USART IRQ handler @ NVIC prio 0

card_handle_reset() has the same issue, drains queue and
frees uart_tx_msg from main loop while the ISR may own them.

All of this needs protection against the irq.

Needs a fixed llist_add_tail_irqsafe(), which called __enable_irq() instead of
restoring the saved PRIMASK for some unknown reason?!?!?!?

Change-Id: I7d9cdcc56263b27dfd4649dfb1da1d67761ee923
2026-08-10 16:13:59 +00:00
Eric Wild b36adff672 firmware: card_emu: use Di in the waiting time
ISO 7816-3 section 10.2 defines WT = WI x 960 x Fi/f seconds,
store as etu, etu = Fi / (D x f) seconds, so the Fi cancels,
but the D does not:

	WT [etu] = WI x 960 x D

cemu dropped both (?!) -> WI x 960.
The old comment explains why Fi can be dropped, which is right, but
what about Di ?!
sniffer gets it right (wt_wi * 960UL * wt_d), so the two state machines
disagreed here again, by up to a factor of 64???!!?!!?

This was fixed in osmo-ccid-firmware in 066489d in 2020 but not ported
to st2.

Additionally the waiting time was only recalculated at the end of the ATR,
where D is still 1 by definition, so a PPS increasing D reprogrammed the
baud rate but left the waiting time untouched??!

etu duration shrinks with D by the same factor, wall clock WT is
independent of D, which is the whole point.
The old code decreased the waiting time by a factor of D:
after a PPS to D=8 the card emitted its NULL procedure byte at ~0.09s
instead of ~0.71s with a reader deadline of ~1.43s,
and the inactivity timeout fires 8x too early, which probably led to
unexplained wtime_exp errors.

Update wt when WI becomes known (end of ATR) and
where D changes (after the PPS response) + tests.

Change-Id: I4263176d6073029d01f9ff5b11a6311617956af6
2026-08-10 16:13:59 +00:00
Eric Wild 88a6a782a2 firmware: use the full 11 bit US_FIDI.FI_DI_RATIO
US_FIDI_FI_DI_RATIO_Msk is 0x7ff,
cemu rejected >= 0x400 in emu_update_fidi() and masked with 0x3ff
in card_emu_uart_update_fidi(), but update_fidi() used by
the sniffer already used 0x7ff.

-> ratios 1024..2047 are unusable in cemu, which is the entire upper
half of ISO 7816-3 Table 7 at Di=1.

A reader trying one of those in a PPS gets the proposal echoed and
accepted, after which the card keeps transmitting at the old rate.

FI_DI_RATIO is clock periods per bit -> larger ratio is a SLOWER link.
The old check rejected slow values but accepted Fi=372/Di=64, ratio 5 !?

Unify and use the register mask (= shifed by 0 so usable as value) and
reject ratios that do not fit rather than truncating to garbage dividers.

Change-Id: I6211dd5be7c5c5d2150af2aa37a403b33e6d340d
2026-08-10 16:13:59 +00:00
Alexander Couzens 889b8d8927 cosmetic: fix typo in comment
Change-Id: I85939afd424c957ae872fa99f40b9cd528375537
2026-08-07 16:01:43 +02:00
Eric Wild d55729cba7 firmware: iso7816_3: fix F/D ratio for Di 8 and 9
iso7816_3_compute_fd_ratio() multiplied F by D for every d_index >= 8,
presumably because the upper half of ISO 7816-3 Table 8 encodes 1/D.

But 7816-3 2006 and 1997 differ!
That assumption is only true for the range 1010..1111, which in the
2006 version is RFU. Indices 1000 and 1001 are Di = 12 and Di = 20,
see iso7816_3_di_table[].

So right now Fi=372/Di=12 -> 372 * 12 = 4464 instead of 372 / 12 =
31.
In the cemu  value is rejected in emu_update_fidi()
and the old baud rate is silently kept.
In the sniffer update_fidi() programs US_FIDI as
4464 & 0x7ff = 368, which is garbage.

Use F/D for indices 1..9 and keep the legacy 1/D reading only for the RFU
range, where we cant really do anything useful anyway.

Change-Id: I44d6451d8b04aea2b0db7291b06a812afe84e52f
2026-07-28 18:22:02 +02:00
Alexander Couzens 567c03c83f firmware: card_emu.h: declare usb_buf_upd_len_and_submit()
usb_buf_upd_len_and_submit() is already a non-static function and should be
accessible.

Change-Id: I734d4b2d782223dd2f735f140d8c9bc6fc00a086
2026-07-14 18:24:44 +02:00
Alexander Couzens 1b43e1db48 firmware: card_emu.h: add missing header stdbool.h.
Change-Id: I4ad6d5cf0b4477cbd5f761d70c4cd92fb3ca1fcd
2026-07-14 18:24:15 +02:00
Alexander Couzens 01f36081fc README.md: describe the debug uart
Change-Id: I4cf929fded962e7ffb4c01628279385b2af04157
2026-07-14 18:24:10 +02:00
Alexander Couzens 7949165a4a README.md: fix typo in firmware
Change-Id: I16721418fce55322c8730920ceaa4e65f91a8a7e
2026-07-11 20:06:22 +02:00
14 changed files with 155 additions and 39 deletions
+9 -1
View File
@@ -40,7 +40,7 @@ The host software includes
* libosmo-simtrace2 - a shared library to talk to devices running the simtrace2 firmware
* simtrace2-list - list any USB-attached devices running simtrace2 firmware
* simtrace2-sniff - interface the 'trace' firmware to obtain card protocol traces
* simtrace2-cardem-pcsc - interface the 'cardem' fimrware to use a SIM in a PC/SC reader
* simtrace2-cardem-pcsc - interface the 'cardem' firmware to use a SIM in a PC/SC reader
Do not expect SIMtrace2 to work in VMs
@@ -52,3 +52,11 @@ with USB pass-through for things with critical timing like SIMtrace2 is
calling for trouble** and we will not accept related bug reports or
support you if you do. If you still want to use VMs: Feel free to do
so, but understand that it's unsupported and you are on your own.
Debug UART
----------
The debug UART configuration is 921600 8N1, TTL 3.3V.
On the simtrace 2 use either a 2.5 mm stereo headphone connector (tip = TX, ring = RX, sleeve = GND)
or the nearby DEBUG port (pin 1 = GND, pin 4 = TX, pin 5 = RX).
+3 -3
View File
@@ -110,12 +110,12 @@ for usb_device in usb_devices:
if serial:
version = "< 0.5.1.45-ac7e"
else:
versoin = "< 0.5.1.45-ac7e"
version = "< 0.5.1.45-ac7e"
else:
if serial:
version = "< 0.5.1.37-ede8"
else:
versoin = "< 0.5.1.34-e026"
version = "< 0.5.1.34-e026"
print("device firmware version: " + version)
# flash latest firmware
if to_flash == "list": # we just want to list the devices, not flash them
@@ -156,7 +156,7 @@ for usb_device in usb_devices:
dfu_result = subprocess.run(["dfu-util", "--device", hex(definition.usb_vendor_id) + ":" + hex(definition.usb_product_id), "--path", usb_path, "--cfg", "1", "--alt", "1", "--reset", "--download", dl_path])
os.remove(dl_path)
if 0 != dfu_result.returncode:
printf("flashing firmware using dfu-util failed. ensure dfu-util is installed and you have the permissions to access this USB device")
print("flashing firmware using dfu-util failed. ensure dfu-util is installed and you have the permissions to access this USB device")
continue
updated_nb += 1
+1 -1
View File
@@ -287,7 +287,7 @@ void board_exec_dbg_cmd(int ch)
sim_switch_use_physical(0, 0);
break;
case '@':
sim_switch_use_physical(0, 0);
sim_switch_use_physical(1, 0);
break;
case 't':
talloc_report(NULL, stdout);
+4
View File
@@ -15,9 +15,11 @@
*/
#pragma once
#include <stdbool.h>
#include <stdint.h>
struct card_handle;
struct msgb;
enum card_io {
CARD_IO_VCC,
@@ -74,3 +76,5 @@ int card_emu_get_vcc(uint8_t uart_chan);
struct cardemu_usb_msg_config;
int card_emu_set_config(struct card_handle *ch, const struct cardemu_usb_msg_config *scfg,
unsigned int scfg_len);
void usb_buf_upd_len_and_submit(struct msgb *msg);
+1 -1
View File
@@ -34,7 +34,7 @@ static inline void llist_add_tail_irqsafe(struct llist_head *_new,
local_irq_save(x);
llist_add_tail(_new, head);
__enable_irq();
local_irq_restore(x);
}
static inline struct llist_head *llist_head_dequeue_irqsafe(struct llist_head *head)
+46 -13
View File
@@ -219,19 +219,31 @@ struct card_handle {
static void card_handle_reset(struct card_handle *ch)
{
struct msgb *msg;
unsigned long x;
card_emu_uart_update_wt(ch->uart_chan, 0);
/* release any buffers we may still own */
if (ch->uart_tx_msg) {
usb_buf_free(ch->uart_tx_msg);
ch->uart_tx_msg = NULL;
}
/* Release any buffers we may still own.
* uart_tx_msg + uart_tx_queue are shared with the UART IRQ handler,
* that preempts us here -> needs atomic detach and free */
local_irq_save(x);
msg = ch->uart_tx_msg;
ch->uart_tx_msg = NULL;
local_irq_restore(x);
if (msg)
usb_buf_free(msg);
if (ch->uart_rx_msg) {
usb_buf_free(ch->uart_rx_msg);
ch->uart_rx_msg = NULL;
}
while ((msg = msgb_dequeue(&ch->uart_tx_queue))) {
while (1) {
local_irq_save(x);
msg = msgb_dequeue(&ch->uart_tx_queue);
local_irq_restore(x);
if (!msg)
break;
usb_buf_free(msg);
}
}
@@ -376,7 +388,7 @@ static void emu_update_fidi(struct card_handle *ch)
int rc;
rc = iso7816_3_compute_fd_ratio(ch->F_index, ch->D_index);
if (rc > 0 && rc < 0x400) {
if (rc > 0 && rc <= (US_FIDI_FI_DI_RATIO_Msk >> US_FIDI_FI_DI_RATIO_Pos)) {
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 */
@@ -386,6 +398,26 @@ static void emu_update_fidi(struct card_handle *ch)
ch->num, rc);
}
/*! Calculate the WT from current WI and D.
*
* ISO 7816-3 10.2 defines WT = WI x 960 x Fi / f [seconds].
* Our waiting time is stored in units of etu = Fi / (D x f) seconds
* -> the Fi cancels out, but D does not.
*
* WT [etu] = WI x 960 x D
*
* D is the value from ISO 7816-3 Table 8. Only 1..9 are defined,
* 0 and RFU range 10..15 have no D -> use D = 1 */
static void emu_update_wt(struct card_handle *ch)
{
uint8_t d = 1;
if (ch->D_index >= 1 && ch->D_index <= 9)
d = iso7816_3_di_table[ch->D_index];
ch->waiting_time = ch->wi * 960 * d;
}
/* Update the ISO 7816-3 TPDU receiver state */
static void card_set_state(struct card_handle *ch,
enum iso7816_3_card_state new_state)
@@ -505,11 +537,8 @@ static int tx_byte_atr(struct card_handle *ch)
}
}
}
/* 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;
/* update the waiting time now that WI is known (see emu_update_wt) */
emu_update_wt(ch);
/* go to next state */
card_set_state(ch, ISO_S_WAIT_TPDU);
return 0;
@@ -675,6 +704,9 @@ static int tx_byte_pts(struct card_handle *ch)
card_emu_uart_wait_tx_idle(ch->uart_chan);
/* update baud rate generator with F/D */
emu_update_fidi(ch);
/* the waiting time is expressed in etu and scales with D, so it has
* to be recomputed whenever D changes */
emu_update_wt(ch);
/* Wait for the next TPDU */
card_set_state(ch, ISO_S_WAIT_TPDU);
set_pts_state(ch, PTS_S_WAIT_REQ_PTSS);
@@ -713,7 +745,8 @@ static void add_tpdu_byte(struct card_handle *ch, uint8_t byte)
{
struct msgb *msg;
struct cardemu_usb_msg_rx_data *rd;
unsigned int num_data_bytes = t0_num_data_bytes(ch->tpdu.hdr[_P3], 0);
/* these are bytes the reader sends to us, so P3 is a literal count */
unsigned int num_data_bytes = t0_num_data_bytes(ch->tpdu.hdr[_P3], 1);
/* ensure we have a buffer */
if (!ch->uart_rx_msg) {
+7 -3
View File
@@ -48,9 +48,13 @@ int iso7816_3_compute_fd_ratio(uint8_t f_index, uint8_t 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 (d_index < 8)
/* DI defined in Table 8 of ISO/IEC 7816-3:2006
* has values 0001..1001 as div 1, 2, 4, 8, 16, 32, 64, 12, 20
* so indices 1..9 are all divisors and the ratio is F/D.
* But Indices 1010..1111 are RFU in the 2006 edition!
* 1997 used those for 1/2 .. 1/64, where dividing by 1/d equals multiplying by d.
* Keep that legacy interpretation for the RFU range only. */
if (d_index < 10)
ret = f / d;
else
ret = f * d;
+3 -2
View File
@@ -387,7 +387,7 @@ int card_emu_uart_update_fidi(uint8_t uart_chan, unsigned int fidi)
Usart *usart = get_usart_by_chan(uart_chan);
usart->US_CR |= US_CR_RXDIS | US_CR_RSTRX;
usart->US_FIDI = fidi & 0x3ff;
usart->US_FIDI = US_FIDI_FI_DI_RATIO(fidi);
usart->US_CR |= US_CR_RXEN | US_CR_STTTO;
return 0;
}
@@ -737,7 +737,8 @@ static void dispatch_usb_command_cardem(struct msgb *msg, struct cardem_inst *ci
switch (hdr->msg_type) {
case SIMTRACE_MSGT_DT_CEMU_TX_DATA:
queue = card_emu_get_uart_tx_queue(ci->ch);
llist_add_tail(&msg->list, queue);
/* drained from the USART IRQ handler at highest NVIC prio */
llist_add_tail_irqsafe(&msg->list, queue);
card_emu_have_new_uart_tx(ci->ch);
break;
case SIMTRACE_MSGT_DT_CEMU_SET_ATR:
+2 -2
View File
@@ -127,14 +127,14 @@ void update_fidi(Usart_info *usart, uint8_t fidi)
uint8_t di = fidi & 0xf;
int ratio = iso7816_3_compute_fd_ratio(fi, di);
if (ratio > 0 && ratio < 0x8000) {
if (ratio > 0 && ratio <= (US_FIDI_FI_DI_RATIO_Msk >> US_FIDI_FI_DI_RATIO_Pos)) {
/* make sure USART uses new F/D ratio */
usart->base->US_CR |= US_CR_RXDIS | US_CR_RSTRX;
/* disable write protection */
if (usart->base->US_WPMR) {
usart->base->US_WPMR = US_WPMR_WPKEY(0x555341);
}
usart->base->US_FIDI = (ratio & 0x7ff);
usart->base->US_FIDI = US_FIDI_FI_DI_RATIO(ratio);
usart->base->US_CR |= US_CR_RXEN | US_CR_STTTO;
//TRACE_INFO("updated USART(%u) Fi(%u)/Di(%u) ratio(%d): %u\n\r", usart->id, fi, di, ratio, usart->base->US_FIDI);
} else {
+4 -4
View File
@@ -239,14 +239,14 @@ static void update_wt(uint8_t wi, uint8_t d, const char *cause)
static struct msgb *usb_msg_alloc_hdr(uint8_t ep, uint8_t msg_class, uint8_t msg_type)
{
/* Only allocate message if not too many are already in the queue */
struct llist_head *head = usb_get_queue(SIMTRACE_USB_EP_CARD_DATAIN);
struct llist_head *head = usb_get_queue(ep);
if (!head) {
return NULL;
}
if (llist_count(head) > 5) {
return NULL;
}
struct msgb *usb_msg = usb_buf_alloc(SIMTRACE_USB_EP_CARD_DATAIN);
struct msgb *usb_msg = usb_buf_alloc(ep);
if (!usb_msg) {
return NULL;
}
@@ -406,7 +406,7 @@ static void usb_send_atr(uint32_t flags)
TRACE_WARNING("Can't print ATR in ISO 7816-3 state %u\n\r", iso_state);
return;
}
if (g_atr.atr_i >= ARRAY_SIZE(g_atr.atr)) {
if (g_atr.atr_i > ARRAY_SIZE(g_atr.atr)) {
TRACE_ERROR("ATR buffer overflow\n\r");
return;
}
@@ -775,7 +775,7 @@ static void process_byte_tpdu(uint8_t byte)
} else if (g_tpdu.packet[1] == byte) { /* get all remaining data bytes */
change_tpdu_state(TPDU_S_DATA_REMAINING);
break;
} else if ((~g_tpdu.packet[1]) == byte) { /* get single data byte */
} else if ((uint8_t)(~g_tpdu.packet[1]) == byte) { /* get single data byte */
change_tpdu_state(TPDU_S_DATA_SINGLE);
break;
}
+72 -6
View File
@@ -396,12 +396,73 @@ const uint8_t pps[] = {
0xFF ^ 0b00010000// PCK
};
static void
test_ppss(struct card_handle *ch)
/* Fi/Di that is actually valid: Fi idx 9 (Fi=512) and Di idx 4 (Di=8)
* This tests calculating F/D ratio (512/8 = 64) and the calculation of the
* waiting time which scales with Di. */
const uint8_t pps_fidi[] = {
0xFF, // PPSS
0b00010000, // PPS0: PPS1 present
0x94, // PPS1: Fi index 9, Di index 4
0xFF ^ 0b00010000 ^ 0x94// PCK
};
/* Di 8 idx Di=12 (ISO 7816-3:2006 Table 8),:
* the ratio be 372/12 = 31, not 372*12. */
const uint8_t pps_di12[] = {
0xFF, // PPSS
0b00010000, // PPS0: PPS1 present
0x18, // PPS1: Fi index 1, Di index 8
0xFF ^ 0b00010000 ^ 0x18// PCK
};
/* Fi idx 5 Fi=1488 andDi=1 -> ratio 1488, needs all 11 bits of
* the US_FIDI.FI_DI_RATIO field. */
const uint8_t pps_hi_ratio[] = {
0xFF, // PPSS
0b00010000, // PPS0: PPS1 present
0x51, // PPS1: Fi index 5, Di index 1
0xFF ^ 0b00010000 ^ 0x51// PCK
};
/* Get a cemu status report to check the negotiated parameters
* This is the only way to get the waiting time from struct card_handle. */
static void verify_status(struct card_handle *ch, uint8_t exp_f_index, uint8_t exp_d_index,
uint32_t exp_waiting_time)
{
reader_send_bytes(ch, pps, sizeof(pps));
get_and_verify_rctx_pps(pps, sizeof(pps));
card_tx_verify_chars(ch, pps, sizeof(pps));
struct usb_buffered_ep *bep = usb_get_buf_ep(PHONE_DATAIN);
struct cardemu_usb_msg_status *sts;
struct simtrace_msg_hdr *mh;
struct msgb *msg;
card_emu_report_status(ch, false);
assert(bep);
msg = msgb_dequeue_count(&bep->queue, &bep->queue_len);
assert(msg);
mh = (struct simtrace_msg_hdr *) msg->l1h;
assert(mh->msg_type == SIMTRACE_MSGT_BD_CEMU_STATUS);
sts = (struct cardemu_usb_msg_status *) msg->l2h;
printf("status: F_index=%u D_index=%u wi=%u waiting_time=%u\n",
sts->F_index, sts->D_index, sts->wi, sts->waiting_time);
assert(sts->F_index == exp_f_index);
assert(sts->D_index == exp_d_index);
/* WT = WI x 960 x D in etu, see ISO 7816-3 Section 10.2 */
assert(sts->waiting_time == exp_waiting_time);
usb_buf_free(msg);
}
static void
test_ppss(struct card_handle *ch, const uint8_t *req, unsigned int req_len,
uint8_t exp_f_index, uint8_t exp_d_index, uint32_t exp_waiting_time)
{
printf("\n==> PPS exchange\n");
reader_send_bytes(ch, req, req_len);
get_and_verify_rctx_pps(req, req_len);
card_tx_verify_chars(ch, req, req_len);
verify_status(ch, exp_f_index, exp_d_index, exp_waiting_time);
}
/* READ RECORD (offset 0, 10 bytes) */
@@ -426,7 +487,12 @@ int main(int argc, char **argv)
io_start_card(ch);
card_tx_verify_chars(ch, NULL, 0);
test_ppss(ch);
/* WI is 10 so WT = 10 x 960 x D */
/* Fi/Di index 0/0 is invalid: the F/D ratio is rejected, D falls back to 1 */
test_ppss(ch, pps, sizeof(pps), 0, 0, 10 * 960 * 1);
test_ppss(ch, pps_fidi, sizeof(pps_fidi), 9, 4, 10 * 960 * 8);
test_ppss(ch, pps_di12, sizeof(pps_di12), 1, 8, 10 * 960 * 12);
test_ppss(ch, pps_hi_ratio, sizeof(pps_hi_ratio), 5, 1, 10 * 960 * 1);
for (i = 0; i < 2; i++) {
test_tpdu_reader2card(ch, tpdu_hdr_write_rec, tpdu_body_write_rec, sizeof(tpdu_body_write_rec));
+1 -1
View File
@@ -63,7 +63,7 @@ const char *osmo_apdu_dump_context_buf(char *buf, unsigned int buf_len,
}
/*! \brief input function for APDU segmentation
* \param ac APDU context accross successive calls
* \param ac APDU context across successive calls
* \param[in] apdu_buf APDU inpud data buffer
* \param[in] apdu_len Length of apdu_buf
* \param[in] new_apdu Is this the beginning of a new APDU?
+1 -1
View File
@@ -280,7 +280,7 @@ int osmo_st2_cardem_request_config2(struct osmo_st2_cardem_inst *ci, const struc
tx_cfg = (struct cardemu_usb_msg_config *) msgb_put(msg, sizeof(*tx_cfg));
LOGSLOT(ci->slot, LOGL_NOTICE, "<= %s(features=%08x)\n", __func__, tx_cfg->features);
LOGSLOT(ci->slot, LOGL_NOTICE, "<= %s(features=%08x)\n", __func__, user_cfg->features);
memcpy(tx_cfg, user_cfg, sizeof(*tx_cfg));
osmo_store32le(user_cfg->features, &tx_cfg->features);
+1 -1
View File
@@ -328,7 +328,7 @@ static void signal_handler(int signal)
int main(int argc, char **argv)
{
int i, rc, ret;
int i, rc, ret = 1;
print_welcome();
/* Parse arguments */