NFCPY / libUSB écraser des exemples en cours d'exécution
Question
J'ai installé NFCPY, pyusb et libusb sur Mac Lion. J'utilise le bon lecteur de carte ACR122U NFC et quand j'ai essayé de courir l'un des exemples, il se bloque. Je sais que beaucoup de gens utilisent ce même lecteur NFCPY, je ne sais pas pourquoi il ne fonctionne pas pour moi.
Python n'imprime pas d'erreur, mais je peux voir cette trace de pile dans le fichier journal:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libusb-1.0.dylib 0x000000010f799bda darwin_reset_device + 10 (darwin_usb.c:1213)
1 libffi.dylib 0x00007fff87b2fe7c ffi_call_unix64 + 76
2 libffi.dylib 0x00007fff87b30ae9 ffi_call + 728
3 _ctypes.so 0x000000010f78033f _ctypes_callproc + 735
4 _ctypes.so 0x000000010f77afd2 0x10f777000 + 16338
5 org.python.python 0x000000010f360d32 PyObject_Call + 97
6 org.python.python 0x000000010f3e0f63 PyEval_EvalFrameEx + 14353
7 org.python.python 0x000000010f3e3cd8 PyEval_EvalCodeEx + 1996
8 org.python.python 0x000000010f381abf 0x10f359000 + 166591
9 org.python.python 0x000000010f360d32 PyObject_Call + 97
10 org.python.python 0x000000010f3e15ec PyEval_EvalFrameEx + 16026
11 org.python.python 0x000000010f3e3cd8 PyEval_EvalCodeEx + 1996
12 org.python.python 0x000000010f3e3e6c 0x10f359000 + 568940
13 org.python.python 0x000000010f3e0e0a PyEval_EvalFrameEx + 14008
14 org.python.python 0x000000010f3e3df7 0x10f359000 + 568823
15 org.python.python 0x000000010f3e0e0a PyEval_EvalFrameEx + 14008
16 org.python.python 0x000000010f3e3df7 0x10f359000 + 568823
17 org.python.python 0x000000010f3e0e0a PyEval_EvalFrameEx + 14008
18 org.python.python 0x000000010f3e3cd8 PyEval_EvalCodeEx + 1996
19 org.python.python 0x000000010f381abf 0x10f359000 + 166591
20 org.python.python 0x000000010f360d32 PyObject_Call + 97
21 org.python.python 0x000000010f36f6e9 0x10f359000 + 91881
22 org.python.python 0x000000010f360d32 PyObject_Call + 97
23 org.python.python 0x000000010f3ab484 0x10f359000 + 337028
24 org.python.python 0x000000010f3a5b7a 0x10f359000 + 314234
25 org.python.python 0x000000010f360d32 PyObject_Call + 97
26 org.python.python 0x000000010f3e0f63 PyEval_EvalFrameEx + 14353
27 org.python.python 0x000000010f3e3df7 0x10f359000 + 568823
28 org.python.python 0x000000010f3e0e0a PyEval_EvalFrameEx + 14008
29 org.python.python 0x000000010f3e3cd8 PyEval_EvalCodeEx + 1996
30 org.python.python 0x000000010f3e3e6c 0x10f359000 + 568940
31 org.python.python 0x000000010f3e0e0a PyEval_EvalFrameEx + 14008
32 org.python.python 0x000000010f3e3cd8 PyEval_EvalCodeEx + 1996
33 org.python.python 0x000000010f381abf 0x10f359000 + 166591
34 org.python.python 0x000000010f360d32 PyObject_Call + 97
35 org.python.python 0x000000010f36f6e9 0x10f359000 + 91881
36 org.python.python 0x000000010f360d32 PyObject_Call + 97
37 org.python.python 0x000000010f3ab484 0x10f359000 + 337028
38 org.python.python 0x000000010f3a5b7a 0x10f359000 + 314234
39 org.python.python 0x000000010f360d32 PyObject_Call + 97
40 org.python.python 0x000000010f3e0f63 PyEval_EvalFrameEx + 14353
41 org.python.python 0x000000010f3e3df7 0x10f359000 + 568823
42 org.python.python 0x000000010f3e0e0a PyEval_EvalFrameEx + 14008
43 org.python.python 0x000000010f3e3cd8 PyEval_EvalCodeEx + 1996
44 org.python.python 0x000000010f3e3d4d PyEval_EvalCode + 54
45 org.python.python 0x000000010f3fb08f 0x10f359000 + 663695
46 org.python.python 0x000000010f3fb14f PyRun_FileExFlags + 157
47 org.python.python 0x000000010f3fc2a2 PyRun_SimpleFileExFlags + 392
48 org.python.python 0x000000010f40c2af Py_Main + 2715
49 org.python.python 0x000000010f34ee88 0x10f34e000 + 3720
Thread 1:: org.libusb.device-detach
0 libsystem_kernel.dylib 0x00007fff90e2967a mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff90e28d71 mach_msg + 73
2 com.apple.CoreFoundation 0x00007fff90082b6c __CFRunLoopServiceMachPort + 188
3 com.apple.CoreFoundation 0x00007fff9008b2d4 __CFRunLoopRun + 1204
4 com.apple.CoreFoundation 0x00007fff9008aae6 CFRunLoopRunSpecific + 230
5 com.apple.CoreFoundation 0x00007fff9009a7ff CFRunLoopRun + 95
6 libusb-1.0.dylib 0x000000010f79e997 event_thread_main + 631 (darwin_usb.c:369)
7 libsystem_c.dylib 0x00007fff903888bf _pthread_start + 335
8 libsystem_c.dylib 0x00007fff9038bb75 thread_start + 13
Thread 2:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff90e2b7e6 kevent + 10
1 libdispatch.dylib 0x00007fff92d9e5be _dispatch_mgr_invoke + 923
2 libdispatch.dylib 0x00007fff92d9d14e _dispatch_mgr_thread + 54
Thread 3:
0 libsystem_kernel.dylib 0x00007fff90e2b192 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff9038a594 _pthread_wqthread + 758
2 libsystem_c.dylib 0x00007fff9038bb85 start_wqthread + 13
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x000000010f7a2320 rbx: 0x0000000000000000 rcx: 0x000000010f985f80 rdx: 0x0000000000000000
rdi: 0x0000000000000000 rsi: 0x0000000000000001 rbp: 0x00007fff6ef4baa0 rsp: 0x00007fff6ef4ba90
r8: 0x000000010f48e840 r9: 0x0000000000000000 r10: 0x00007fff6ef4ba00 r11: 0x000000010f795340
r12: 0xffffffffffffffff r13: 0x0000000000000001 r14: 0x0000000000000000 r15: 0x00007fff6ef4bab0
rip: 0x000000010f799bda rfl: 0x0000000000010246 cr2: 0x0000000000000058
Logical CPU: 1
Toute aide serait très apprécié, je suis coincé avec cela pendant plusieurs jours
La solution
la source de darwin_reset_device()
dans libusb, et compte tenu de la précocité de la fonction, il se bloque (seulement 10 octets), je suppose que soit dev_handle
ou dev_handle->dev
étant passé à darwin_reset_device()
est NULL.
Comprendre pourquoi cela se produit est compliqué - il y a beaucoup de code et couches pour Dépanner (libusb, pyusb, nfcpy). Peut-être que vous pouvez savoir si quelqu'un est en cours d'exécution avec succès d'autre nfcpy sur Lion, et ce qu'ils font différemment (versions Xcode, version nfcpy, etc.)
Une autre suggestion (de mon expérience avec les pilotes USB sur le Mac): unplug tous périphérique USB connecté à votre ordinateur. Cela inclut toutes les souris tiers / claviers.
Autres conseils
Les meilleurs outils pour travailler avec le ACR122U et python sont pyscard et RFIDIOt , qui est un wrapper pour pyscard et libnfc. pyscard peut gérer assez bien, voici un exemple:
http://ludovicrousseau.blogspot.com. br / 2010/04 / PCSC-échantillon en python.html