nfcpy with touchatag ACS ACR122U

Asked by Ambica Pawan Khandavilli

Hi ,

I was trying the steps in the tutorial to connect to a reader.
This was the error that was thrown.

Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import nfc
>>> clf = nfc.ContactlessFrontend()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "nfc/clf.py", line 42, in __init__
    self.dev = dev.connect(path)
  File "nfc/dev/__init__.py", line 102, in connect
    return driver.init(dev)
  File "nfc/dev/acr122_usb.py", line 107, in init
    bus = acr122_usb(usb_dev)
  File "nfc/dev/acr122_usb.py", line 69, in __init__
    self.dh.reset()
usb.USBError: could not reset: Operation not permitted

Is this a problem with the version of libusb installed ?

I ran a pcsc_scan and this is the output

 Reader 0: ACS ACR122U 00 00
  Card state: Card inserted,
  ATR: 3B BE 95 00 00 41 03 00 00 00 00 00 00 00 00 00 02 90 00

ATR: 3B BE 95 00 00 41 03 00 00 00 00 00 00 00 00 00 02 90 00
+ TS = 3B --> Direct Convention
+ T0 = BE, Y(1): 1011, K: 14 (historical bytes)
  TA(1) = 95 --> Fi=512, Di=16, 32 cycles/ETU
    125000 bits/s at 4 MHz, fMax for Fi = 5 MHz => 156250 bits/s
  TB(1) = 00 --> VPP is not electrically connected
  TD(1) = 00 --> Y(i+1) = 0000, Protocol T = 0
-----
+ Historical bytes: 41 03 00 00 00 00 00 00 00 00 00 02 90 00
  Category indicator byte: 41 (proprietary format)

Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
3B BE 95 00 00 41 03 00 00 00 00 00 00 00 00 00 02 90 00
 touchatag SAM card

Thanks a bunch for the help
Pawan

Question information

Language:
English Edit question
Status:
Answered
For:
nfcpy Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Stephen Tiedemann (stephen-tiedemann) said :
#1

I guess it's because you have insufficient access rights for the acr122 usb device, this is the normal case unless udev rules are configured. You can try running the interpreter as superuser "sudo python" but be careful. Apart from that I shall say that the documentation you've found is still very much under development and incomplete.

Revision history for this message
Roman Kochanek (roman-kochanek-android) said :
#2

Same problem here w/ touchatag aka ACR122U.

Revision: latest trunk (96)

Logs:

~/nfc/nfcpy$ python

Python 2.7.2+ (default, Oct 4 2011, 20:03:08)

[GCC 4.6.1] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import nfc

>>> clf = nfc.ContactlessFrontend()

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "nfc/clf.py", line 42, in __init__

    self.dev = dev.connect(path)

  File "nfc/dev/__init__.py", line 102, in connect

    return driver.init(dev)

  File "nfc/dev/acr122_usb.py", line 107, in init

    bus = acr122_usb(usb_dev)

  File "nfc/dev/acr122_usb.py", line 69, in __init__

    self.dh.reset()

usb.USBError: could not reset: Operation not permitted

sudo python

Python 2.7.2+ (default, Oct 4 2011, 20:03:08)

[GCC 4.6.1] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import nfc

>>> clf = nfc.ContactlessFrontend()

-110

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "nfc/clf.py", line 42, in __init__

    self.dev = dev.connect(path)

  File "nfc/dev/__init__.py", line 102, in connect

    return driver.init(dev)

  File "nfc/dev/acr122_usb.py", line 108, in init

    dev = acr122(bus)

  File "nfc/dev/pn53x.py", line 113, in __init__

    ic, ver, rev, support = self.get_firmware_version()

  File "nfc/dev/pn53x.py", line 186, in get_firmware_version

    rsp = self.command(0x02)

  File "nfc/dev/acr122_usb.py", line 45, in command

    self.bus.write(frame)

  File "nfc/dev/pn53x_usb.py", line 60, in write

    self.dh.bulkWrite(self.usb_out, frame)

usb.USBError: Connection timed out

>>>

Environment:
~/nfc/nfcpy$ python

Python 2.7.2+ (default, Oct 4 2011, 20:03:08)

[GCC 4.6.1] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import nfc

>>> clf = nfc.ContactlessFrontend()

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "nfc/clf.py", line 42, in __init__

    self.dev = dev.connect(path)

  File "nfc/dev/__init__.py", line 102, in connect

    return driver.init(dev)

  File "nfc/dev/acr122_usb.py", line 107, in init

    bus = acr122_usb(usb_dev)

  File "nfc/dev/acr122_usb.py", line 69, in __init__

    self.dh.reset()

usb.USBError: could not reset: Operation not permitted

sudo python

Python 2.7.2+ (default, Oct 4 2011, 20:03:08)

[GCC 4.6.1] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import nfc

>>> clf = nfc.ContactlessFrontend()

-110

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "nfc/clf.py", line 42, in __init__

    self.dev = dev.connect(path)

  File "nfc/dev/__init__.py", line 102, in connect

    return driver.init(dev)

  File "nfc/dev/acr122_usb.py", line 108, in init

    dev = acr122(bus)

  File "nfc/dev/pn53x.py", line 113, in __init__

    ic, ver, rev, support = self.get_firmware_version()

  File "nfc/dev/pn53x.py", line 186, in get_firmware_version

    rsp = self.command(0x02)

  File "nfc/dev/acr122_usb.py", line 45, in command

    self.bus.write(frame)

  File "nfc/dev/pn53x_usb.py", line 60, in write

    self.dh.bulkWrite(self.usb_out, frame)

usb.USBError: Connection timed out

>>>

dpkg -l | grep libusb*

ii libusb-0.1-4 2:0.1.12-18 userspace USB programming library

ii libusb-1.0-0 2:1.0.8-4 userspace USB programming library

ii libusb-dev 2:0.1.12-18 userspace USB programming library development files

pyUSB: 0.4.3
Python: 2.7.2
Ubuntu: 11.10 in a virtual machine

Output nfc-list (libnfc) w/ a mifare classic on the reader:

~/nfc/libnfc-1.5.0/examples$ ./nfc-list

/home/romank/nfc/libnfc-1.5.0/examples/.libs/lt-nfc-list use libnfc 1.5.0 (r1019)

lt-nfc-list: ERROR: Unable to read ACK

pn53x_check_communication: Operation timed-out

lt-nfc-list: ERROR: Unable to read ACK

pn53x_check_communication: Operation timed-out

Connected to NFC device: ACS ACR122U 00 00 / ACR122U103 - PN532 v1.6 (0x07)

1 ISO14443A passive target(s) found:

    ATQA (SENS_RES): 00 04

       UID (NFCID1): ae e0 4b 9a

      SAK (SEL_RES): 08

Further question: Could you suggest me a working environment in order to run the examples? I mean you have checked in the code for the ACR122U and therefore I think that you have a running environment at least.

Revision history for this message
Launchpad Janitor (janitor) said :
#3

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Stephen Tiedemann (stephen-tiedemann) said :
#4

Roman, I have an ACR122U203 with NFC logo printed and checked that it works well under Ubuntu 11.10 (I was also using it under 11.04) I don't know how much a tikitag does differ but as seen from your log of nfc-list the tikitag seems to have a PN532 v1.6, whereas my ACR122U203 sports a PN532 v1.4 chipset. I do not have seen documentation for a PN532 v1.6, only v1.2 and v1.4. Just checking Google for "pn532 v1.4" I found this discussion http://www.libnfc.org/community/topic/179/touchatag-with-pn532-v106/.

For python usb support I'm using the stock python-usb module that comes with Ubuntu, the package is at version 0.4.2-2build1 for an Ubuntu 11.10 (sudo apt-get install python-usb). I have the same libusb installed as your listing shows. from that point of view anything should be working (I don't believe that pyUSB 0.4.3 really makes a difference). Most likely the hardware requires some different initialization but I can unfortunately not help much without a reader.

Revision history for this message
Stephen Tiedemann (stephen-tiedemann) said :
#5

Setting to answered to prevent Launchpad's automatic close.

Revision history for this message
Xitij Ritesh Patel (xpatel) said :
#6

I've run into the same issue on my virtualized Ubuntu 12.04 install. I don't have a tikitool reader, but it appears that my device also has a PN532 v1.6

Can you help with this problem?

Provide an answer of your own, or ask Ambica Pawan Khandavilli for more information if necessary.

To post a message you must log in.