HwmonTempMain: revert the type of bus and address back to uint64_t
In I546e967abae7c0fb9fca645867e3037046037647, the type of bus and
address in HwmonTempMain were updated to size_t.
However, in some systems using i3c, the device name is composed by bus
number and the provisioned ID [1]. The provisioned ID is a 48-bit value
(MIPI I3C Basic, v1.1.1, section 5.1.4.1.1), which is greater than the
range of size_t on e.g. 32-bit ARM platforms. Thus, reverting the type
back to uint64_t.
[1] Linux in-turn uses this Provisioned ID to identify the device, and
exposes the Provisioned ID in the device name:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/i3c/master.c?h=v6.6#n1521
Tested:
- added unit test passed.
- can read temperature of the i3c devices from our system.
Change-Id: I6f0e73aaf5f8d28e4bdedbe85646373463f6707f
Signed-off-by: Tom Tung <shes050117@gmail.com>
diff --git a/tests/test_Utils.cpp b/tests/test_Utils.cpp
index 67fc3a5..59a4e13 100644
--- a/tests/test_Utils.cpp
+++ b/tests/test_Utils.cpp
@@ -212,6 +212,18 @@
EXPECT_FALSE(ret);
}
+TEST(GetDeviceBusAddrTest, I3CBusAddrValid)
+{
+ uint64_t bus = 0;
+ uint64_t provisionedId = 0;
+ std::string devName = "0-22400000001";
+
+ auto ret = getDeviceBusAddr(devName, bus, provisionedId);
+ EXPECT_TRUE(ret);
+ EXPECT_EQ(bus, 0);
+ EXPECT_EQ(provisionedId, 0x22400000001);
+}
+
TEST(GetDeviceBusAddrTest, AllValid)
{
size_t bus = 0;