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 pn531_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 (!pn531_usb_list_devices (pndd, 1, &szN)) {
00047 DBG ("%s", "pn531_usb_list_devices failed");
00048 return NULL;
00049 }
00050
00051 if (szN == 0) {
00052 DBG ("%s", "No device found");
00053 return NULL;
00054 }
00055 }
00056 return pndd;
00057 }
00058
00059 bool
00060 pn531_usb_list_devices (nfc_device_desc_t pnddDevices[], size_t szDevices, size_t * pszDeviceFound)
00061 {
00062
00063 usb_candidate_t candidates[] = { {0x04CC, 0x0531}
00064 , {0x054c, 0x0193}
00065 };
00066
00067 return pn53x_usb_list_devices (&pnddDevices[0], szDevices, pszDeviceFound, &candidates[0],
00068 sizeof (candidates) / sizeof (usb_candidate_t), PN531_USB_DRIVER_NAME);
00069 }
00070
00071 nfc_device_t *
00072 pn531_usb_connect (const nfc_device_desc_t * pndd)
00073 {
00074 return pn53x_usb_connect (pndd, pndd->acDevice, NC_PN531);
00075 }