aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hwsim/rfkill.py
diff options
context:
space:
mode:
authorJouni Malinen <jouni@codeaurora.org>2021-01-15 16:10:34 (GMT)
committerJouni Malinen <j@w1.fi>2021-01-15 16:10:34 (GMT)
commitf34493f2a875208120b8ee9f25d4bddef150adb6 (patch)
treebc2158246ac3eea208eb3f7297b9a5425ff0bb92 /tests/hwsim/rfkill.py
parent8f589729428e44d8b323d0749e34ccfcce1fc979 (diff)
downloadhostap-f34493f2a875208120b8ee9f25d4bddef150adb6.zip
hostap-f34493f2a875208120b8ee9f25d4bddef150adb6.tar.gz
hostap-f34493f2a875208120b8ee9f25d4bddef150adb6.tar.bz2
tests: Fix rfkill testing with updated kernel
Kernel commit 14486c82612a ("rfkill: add a reason to the HW rfkill state") added an extra byte to the end of the rfkill events and that confused the read loop here since python tried to buffer the results from multiple read() calls into the local buffer that then delivered the extra octets in consecutive events. Fix this by disabling buffering for these reads. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
Diffstat (limited to 'tests/hwsim/rfkill.py')
-rwxr-xr-xtests/hwsim/rfkill.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/hwsim/rfkill.py b/tests/hwsim/rfkill.py
index f08cf50..72b2527 100755
--- a/tests/hwsim/rfkill.py
+++ b/tests/hwsim/rfkill.py
@@ -126,7 +126,7 @@ class RFKill(object):
@classmethod
def list(cls):
res = []
- rfk = open('/dev/rfkill', 'rb')
+ rfk = open('/dev/rfkill', 'rb', buffering=0)
fd = rfk.fileno()
flgs = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, flgs | os.O_NONBLOCK)