From dc06df358e5b6e4a2b6f73f78b73651a349be65d Mon Sep 17 00:00:00 2001 From: Frank Zhong Date: Fri, 2 Feb 2024 17:22:05 +0000 Subject: [PATCH 1/3] Add mid --- knx_iot_virtual_pb.c | 9 ++++++++- knx_iot_virtual_sa.c | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/knx_iot_virtual_pb.c b/knx_iot_virtual_pb.c index 0b51e2d..8bb594b 100644 --- a/knx_iot_virtual_pb.c +++ b/knx_iot_virtual_pb.c @@ -431,7 +431,14 @@ app_init(void) /* set the firmware version 0.7.0 */ oc_core_set_device_fwv(0, 0, 7, 0); - + + char mid[20]; + strncpy(mid, g_serial_number, 5); // mid = first 4 digits of sn + mid[4] = '\0'; + long int mid_num = strtol(mid, NULL, 16); + + /* manufactorer id */ + oc_core_ /* set the hardware type*/ // 123456789012 diff --git a/knx_iot_virtual_sa.c b/knx_iot_virtual_sa.c index 1e1d40c..1905061 100644 --- a/knx_iot_virtual_sa.c +++ b/knx_iot_virtual_sa.c @@ -475,6 +475,14 @@ app_init(void) /* set the firmware version 0.7.0 */ oc_core_set_device_fwv(0, 0, 7, 0); + + char mid[20]; + strncpy(mid, g_serial_number, 5); // mid = first 4 digits of sn + mid[4] = '\0'; + long int mid_num = strtol(mid, NULL, 16); + + /* manufactorer id */ + oc_core_set_device_mid(0, (uint32_t)mid_num); /* set the hardware type*/ // 123456789012 From a9c5585903ce4d261ec068195a66c8544587a20a Mon Sep 17 00:00:00 2001 From: Frank Zhong Date: Fri, 2 Feb 2024 17:23:46 +0000 Subject: [PATCH 2/3] Fix mid char array size --- knx_iot_virtual_pb.c | 2 +- knx_iot_virtual_sa.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/knx_iot_virtual_pb.c b/knx_iot_virtual_pb.c index 8bb594b..07c0b40 100644 --- a/knx_iot_virtual_pb.c +++ b/knx_iot_virtual_pb.c @@ -432,7 +432,7 @@ app_init(void) /* set the firmware version 0.7.0 */ oc_core_set_device_fwv(0, 0, 7, 0); - char mid[20]; + char mid[5]; strncpy(mid, g_serial_number, 5); // mid = first 4 digits of sn mid[4] = '\0'; long int mid_num = strtol(mid, NULL, 16); diff --git a/knx_iot_virtual_sa.c b/knx_iot_virtual_sa.c index 1905061..6638023 100644 --- a/knx_iot_virtual_sa.c +++ b/knx_iot_virtual_sa.c @@ -476,7 +476,7 @@ app_init(void) /* set the firmware version 0.7.0 */ oc_core_set_device_fwv(0, 0, 7, 0); - char mid[20]; + char mid[5]; strncpy(mid, g_serial_number, 5); // mid = first 4 digits of sn mid[4] = '\0'; long int mid_num = strtol(mid, NULL, 16); From 4a1ec8e7e490ed5363f133bacff402e3efd68557 Mon Sep 17 00:00:00 2001 From: Frank Zhong Date: Fri, 2 Feb 2024 17:24:22 +0000 Subject: [PATCH 3/3] Fix --- knx_iot_virtual_pb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knx_iot_virtual_pb.c b/knx_iot_virtual_pb.c index 07c0b40..541c2c1 100644 --- a/knx_iot_virtual_pb.c +++ b/knx_iot_virtual_pb.c @@ -438,7 +438,7 @@ app_init(void) long int mid_num = strtol(mid, NULL, 16); /* manufactorer id */ - oc_core_ + oc_core_set_device_mid(0, (uint32_t)mid_num); /* set the hardware type*/ // 123456789012