-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use SelectPassiveTarget with libfreefare? #1
Comments
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
}
|
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!
The text was updated successfully, but these errors were encountered: