Skip to content

Commit

Permalink
Don't open /dev/cros_ec automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve-Tech committed Jul 12, 2024
1 parent 72a0671 commit 5fc39f3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cros_ec_python/devices/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ class CrosEcDev(CrosEcClass):
Class to interact with the EC using the Linux cros_ec device.
"""

def __init__(self, fd=open("/dev/cros_ec", "wb", buffering=0), memmap_ioctl: bool = True):
def __init__(self, fd=None, memmap_ioctl: bool = True):
"""
Initialise the EC using the Linux cros_ec device.
:param fd: Use a custom file description, opens /dev/cros_ec by default.
:param memmap_ioctl: Use ioctl for memmap (default), if False the READ_MEMMAP command will be used instead.
"""
if fd is None:
fd = open("/dev/cros_ec", "wb", buffering=0)
self.fd = fd
self.memmap_ioctl = memmap_ioctl

Expand Down

0 comments on commit 5fc39f3

Please sign in to comment.