Hello,

This is Apple ;)

for generic Java apps that can use and understand JAVA_HOME you should:

export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home

Then make sure to run Java in 32 bit mode with -d32 (Java 1.6 is
needed because Java 1.7 comes only in 64 bit mode on Apple).


For any kind of development (that does not include developing *for*
mac) I suggest to take a Debian VM inside VMWare player or Virtualbox
and use it over SSH.

Martin

On Fri, Jan 25, 2013 at 8:52 AM, Wolfgang Korn <[email protected]> wrote:
> Hi Mike,
>
> thanks for your reply. The version of the pcsclite is the one which is
> shipped with OSX Lion. pcscd -v reports version 1.4.0. As written in
> my original post I replaced the stock ccid driver with a pached 1.4.9
> version in order to support my Springcard NFC terminal. However, the
> problem also occurs working only with my Reiner-SCT terminal which
> does not make use of the ccid driver but has its own driver.
>
> I also took a detailed look into the logs written by the JVM. Below I
> there is the stack trace showing where the problem occurs. The
> interesting thing is that even if the stack trace shows problems while
> listing the attached readers, my program always properly shows the
> readers prior to terminating due to the seg fault.
>
> Stack: [0x0000000108ea8000,0x0000000108fa8000],
> sp=0x0000000108fa77e0,  free space=1021k
> Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native 
> code)
> C  [libj2pcsc.dylib+0x166e]  pcsc_multi2jstring+0x11
> C  [libj2pcsc.dylib+0x17f9]
> Java_sun_security_smartcardio_PCSC_SCardListReaders+0x72
> j  sun.security.smartcardio.PCSC.SCardListReaders(J)[Ljava/lang/String;+0
> j  
> sun.security.smartcardio.PCSCTerminals.list(Ljavax/smartcardio/CardTerminals$State;)Ljava/util/List;+15
> j  javax.smartcardio.CardTerminals.list()Ljava/util/List;+4
> j  de.frusty.test.smartcard.SmartcardTest.main([Ljava/lang/String;)V+8
>
> -- Wolfgang
>
>
> On Thu, Jan 24, 2013 at 10:09 PM, Michael StJohns <[email protected]> 
> wrote:
>> The first thing I'd do is take a look at which versions of the ccid and 
>> pcsclite packages you have on your system.  You may need to update those 
>> substantially.  Also, take a look at the logs for the pcscd - see if you 
>> even got that far.
>>
>> Mike
>>
>>
>> At 02:56 PM 1/24/2013, Wolfgang Korn wrote:
>>>Hi all,
>>>
>>>Currently I'm making myself familiar with NFC. For that reason I
>>>started with a simple program which simply reads a tag's serial number
>>>(see code below). The program is working fine in a Windows
>>>environment. However, running the same program under OSX Lion does not
>>>work. To be more specific: The program causes a segmentation fault in
>>>libj2pcsc.dylib which I assume is javax.smartcard's JNI wrapper to
>>>PC/SC. The behavior suggests that there might be some kind of race
>>>condition. Moving code from inside a loop to the outside changes the
>>>behavior (regarding the seg fault) and also simply introducing delays
>>>sometimes changes it. I also tried sample code provided by Springcard
>>>and got the same results. I do not thing that this problem is related
>>>to the Springcard terminal. Doing the same with a smartcard terminal
>>>and a smartcard causes the same problem.
>>>
>>>I have a Springcard NFC'Roll and a Reiner-SCT cyberjack ecom terminal
>>>connected to the machine. In order to make the NFC'Roll working I
>>>replaced the CCID driver shipped with OSX with a recompiled version
>>>(1.4.9) in which I added the terminal's vendor and product IDs.
>>>
>>>Here is what I tried to get rid of the problem. First of all I updated
>>>my Java6 to the latest version assuming that a new version of the JNI
>>>wrapper would be shipped. Now the version is 1.6.0_37. Unfortunately
>>>that did not solve the problem. Next step was installing Java7 but
>>>that did not eliminate the problem either. Here is the output I get:
>>>
>>>Invalid memory access of location 0x0 rip=0x109e6f66e
>>>java(621,0x1014ae000) malloc: *** mmap(size=140527034961920) failed
>>>(error code=12)
>>>*** error: can't allocate region
>>>*** set a breakpoint in malloc_error_break to debug
>>>
>>>I also have the log files generated by the JVM.
>>>
>>>Any suggestion what can be done to get rid of that problem. Any help
>>>is much appreciated.
>>>
>>>Best
>>>Wolfgang
>>>
>>>
>>>=======================
>>>
>>>        try {
>>>            while (true) {
>>>                // show the list of available terminals
>>>                TerminalFactory factory = TerminalFactory.getDefault();
>>>                List<CardTerminal> terminals = factory.terminals().list();
>>>                System.out.println("Terminals: " + terminals);
>>>
>>>                // get the first terminal
>>>                CardTerminal terminal = terminals.get(1);
>>>
>>>                if (terminal.isCardPresent()) {
>>>                    // establish a connection with the card
>>>                    Card card = terminal.connect("*");
>>>                    System.out.println("card: " + card);
>>>
>>>                    // print card's ATR
>>>                    ATR atr = card.getATR();
>>>                    System.out.println("atr: " + atr.toString());
>>>                    System.out.println("ATR bytes");
>>>                    HexDump.dump(atr.getBytes(), 0, System.out, 0);
>>>                    System.out.println("Historical bytes");
>>>                    HexDump.dump(atr.getHistoricalBytes(), 0, System.out, 0);
>>>
>>>                    // Retrieve serial number
>>>                    byte[] c1 = {(byte) 0xff, (byte) 0xca, (byte) 0x00,
>>>                        (byte) 0x00, (byte) 0x00};
>>>                    CardChannel channel = card.getBasicChannel();
>>>                    ResponseAPDU r = channel.transmit(new CommandAPDU(c1));
>>>                    System.out.println("Card S/N");
>>>                    HexDump.dump(r.getData(), 0, System.out, 0);
>>>                    System.out.println();
>>>
>>>                    // disconnect
>>>                    try {
>>>                        Thread.sleep(2000);
>>>                    }
>>>                    catch (InterruptedException ie) {
>>>                    }
>>>                    card.disconnect(false);
>>>                }
>>>            }
>>>        }
>>>        catch (Exception exc) {
>>>            exc.printStackTrace();
>>>        }
>>>
>>>_______________________________________________
>>>Muscle mailing list
>>>[email protected]
>>>http://lists.musclecard.com/mailman/listinfo/muscle_lists.musclecard.com
>>
>>
>>
>> _______________________________________________
>> Muscle mailing list
>> [email protected]
>> http://lists.musclecard.com/mailman/listinfo/muscle_lists.musclecard.com
>
> _______________________________________________
> Muscle mailing list
> [email protected]
> http://lists.musclecard.com/mailman/listinfo/muscle_lists.musclecard.com

_______________________________________________
Muscle mailing list
[email protected]
http://lists.musclecard.com/mailman/listinfo/muscle_lists.musclecard.com

Reply via email to