File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -116,8 +116,8 @@ def ec_init(self) -> None:
116116
117117 # Request I/O permissions
118118 if (
119- (res := self .portio .ioperm (EC_LPC_ADDR_HOST_DATA , EC_MEMMAP_SIZE , True ))
120- or (res := self .portio .ioperm (EC_LPC_ADDR_HOST_CMD , EC_MEMMAP_SIZE , True ))
119+ (res := self .portio .ioperm (EC_LPC_ADDR_HOST_DATA , 1 , True ))
120+ or (res := self .portio .ioperm (EC_LPC_ADDR_HOST_CMD , 1 , True ))
121121 or (
122122 res := self .portio .ioperm (
123123 EC_LPC_ADDR_HOST_PACKET , EC_LPC_HOST_PACKET_SIZE , True
@@ -283,6 +283,7 @@ def ec_command_v3(
283283 for i in range (len (request )):
284284 csum += request [i ]
285285
286+ # Write checksum field so the entire packet sums to 0
286287 request [1 ] = (- csum ) & 0xFF
287288
288289 # Copy header
@@ -301,7 +302,7 @@ def ec_command_v3(
301302
302303 # Read back response and start checksum
303304 csum = 0
304- data_out = bytearray (1 + 1 + 2 + 2 + 2 )
305+ data_out = bytearray (struct . calcsize ( "BBHHH" ) )
305306 for i in range (len (data_out )):
306307 data_out [i ] = self .portio .inb (EC_LPC_ADDR_HOST_PACKET + i )
307308 csum += data_out [i ]
Original file line number Diff line number Diff line change 11import struct
22import warnings
33import ctypes
4+ import os
45from ctypes import wintypes
56from ctypes import util as ctypes_util
67
@@ -103,8 +104,12 @@ def _pawnio_close(self):
103104
104105 @staticmethod
105106 def detect () -> bool :
106- # TODO
107- return True
107+ """
108+ Detect if the PawnIO driver is installed.
109+ """
110+ return bool (ctypes_util .find_library ("PawnIOLib.dll" )) or os .path .exists (
111+ "C:\\ Program Files\\ PawnIO\\ PawnIOLib.dll"
112+ )
108113
109114 def ec_init (self ) -> None :
110115 self ._pawnio_open ()
You can’t perform that action at this time.
0 commit comments