1 /* 2 * Copyright (c) 2018-2023 O.S.Systems 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <string.h> 8 9 #include <zephyr/drivers/hwinfo.h> 10 11 #include "updatehub_device.h" 12 updatehub_get_device_identity(char * id,int id_max_len)13bool updatehub_get_device_identity(char *id, int id_max_len) 14 { 15 uint8_t hwinfo_id[DEVICE_ID_BIN_MAX_SIZE]; 16 ssize_t length; 17 18 length = hwinfo_get_device_id(hwinfo_id, DEVICE_ID_BIN_MAX_SIZE); 19 if (length <= 0) { 20 return false; 21 } 22 23 memset(id, 0, id_max_len); 24 length = bin2hex(hwinfo_id, (size_t)length, id, id_max_len); 25 26 return length > 0; 27 } 28