From patchwork Wed Oct 19 11:40:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Martin Dudok van Heel X-Patchwork-Id: 684061 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [IPv6:2a01:4f8:191:444b::2:7]) by ozlabs.org (Postfix) with ESMTP id 3szVY41wKYz9t0p for ; Wed, 19 Oct 2016 22:47:20 +1100 (AEDT) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 17EDF203F3; Wed, 19 Oct 2016 11:47:13 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org X-Greylist: delayed 427 seconds by postgrey-1.34 at lists.osmocom.org; Wed, 19 Oct 2016 11:47:11 UTC Received: from lb3-smtp-cloud6.xs4all.net (lb3-smtp-cloud6.xs4all.net [194.109.24.31]) by lists.osmocom.org (Postfix) with ESMTP id 21DC5203E3 for ; Wed, 19 Oct 2016 11:47:11 +0000 (UTC) Received: from [192.168.1.104] ([83.80.231.114]) by smtp-cloud6.xs4all.net with ESMTP id xPg11t0012UkpSj01Pg2T1; Wed, 19 Oct 2016 13:40:04 +0200 To: OpenBSC Mailinglist From: Martin Dudok van Heel Subject: pysim Fakemagicsim problem + workaround Fwd: SIM Card Reader Problem!! Message-ID: <58075B91.2040900@olifantasia.com> Date: Wed, 19 Oct 2016 13:40:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of OpenBSC, OsmoBSC, OsmoNITB, OsmoCSCN" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" Second try. (I already sent this mail yesterday, but it did not appear in the mailinglist. I do not know why. Maybe because I attached a file (a patch)) Hi all, This is my first post to the OpenBSC mailinglist. I had a problem with the latest pysim version giving errors while trying to program 2G (Fake)MagicSIM cards. This had worked fine in the past with an older release from 2011. I tried al lot of versions in between. I was finally able to narrow it down to the commit that broke compatibility with (fake)magicsim: http://cgit.osmocom.org/pysim/commit/pySim/commands.py?id=8c1b33c439fef423c3536e9243035722c52aba4c The comment with this comit is: "Do not return the FCI information while selecting a file The sysmoUSIM-SJS1 card does not support returning the FCI information. Plus, the FCI information are not used anyway." If I revert the change with attached patch, it works again. But it may break sysmoUSIM-SJS1 compatibility. I am not sure on how to test whether the programming of sysmoUSIM-SJS1 still works fine and if the SIMS themselves then will still work as expected with OpenBSC or OpenBTS or OpenAirinterface. If the code needs to stay in for sysmoUSIM-SJS1 then we probably need somehing like the pseudocode below: if carttype is fakemagicsim: "a4000002" elif cardtype is sysmoUSIM-SJS1: "a4000C02" else: #What should be the default for the other cards? Or is there another solution? With best regards, Martin Dudok van Heel This is the patch inline (attaching it as a file, blocked my email from going through) mdvh_pysim_make_fakesim_work_again_patch_2016081201.diff return rv On 12-08-16 09:50, Holger Freyther wrote: >> On 12 Aug 2016, at 09:18, Rene Groothuis wrote: >> >> Hello, > Hi! > > >> I’m still having problems, sorry to report this. Below the log file >> of different combinations: >> > >> I’ve used different (same model) SIM cards. I’ve reinstated the USB >> reader. Tried in different USB ports. No Luck. >> >> What am I doing wrong, can you please help? >> >> > Sysmocom sold the last 16in1 magicsim in 2012? Did you buy these cards > from us? Maybe this specific one is just broken? Maybe try an older > version of pySIM? E.g. maybe some of the patches required for the > sysmoUSIM-SJS1 broke magicsim support? > > In the future you could consider getting the sysmoUSIM-SJS1 from us, > they are of way higher quality than the Chinese (GRcard, magicsim, > etc.) ones. For emergencies like these it might make sense for you to > get a support contract from sysmocom as well. > > good luck > > holger > > diff --git a/pySim/commands.py b/pySim/commands.py index 721b3d4..b7fb77f 100644 --- a/pySim/commands.py +++ b/pySim/commands.py @@ -41,7 +41,7 @@ class SimCardCommands(object): def select_file(self, dir_list): rv = [] for i in dir_list: - data, sw = self._tp.send_apdu_checksw(self.cla_byte + "a4000C02" + i) + data, sw = self._tp.send_apdu_checksw(self.cla_byte + "a4000002" + i) rv.append(data)