Lines Matching +full:product +full:- +full:id
2 * Copyright (c) 2020-2022 Yubico AB. All rights reserved.
3 * Use of this source code is governed by a BSD-style
5 * SPDX-License-Identifier: BSD-2-Clause
63 uint64_t id; in copy_info() local
64 int ok = -1; in copy_info()
71 if (asprintf(&di->path, "%s/%s", FIDO_NFC_PREFIX, name) == -1) { in copy_info()
72 di->path = NULL; in copy_info()
75 if (nfc_is_fido(di->path) == false) { in copy_info()
76 fido_log_debug("%s: nfc_is_fido: %s", __func__, di->path); in copy_info()
79 if ((di->manufacturer = get_usb_attr(dev, "manufacturer")) == NULL) in copy_info()
80 di->manufacturer = strdup(""); in copy_info()
81 if ((di->product = get_usb_attr(dev, "product")) == NULL) in copy_info()
82 di->product = strdup(""); in copy_info()
83 if (di->manufacturer == NULL || di->product == NULL) in copy_info()
85 /* XXX assumes USB for vendor/product info */ in copy_info()
87 fido_to_uint64(str, 16, &id) == 0 && id <= UINT16_MAX) in copy_info()
88 di->vendor_id = (int16_t)id; in copy_info()
91 fido_to_uint64(str, 16, &id) == 0 && id <= UINT16_MAX) in copy_info()
92 di->product_id = (int16_t)id; in copy_info()
101 free(di->path); in copy_info()
102 free(di->manufacturer); in copy_info()
103 free(di->product); in copy_info()
117 int idx = -1; in sysnum_from_syspath()
197 sa.dev_idx = ctx->dev; in nfc_target_connect()
198 sa.target_idx = ctx->target; in nfc_target_connect()
201 if ((ctx->fd = socket(AF_NFC, SOCK_SEQPACKET | SOCK_CLOEXEC, in nfc_target_connect()
202 NFC_SOCKPROTO_RAW)) == -1) { in nfc_target_connect()
204 return -1; in nfc_target_connect()
206 if (connect(ctx->fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) { in nfc_target_connect()
208 if (close(ctx->fd) == -1) in nfc_target_connect()
210 ctx->fd = -1; in nfc_target_connect()
211 return -1; in nfc_target_connect()
224 if (ctx->fd != -1 && close(ctx->fd) == -1) in nfc_free()
226 if (ctx->nl != NULL) in nfc_free()
227 fido_nl_free(&ctx->nl); in nfc_free()
239 (ctx->nl = fido_nl_new()) == NULL) { in nfc_new()
244 ctx->fd = -1; in nfc_new()
245 ctx->dev = dev; in nfc_new()
265 if (fido_nl_power_nfc(ctx->nl, ctx->dev) < 0 || in fido_nfc_open()
266 fido_nl_get_nfc_target(ctx->nl, ctx->dev, &ctx->target) < 0 || in fido_nfc_open()
291 ctx->sigmask = *sigmask; in fido_nfc_set_sigmask()
292 ctx->sigmaskp = &ctx->sigmask; in fido_nfc_set_sigmask()
311 if (fido_hid_unix_wait(ctx->fd, ms, ctx->sigmaskp) < 0) { in fido_nfc_read()
313 return -1; in fido_nfc_read()
315 if ((r = readv(ctx->fd, iov, nitems(iov))) == -1) { in fido_nfc_read()
317 return -1; in fido_nfc_read()
321 return -1; in fido_nfc_read()
325 return -1; in fido_nfc_read()
328 r--; in fido_nfc_read()
344 return -1; in fido_nfc_write()
346 if ((r = write(ctx->fd, buf, len)) == -1) { in fido_nfc_write()
348 return -1; in fido_nfc_write()
352 return -1; in fido_nfc_write()