This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Hoernchen gerrit-no-reply at lists.osmocom.orgHoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/15927 )
Change subject: sim: allow opening reader# > 0
......................................................................
sim: allow opening reader# > 0
Change-Id: I4b1abc8d8aae4bd9a32f927269d7ebfef902d7c5
---
M src/sim/reader_pcsc.c
M utils/osmo-sim-test.c
2 files changed, 10 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/27/15927/1
diff --git a/src/sim/reader_pcsc.c b/src/sim/reader_pcsc.c
index f22103f..853b157 100644
--- a/src/sim/reader_pcsc.c
+++ b/src/sim/reader_pcsc.c
@@ -79,17 +79,19 @@
rc = SCardListReaders(st->hContext, NULL, (LPSTR)&mszReaders, &dwReaders);
PCSC_ERROR(rc, "SCardListReaders");
+ /* SCARD_S_SUCCESS means there is at least one reader in the group */
num_readers = 0;
ptr = mszReaders;
- while (*ptr != '\0') {
+ while (*ptr != '\0' && num_readers != num) {
+ printf("%s\n", ptr);
ptr += strlen(ptr)+1;
num_readers++;
}
- if (num_readers == 0)
+ if (num > num_readers)
goto end;
- st->name = talloc_strdup(rh, mszReaders);
+ st->name = talloc_strdup(rh, ptr);
st->dwActiveProtocol = -1;
return rh;
diff --git a/utils/osmo-sim-test.c b/utils/osmo-sim-test.c
index 5588294..d805127 100644
--- a/utils/osmo-sim-test.c
+++ b/utils/osmo-sim-test.c
@@ -334,8 +334,12 @@
struct osim_card_hdl *card;
struct osim_chan_hdl *chan;
struct msgb *msg;
+ int readernum = 0;
- reader = osim_reader_open(OSIM_READER_DRV_PCSC, 0, "", NULL);
+ if(argc > 1)
+ readernum = atoi(argv[1]);
+
+ reader = osim_reader_open(OSIM_READER_DRV_PCSC, readernum, "", NULL);
if (!reader)
exit(1);
card = osim_card_open(reader, OSIM_PROTO_T0);
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/15927
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4b1abc8d8aae4bd9a32f927269d7ebfef902d7c5
Gerrit-Change-Number: 15927
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191031/182977e6/attachment.htm>