nfctype4: Add support for type4 B tags
authorSamuel Ortiz <sameo@linux.intel.com>
Thu, 30 May 2013 16:15:31 +0000 (18:15 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 30 May 2013 16:15:31 +0000 (18:15 +0200)
4a and 4b tags follow the same specs: the type 4 one from the NFC
Forum.

plugins/nfctype4.c

index 0a409f7..4798f5e 100644 (file)
@@ -1454,7 +1454,7 @@ static int nfctype4_format(uint32_t adapter_idx, uint32_t target_idx,
        return err;
 }
 
-static struct near_tag_driver type4_driver = {
+static struct near_tag_driver type4a_driver = {
        .type           = NFC_PROTO_ISO14443,
        .priority       = NEAR_TAG_PRIORITY_DEFAULT,
        .read           = nfctype4_read,
@@ -1463,18 +1463,34 @@ static struct near_tag_driver type4_driver = {
        .format         = nfctype4_format,
 };
 
+static struct near_tag_driver type4b_driver = {
+       .type           = NFC_PROTO_ISO14443_B,
+       .priority       = NEAR_TAG_PRIORITY_DEFAULT,
+       .read           = nfctype4_read,
+       .write          = nfctype4_write,
+       .check_presence = nfctype4_check_presence,
+       .format         = nfctype4_format,
+};
+
 static int nfctype4_init(void)
 {
+       int ret;
+
        DBG("");
 
-       return near_tag_driver_register(&type4_driver);
+       ret = near_tag_driver_register(&type4b_driver);
+       if (ret < 0)
+               return ret;
+
+       return near_tag_driver_register(&type4a_driver);
 }
 
 static void nfctype4_exit(void)
 {
        DBG("");
 
-       near_tag_driver_unregister(&type4_driver);
+       near_tag_driver_unregister(&type4a_driver);
+       near_tag_driver_unregister(&type4b_driver);
 }
 
 NEAR_PLUGIN_DEFINE(nfctype4, "NFC Forum Type 4 tags support", VERSION,