near_tag_io_cb cb);
int (*check_presence)(uint32_t adapter_idx, uint32_t target_idx,
near_tag_io_cb cb);
+ int (*format)(uint32_t adapter_idx, uint32_t target_idx,
+ near_tag_io_cb cb);
};
struct near_tag;
near_tag_io_cb cb)
{
GSList *list;
+ int err;
DBG("type 0x%x", tag->type);
DBG("driver type 0x%x", driver->type);
- if (driver->type == tag->type)
+ if (driver->type == tag->type) {
+ if (tag->blank == TRUE && driver->format != NULL) {
+ DBG("Blank tag detected, formatting");
+ err = driver->format(tag->adapter_idx,
+ tag->target_idx, NULL);
+
+ if (err < 0)
+ return err;
+
+ }
+
return driver->write(tag->adapter_idx, tag->target_idx,
ndef, cb);
+ }
}
return 0;