Coolred / ismb-snep-java

Automatically exported from code.google.com/p/ismb-snep-java
0 stars 0 forks source link

it can't run with acr122s #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.when I connect acr122s , I use usb-to-serial drivers .It can connect success 
using acr122s' sdk.
2. But this project cant run,the console shows:
3. Get factory
   Get terminals
   There are not terminals.
   invalid card terminal
   Exception in thread "Timer-0" java.lang.NullPointerException
    at it.ismb.npp.SenderToPhone$ThreadSender.run(SenderToPhone.java:109)
    at it.ismb.npp.SenderToPhone$InitiatorTask.run(SenderToPhone.java:77)
    at java.util.TimerThread.mainLoop(Unknown Source)
    at java.util.TimerThread.run(Unknown Source)

Is acr122s belong to acr122 series?It's the problem of the reader version or 
the usb2serial driver?Since acr122 is hard to buy,how about acr122u ?Thanks!

Original issue reported on code.google.com by lovero...@gmail.com on 10 Jun 2012 at 3:47

GoogleCodeExporter commented 9 years ago
I am using ACR122U and Nexus S and I can see the same issue sometimes. 
But if I use HTC or samsung GT-I9300, the ACR122 LED keeps blinking and throw 
exceptions at terminal.iscardpreset(). 
Seems that it can't work other Android phone with version 4.0.

Original comment by jun...@gmail.com on 19 Jun 2012 at 5:52

GoogleCodeExporter commented 9 years ago
I have the same issue using Acr122s. Is a problem only for this device? Is it 
my mistake? What models of devices work well? Thanks!

Original comment by Carlos.b...@gmail.com on 25 Jun 2012 at 8:59

GoogleCodeExporter commented 9 years ago
Google Nexus S Android 4.0.4 does not give ATR for every ATR request.
This is a major issue with many ICS4.0.4 phones.

Original comment by innolab...@gmail.com on 2 Jul 2012 at 5:16

GoogleCodeExporter commented 9 years ago
byte[] targetConnect = {(byte)0x01, (byte) 0x11, (byte) 0x20};
                    byte[] reply=transceive((byte)0x40, targetConnect);

not able to connect with Blackberry Bold 9900
using the above mentioned instructions

Original comment by prithwis...@gmail.com on 2 Aug 2012 at 4:09

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hey, I have ACR122U-A2, and am happy to confirm lovero...@gmail.com's symptoms 
with my reader. Pardon the pun, but I have spent the last [almost] 4 hours 
staring at the code and cant seem to be able to fix this. 

Original comment by dyavolo....@googlemail.com on 29 Aug 2012 at 1:40

GoogleCodeExporter commented 9 years ago
Hi, for those of you that are getting the null pointer exception at just list() 
failed:
you need to install the device drivers, that bumps the problem a few lines and 
I get the terminal name printed out at least. In addition,  I get the following 
error if I dont put the android phone *on* the card reader:

Get factory
Get terminals
Terminal name: ACS ACR122 0
Device not supported, only ACS ACR122 is supported now
Exception in thread "Timer-0" java.lang.NullPointerException
    at it.ismb.snep.SenderToPhone$ThreadSender.run(SenderToPhone.java:105)
    at it.ismb.snep.SenderToPhone$InitiatorTask.run(SenderToPhone.java:73)
    at java.util.TimerThread.mainLoop(Unknown Source)
    at java.util.TimerThread.run(Unknown Source)

however, if I execute the code after placing the phone on the reader I get: 

Get factory
Get terminals
Terminal name: ACS ACR122 0
Device not supported, only ACS ACR122 is supported now
Exception in thread "Timer-0" java.lang.NullPointerException
    at it.ismb.snep.SenderToPhone$ThreadSender.run(SenderToPhone.java:105)
    at it.ismb.snep.SenderToPhone$InitiatorTask.run(SenderToPhone.java:73)
    at java.util.TimerThread.mainLoop(Unknown Source)
    at java.util.TimerThread.run(Unknown Source)

Will post any updates or solutions when and if I find any...

Original comment by dyavolo....@googlemail.com on 30 Aug 2012 at 1:57

GoogleCodeExporter commented 9 years ago
I have ACR122U-A9 and LG E610 running ICS-4.0.3
After i put phone on reader, reader starts beeping and blinking.
Why?

Original comment by denis.we...@gmail.com on 14 Sep 2012 at 10:04

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hello everyone. Currently working with ICS 4.0.4 Galaxy S3 and ACS122U 
(firmware 207). In my case, I managed to communicate the Galaxy S3 and the 
reader. The problem of null pointer, is terminal.isCardPresent (), can be fixed 
by changing terminal.waitForCardPresent(0). The result:
Get factory
Get terminals
Terminal name: ACS ACR122 0
card: PC/SC card in ACS ACR122 0, protocol T=1, state OK
Protocol:T=1
Called Procedure to Send data .. INITIATOR MODE
...
[DEBUG] {receiving [8 bytes]} 0xD5 0x41 0x00 0x83 0x44 0x01 0x90 0x00 
Finished

My problem is that it does not always work, I have often errors:
Exception in thread "Timer-0" java.lang.IllegalStateException: Card has been 
removed
at sun.security.smartcardio.CardImpl.checkState (Unknown Source)
at sun.security.smartcardio.ChannelImpl.checkClosed (Unknown Source)
at sun.security.smartcardio.ChannelImpl.transmit (Unknown Source)
at it.ismb.snep.IsmbSnepConnection.transceive (IsmbSnepConnection.java: 140),
or
Exception in thread "Timer-0" java.lang.ArrayIndexOutOfBoundsException
at it.ismb.snep.Util.appendToByteArray (Util.java: 98)
at it.ismb.snep.Util.subByteArray (Util.java: 119)
at it.ismb.snep.IsmbSnepConnection.transceive (IsmbSnepConnection.java: 156)
at it.ismb.snep.IsmbSnepConnection.rightProcedureEnhanced 
(IsmbSnepConnection.java: 172)
When conditions are accurate to the case in which everything works. Someone 
would know how could fix it?

Original comment by Carlos.b...@gmail.com on 26 Sep 2012 at 9:26

GoogleCodeExporter commented 9 years ago
Guys, same issue

the machine keeps beeping & flashing even after changing to waitForCardPresent

Original comment by helal.ha...@gmail.com on 13 Nov 2012 at 1:48

GoogleCodeExporter commented 9 years ago
I have the same issue. After running the app, I tried change "isCardPresent()" 
for "waitForCardPresent(MILIS)". After using that, the ACR122 is waiting for 
the terminal to approach, and when I do it, it begins beeping and blinking and 
the console just show me the following:

Get factory
Get terminals
Terminal name: ACS ACR122 0
card: PC/SC card in ACS ACR122 0, protocol T=1, state OK
Protocol:T=1
Called Procedure to Receive data .. INITIATOR MODE
[DEBUG] {sending   [23 bytes]} 0xFF 0x00 0x00 0x00 0x12 0xD4 0x56 0x01 0x02 
0x04 0x46 0x66 0x6D 0x01 0x01 0x10 0x03 0x02 0x00 0x01 0x04 0x01 0x96 
IN JUMP FOR DEP done..
it.ismb.snep.IsmbSnepException: problem with transmitting data
    at it.ismb.snep.IsmbSnepConnection.transceive(IsmbSnepConnection.java:143)
    at it.ismb.snep.IsmbSnepConnection.receivingProcedureEnhanced(IsmbSnepConnection.java:158)
    at it.ismb.snep.PhoneToSender$ThreadSender.run(PhoneToSender.java:91)
    at it.ismb.snep.PhoneToSender$InitiatorTask.run(PhoneToSender.java:74)
    at java.util.TimerThread.mainLoop(Timer.java:512)
    at java.util.TimerThread.run(Timer.java:462)
[DEBUG] {sending   [10 bytes]} 0xFF 0x00 0x00 0x00 0x05 0xD4 0x40 0x01 0x00 
0x00 
it.ismb.snep.IsmbSnepException: problem with transmitting data
    at it.ismb.snep.IsmbSnepConnection.transceive(IsmbSnepConnection.java:143)
    at it.ismb.snep.IsmbSnepConnection.receivingProcedureEnhanced(IsmbSnepConnection.java:174)
    at it.ismb.snep.PhoneToSender$ThreadSender.run(PhoneToSender.java:91)
    at it.ismb.snep.PhoneToSender$InitiatorTask.run(PhoneToSender.java:74)
    at java.util.TimerThread.mainLoop(Timer.java:512)
    at java.util.TimerThread.run(Timer.java:462)

Trying with Samsung Galaxy SIII(Android 4.1.1) and tablet Asus Nexus 7(Android 
4.2). Anyone knows the solution??? Thanks a lot!

Original comment by jorgerid...@gmail.com on 23 Nov 2012 at 12:57

GoogleCodeExporter commented 9 years ago
Hi, everyone I have the same problem with Samsung Galaxy SIII(Android 4.1.1) 
and tablet Asus Nexus 7(Android 4.2), please help. thank in advance.

Original comment by chivtim...@gmail.com on 7 Dec 2012 at 6:55

GoogleCodeExporter commented 9 years ago
Hello, the same issue with beeping and blinking... Does anyone solve the 
problem? In my case LG L9 (L760)

Original comment by maciej.k...@gmail.com on 5 Jan 2013 at 12:13

GoogleCodeExporter commented 9 years ago
Hi everyone. I am also having some problems. I am using Nexus S with Android 
4.1.2 and ACR122U A2. In my case I can't even connect the phone with the 
reader. I got the error in this line:

        card = terminal.connect("*");                        

And the output is: 

Get factory
Get terminals
Terminal name: ACS ACR122U 00 00
Available Commands: receive, send and quit
send
problem with connecting to reader
Exception in thread "main" java.lang.NullPointerException
    at it.ismb.snep.NfcReader.<init>(NfcReader.java:76)
    at it.ismb.snep.NfcReader.main(NfcReader.java:39)

Any solutions?
Regards.

Original comment by coreram...@gmail.com on 20 Jan 2013 at 5:23

GoogleCodeExporter commented 9 years ago
Same as previous comment. I get the same nullpointer with the Jan16 release on 
Win7 and an ACR122U A9 (1.1.2 driver):
Get factory
Get terminals
Terminal name: ACS ACR122 0
Available Commands: receive, send and quit
receive
Device not supported, only ACS ACR122 is supported now
Exception in thread "main" java.lang.NullPointerException
        at it.ismb.snep.NfcReader.<init>(NfcReader.java:87)
        at it.ismb.snep.NfcReader.main(NfcReader.java:39)

Original comment by par.u.ha...@gmail.com on 30 Jan 2013 at 12:29

GoogleCodeExporter commented 9 years ago
For comment no 15 and 16,
I got that same error,I think this is due to the < if 
(terminal.isCardPresent()) > check on line 69 of IsmbSnepConnectionTarget.java. 
You can change the code or place a card on the reader before executing the 
command to get pass this point. 
But I have the same issue majority of people are having here. Which is the 
reader continuously beeping when I place my NFC enabled Xperia S  with Android 
4.0.4 on the reader. I think this is not a problem with the java code which 
only uses the reader, but a problem with hardware compatibility of the reader 
and these problematic phones or as mentioned with the android version. It would 
be really helpful to many if someone can find and post why this is happening 
for these phones. I will keep searching myself and post if I find a reason.  

Original comment by samjayat...@gmail.com on 11 Feb 2013 at 12:13

GoogleCodeExporter commented 9 years ago
Hi, 
I'm happy to inform that I have found a solution to the problem I have been 
having. 
The problem was with the reader not properly changing to the target mode. In 
target mode the reader has a continuous yellow light on. I changed the client 
side java application to the nfctools implementation, where they use their own 
library. They set the reader to target mode successfully. Al the required 
resources can be found on this group. 
https://groups.google.com/forum/#!forum/nfc-developers
Now with the Xperia phone on the device with with the application launched I 
get the screen to touch to beam and from the reader side java client I can read 
the sent text data. 
:)
Thanks!

Original comment by samjayat...@gmail.com on 13 Feb 2013 at 11:57

GoogleCodeExporter commented 9 years ago
Hi samjamat...,
I have downloaded your code, this is a class, I added this class to the J2SE 
code. just like properties--> java bild path--> add class.

But I have same problem. LED beeps and blinks. Is your link right? can u send 
your code through email?

thanks a lot

leon

Original comment by imleihu...@googlemail.com on 13 Feb 2013 at 2:11

GoogleCodeExporter commented 9 years ago
Hey Samjamat, can you paste the exact lines of code which solved the problem 
for you. Many people are interested. 

Original comment by sharjeel...@gmail.com on 14 Feb 2013 at 10:56

GoogleCodeExporter commented 9 years ago
I have a sort of solution to this problem but I don't know why it works.

If you download the ACR122U SDK you can install the ACR122U Tool. Run this 
program. In the drop down menu, Reader Commands, click new connection and 
connect to your reader. Then do the same again. It will ask you to disconnect 
from the reader. Disconnect and then click cancel so that you do not connect 
again. Leave the program running and then run the ismb-snep-java. I have found 
that combining this with the waitForCardPresent(0) I can get it to work.

Does this help anyone? And if so do you know why it works? Does it set up some 
sort of environment that's important? 

My next issue is that I can only run the program once through, for example to 
send a message to the phone and then I need to unplug and reset the reader and 
repeat the process I did with the ACR122U Tool for it to work again which makes 
me think that something is being set on the reader and not unset. Again I don't 
know what.

When running the reader as an initiator sometimes the phone has to be reset 
with a power off, so whichever is the target seems to need to be reset.

Original comment by tiniest....@googlemail.com on 19 Feb 2013 at 12:56

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I manage to make it work without error, the 0X00 à the end of the init is 
mandatory as described in the pn532 datasheet it's the length of the  
historical byte

Original comment by charles....@gmail.com on 19 Mar 2013 at 2:10

GoogleCodeExporter commented 9 years ago
after several test, it's working nice with the nexus 4. Put the phone n th 
ereader, get a green light. launch the   program, no problem.
With galaxy s3, htc one X led continue blinking dan get message like card 
removed, there is a problem of detection of the phone. sometime i can get it 
working, but even playing with timing of the reader  gives no help.

Original comment by charles....@gmail.com on 21 Mar 2013 at 7:51

GoogleCodeExporter commented 9 years ago
Sorry, I only saw the replies just now. 
What I did was use the LlcpDemo provided by nfc tools. 
https://github.com/grundid/nfctools-examples
here you can download the demos I used. 
unzipping the nfctools-examples-master folder you can find the source for the 
LlcpDemo. I created an eclipse project to use that demo. (this project has to 
import the nfc-tools library)
then in the LLcpdemo constructor I explicitly set the terminal mode to target 
mode
this.initiatorMode = false;
and ran that. reader light turns yellow, no more beeping :)

Original comment by samjayat...@gmail.com on 22 Mar 2013 at 11:45

Attachments:

GoogleCodeExporter commented 9 years ago
No,it doesn't work, I used LLcpdemo but there is an another question  that led 
continue blinking but always green (before sometimes is orange sometimes is 
green

Original comment by hykm...@gmail.com on 22 Mar 2013 at 6:45

GoogleCodeExporter commented 9 years ago
hello,, i'm working with ACR122S NFC reader connected to my laptop via 
serial-to-usb cable. I try to run the LLcpdemo.java in Netbeans IDE because i 
want to communicate with an NFC android phone through the contactless interface 
of the reader.. but i got the following error when i run the LLcpdemo:

java.lang.IllegalArgumentException: no supported card terminal found
at 
org.nfctools.scio.TerminalHandler.getAvailableTerminal(TerminalHandler.java:58)
at 
org.nfctools.examples.TerminalUtils.getAvailableTerminal(TerminalUtils.java:34)
at 
org.nfctools.examples.TerminalUtils.getAvailableTerminal(TerminalUtils.java:26)

please help me to resolve this error, 
Thanks

Original comment by misterm...@gmail.com on 17 Apr 2013 at 12:58

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hello, my problem with ACR122U card I can not connect my Sony Xperia M.'m 
trying to read a message "beam" from an android application to the PC. In fact 
I have another device "motorola", which works OK and I can read the message. 
When I put the "motorola" in the reader, this sounds prizing a flashing green 
light. when I do the xperia nothing happens. The strange thing is that I 
downloaded nfctools-examples.jar (snepDemo mode) and it works, ie reads both 
devices without problems (I can read the message from the phone to the PC). I'm 
using eclipse, javax.smartcardio. 

Someone can help me with this problem?

Original comment by rodrigom...@gmail.com on 9 Jun 2014 at 2:17