diff mbox series

[10/14] helpers/mcu: fix packet too long error

Message ID 20230313094431.507952-11-tzungbi@kernel.org (mailing list archive)
State Handled Elsewhere
Headers show
Series cros-ec-tests: fix some exceptions and clean-ups | expand

Commit Message

Tzung-Bi Shih March 13, 2023, 9:44 a.m. UTC
sizeof(c_ulong) is 4 in some platforms.  However, EC_CMD_GET_FEATURES
returns 2 uint32[1].

Fix the following error from test execution:
> Traceback (most recent call last):
>   File "...cros/tests/cros_ec_rtc.py", line 12, in test_cros_ec_rtc_abi
>     if not is_feature_supported(EC_FEATURE_RTC):
>   File "...cros/helpers/mcu.py", line 126, in is_feature_supported
>     fcntl.ioctl(fh, EC_DEV_IOCXCMD, cmd)
> OSError: [Errno 90] Message too long

And the following error message from dmesg:
> cros-ec-spi spi2.0: packet too long (8 bytes, expected 4)

Use c_uint64 to explicitly specify the data size.

[1]: https://crrev.com/6bf531fc1c115b24e2148fc4e040081ef354cdf6/include/ec_commands.h#1594

Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
 cros/helpers/mcu.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/cros/helpers/mcu.py b/cros/helpers/mcu.py
index 27ce9ad5cc58..506730e71115 100644
--- a/cros/helpers/mcu.py
+++ b/cros/helpers/mcu.py
@@ -90,11 +90,11 @@  class ec_response_get_version(Structure):
     ]
 
 class ec_params_get_features(Structure):
-    _fields_ = [("in_data", c_ulong)]
+    _fields_ = [("in_data", c_uint64)]
 
 
 class ec_response_get_features(Structure):
-    _fields_ = [("out_data", c_ulong)]
+    _fields_ = [("out_data", c_uint64)]
 
 
 def EC_FEATURE_MASK_0(event_code):