1111from ..commands .general import EC_CMD_READ_MEMMAP
1212from ..exceptions import ECError
1313
14+ __all__ = ["CrosEcDev" ]
15+
1416CROS_EC_IOC_MAGIC : Final = 0xEC
1517
1618
17- def _IOC (dir : int , type : int , nr : int , size : int ):
19+ def IOC (dir : int , type : int , nr : int , size : int ):
1820 """
1921 Create an ioctl command number.
2022 Based on the Linux kernels include/uapi/asm-generic/ioctl.h.
@@ -28,15 +30,15 @@ def _IOC(dir: int, type: int, nr: int, size: int):
2830 return dir << dir_shift | size << size_shift | type << type_shift | nr << nr_shift
2931
3032
31- def _IORW (type : int , nr : int , size : int ):
33+ def IORW (type : int , nr : int , size : int ):
3234 """
3335 Create an ioctl command number for read/write commands.
3436 Based on the Linux kernels include/uapi/asm-generic/ioctl.h.
3537 """
3638 none = 0
3739 write = 1
3840 read = 2
39- return _IOC ((read | write ), type , nr , size )
41+ return IOC ((read | write ), type , nr , size )
4042
4143
4244class CrosEcDev (CrosEcClass ):
@@ -99,7 +101,7 @@ def command(
99101 buf = bytearray (cmd + bytes (max (outsize , insize )))
100102 buf [len (cmd ): len (cmd ) + outsize ] = data
101103
102- CROS_EC_DEV_IOCXCMD = _IORW (CROS_EC_IOC_MAGIC , 0 , len (cmd ))
104+ CROS_EC_DEV_IOCXCMD = IORW (CROS_EC_IOC_MAGIC , 0 , len (cmd ))
103105 result = ioctl (self .fd , CROS_EC_DEV_IOCXCMD , buf )
104106
105107 if result < 0 :
@@ -125,7 +127,7 @@ def memmap(self, offset: Int32, num_bytes: Int32) -> bytes:
125127 if self .memmap_ioctl :
126128 data = struct .pack ("<II" , offset , num_bytes )
127129 buf = bytearray (data + bytes (num_bytes ))
128- CROS_EC_DEV_IOCRDMEM = _IORW (
130+ CROS_EC_DEV_IOCRDMEM = IORW (
129131 CROS_EC_IOC_MAGIC , 1 , len (data ) + EC_MEMMAP_SIZE + 1
130132 )
131133 try :
0 commit comments