In order to have control over how many bytes are read or written the device needs to be opened in unbuffered mode.
Signed-off-by: Tadeusz Struk tadeusz.struk@intel.com ---
v2: - Changed subject tags to selftests/tpm2: --- tools/testing/selftests/tpm2/tpm2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/tpm2/tpm2.py b/tools/testing/selftests/tpm2/tpm2.py index 40ea95ce2ead..c2b9f2b1a0ac 100644 --- a/tools/testing/selftests/tpm2/tpm2.py +++ b/tools/testing/selftests/tpm2/tpm2.py @@ -357,9 +357,9 @@ class Client: self.flags = flags
if (self.flags & Client.FLAG_SPACE) == 0: - self.tpm = open('/dev/tpm0', 'r+b') + self.tpm = open('/dev/tpm0', 'r+b', buffering=0) else: - self.tpm = open('/dev/tpmrm0', 'r+b') + self.tpm = open('/dev/tpmrm0', 'r+b', buffering=0)
def close(self): self.tpm.close()