Open Lesterpig opened 8 years ago
Why don't you do any error checking, especially with the type assertions? Please make sure that all type assertions are successful. In the meanwhile, let me check what went wrong.
The code hasn't been really tested (cf. README), let me see what I missed in there.
It seems like I get a NULL pointer somewhere. I should definitely check for that in case someone forgets to check for errors.
Thank you for you answer.
Here is an updated version with its result:
func Connect(device nfc.Device) (*freefare.DESFireTag, error) {
// Scan for tags
modulation := nfc.Modulation{
Type: nfc.ISO14443a,
BaudRate: nfc.Nbr424,
}
nfcTag, err := device.InitiatorSelectPassiveTarget(modulation, nil)
fmt.Println(err)
isoTarget, ok := nfcTag.(*nfc.ISO14443aTarget)
fmt.Println(ok)
rawTag, err := freefare.NewTag(device, isoTarget)
fmt.Println(err)
tag := rawTag.(freefare.DESFireTag)
fmt.Println(tag)
err = tag.Connect()
if err != nil {
return nil, err
}
return &tag, nil
}
<nil>
true
<nil>
Mifare DESFire
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x2 addr=0x7f53647f9c47 pc=0x7f537bb9e9b8]
Well, okay, that's interesting. Let me debug further.
Hi,
I'm having some issues dealing with libfreefare. I would like to transform a nfc.ISO14443aTarget into a freefare.Tag to use the SelectPassiveTarget feature of libnfc.
Here is my code:
Am I doing things right here? The result is a segfault at:
Thank you for your help!