From d1c643a591857bfe28ab044755de5df622ccccf1 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Sat, 30 Sep 2023 14:15:50 +0200 Subject: [PATCH] Matter tentative fix for SmartThings (#19620) --- .../src/embedded/Matter_Session.be | 8 ++-- .../src/solidify/solidified_Matter_Session.h | 40 +++++++++++++------ 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Session.be b/lib/libesp32/berry_matter/src/embedded/Matter_Session.be index dd17a0df0..2696d753a 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Session.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Session.be @@ -256,10 +256,10 @@ class Matter_Session : Matter_Expirable def get_fabric_id() return self._fabric.fabric_id end def get_fabric_index() return self._fabric ? self._fabric.fabric_index : nil end def get_device_id() return self._fabric ? self._fabric.device_id : nil end - def get_fabric_compressed() return self._fabric.fabric_compressed end - def get_fabric_label() return self._fabric.fabric_label end - def get_admin_subject() return self._fabric.admin_subject end - def get_admin_vendor() return self._fabric.admin_vendor end + def get_fabric_compressed() return self._fabric ? self._fabric.fabric_compressed : nil end + def get_fabric_label() return self._fabric ? self._fabric.fabric_label : nil end + def get_admin_subject() return self._fabric ? self._fabric.admin_subject : nil end + def get_admin_vendor() return self._fabric ? self._fabric.admin_vendor : nil end ############################################################# # Get operational key pair (private key) diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Session.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Session.h index b0e498421..cd1f28427 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Session.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Session.h @@ -811,10 +811,14 @@ be_local_closure(Matter_Session_get_admin_subject, /* name */ }), be_str_weak(get_admin_subject), &be_const_str_solidified, - ( &(const binstruction[ 3]) { /* code */ + ( &(const binstruction[ 7]) { /* code */ 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x88040301, // 0001 GETMBR R1 R1 K1 - 0x80040200, // 0002 RET 1 R1 + 0x78060002, // 0001 JMPF R1 #0005 + 0x88040100, // 0002 GETMBR R1 R0 K0 + 0x88040301, // 0003 GETMBR R1 R1 K1 + 0x70020000, // 0004 JMP #0006 + 0x4C040000, // 0005 LDNIL R1 + 0x80040200, // 0006 RET 1 R1 }) ) ); @@ -840,10 +844,14 @@ be_local_closure(Matter_Session_get_fabric_compressed, /* name */ }), be_str_weak(get_fabric_compressed), &be_const_str_solidified, - ( &(const binstruction[ 3]) { /* code */ + ( &(const binstruction[ 7]) { /* code */ 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x88040301, // 0001 GETMBR R1 R1 K1 - 0x80040200, // 0002 RET 1 R1 + 0x78060002, // 0001 JMPF R1 #0005 + 0x88040100, // 0002 GETMBR R1 R0 K0 + 0x88040301, // 0003 GETMBR R1 R1 K1 + 0x70020000, // 0004 JMP #0006 + 0x4C040000, // 0005 LDNIL R1 + 0x80040200, // 0006 RET 1 R1 }) ) ); @@ -1261,10 +1269,14 @@ be_local_closure(Matter_Session_get_fabric_label, /* name */ }), be_str_weak(get_fabric_label), &be_const_str_solidified, - ( &(const binstruction[ 3]) { /* code */ + ( &(const binstruction[ 7]) { /* code */ 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x88040301, // 0001 GETMBR R1 R1 K1 - 0x80040200, // 0002 RET 1 R1 + 0x78060002, // 0001 JMPF R1 #0005 + 0x88040100, // 0002 GETMBR R1 R0 K0 + 0x88040301, // 0003 GETMBR R1 R1 K1 + 0x70020000, // 0004 JMP #0006 + 0x4C040000, // 0005 LDNIL R1 + 0x80040200, // 0006 RET 1 R1 }) ) ); @@ -1481,10 +1493,14 @@ be_local_closure(Matter_Session_get_admin_vendor, /* name */ }), be_str_weak(get_admin_vendor), &be_const_str_solidified, - ( &(const binstruction[ 3]) { /* code */ + ( &(const binstruction[ 7]) { /* code */ 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x88040301, // 0001 GETMBR R1 R1 K1 - 0x80040200, // 0002 RET 1 R1 + 0x78060002, // 0001 JMPF R1 #0005 + 0x88040100, // 0002 GETMBR R1 R0 K0 + 0x88040301, // 0003 GETMBR R1 R1 K1 + 0x70020000, // 0004 JMP #0006 + 0x4C040000, // 0005 LDNIL R1 + 0x80040200, // 0006 RET 1 R1 }) ) );