Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00025
00026
00027
00028
00029 #ifdef HAVE_CONFIG_H
00030 # include "config.h"
00031 #endif // HAVE_CONFIG_H
00032
00033 #include <stdlib.h>
00034
00035 #include "../drivers.h"
00036 #include <nfc/nfc-messages.h>
00037
00038 nfc_device_desc_t *
00039 pn533_usb_pick_device (void)
00040 {
00041 nfc_device_desc_t *pndd;
00042
00043 if ((pndd = malloc (sizeof (*pndd)))) {
00044 size_t szN;
00045
00046 if (!pn533_usb_list_devices (pndd, 1, &szN)) {
00047 DBG ("%s", "pn533_usb_list_devices failed");
00048 free (pndd);
00049 return NULL;
00050 }
00051
00052 if (szN == 0) {
00053 DBG ("%s", "No device found");
00054 free (pndd);
00055 return NULL;
00056 }
00057 }
00058
00059 return pndd;
00060 }
00061
00062 bool
00063 pn533_usb_list_devices (nfc_device_desc_t pnddDevices[], size_t szDevices, size_t * pszDeviceFound)
00064 {
00065
00066 usb_candidate_t candidates[] = {
00067 { 0x04CC, 0x2533 },
00068 { 0x04E6, 0x5591 },
00069 { 0x1FD3, 0x0608 }
00070 };
00071
00072 return pn53x_usb_list_devices (&pnddDevices[0], szDevices, pszDeviceFound, &candidates[0],
00073 sizeof (candidates) / sizeof (usb_candidate_t), PN533_USB_DRIVER_NAME);
00074 }
00075
00076 nfc_device_t *
00077 pn533_usb_connect (const nfc_device_desc_t * pndd)
00078 {
00079 return pn53x_usb_connect (pndd, pndd->acDevice, NC_PN533);
00080 }
00081
00082 void
00083 pn533_usb_init (nfc_device_t * pnd)
00084 {
00085 usb_spec_t* pus = (usb_spec_t*) pnd->nds;
00086 DBG ("pus->uc.idVendor == 0x%04x, pus->uc.idProduct == 0x%04x", pus->uc.idVendor, pus->uc.idProduct);
00087 if ((pus->uc.idVendor == 0x1FD3) && (pus->uc.idProduct == 0x0608)) {
00088 DBG ("ASK LoGO initialization.");
00089 pn53x_set_reg (pnd, 0x6106, 0xFF, 0x1B);
00090 pn53x_set_reg (pnd, 0x6306, 0xFF, 0x14);
00091 pn53x_set_reg (pnd, 0xFFFD, 0xFF, 0x37);
00092 pn53x_set_reg (pnd, 0xFFB0, 0xFF, 0x3B);
00093 }
00094 }
00095