Skip to content

Commit 5fc39f3

Browse files
committed
Don't open /dev/cros_ec automatically
1 parent 72a0671 commit 5fc39f3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cros_ec_python/devices/dev.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,14 @@ class CrosEcDev(CrosEcClass):
4444
Class to interact with the EC using the Linux cros_ec device.
4545
"""
4646

47-
def __init__(self, fd=open("/dev/cros_ec", "wb", buffering=0), memmap_ioctl: bool = True):
47+
def __init__(self, fd=None, memmap_ioctl: bool = True):
4848
"""
4949
Initialise the EC using the Linux cros_ec device.
5050
:param fd: Use a custom file description, opens /dev/cros_ec by default.
5151
:param memmap_ioctl: Use ioctl for memmap (default), if False the READ_MEMMAP command will be used instead.
5252
"""
53+
if fd is None:
54+
fd = open("/dev/cros_ec", "wb", buffering=0)
5355
self.fd = fd
5456
self.memmap_ioctl = memmap_ioctl
5557

0 commit comments

Comments
 (0)