Update ath10k-fwencoder to run properly with Python 3

Explicit string encoding and decoding of UTF-8 strings was added
in order to make the script work with python 3.

Signed-off-by: Erik Stromdahl <erik.stromdahl@gmail.com>
This commit is contained in:
Erik Stromdahl 2020-07-06 09:38:21 +02:00
parent c2bd6f580d
commit 6fef42b8a8

View file

@ -195,7 +195,7 @@ class FirmwareContainer:
continue
max_set = i
index = i / 8
index = int(i / 8)
bit = i % 8
bytes[index] = bytes[index] | (1 << bit)
@ -245,7 +245,7 @@ class FirmwareContainer:
struct.pack_into('<B', padding, i, 0x77)
fmt = '<%dsb%ds' % (len(signature), padding_len)
struct.pack_into(fmt, self.buf, 0, signature, 0, padding.raw)
struct.pack_into(fmt, self.buf, 0, signature.encode('utf-8'), 0, padding.raw)
self.buf_len = length
def write(self, name):
@ -267,7 +267,7 @@ class FirmwareContainer:
(signature, null) = struct.unpack_from(fmt, self.buf, offset)
offset = offset + self.signature_len + 1
if signature != self.signature or null != 0:
if signature.decode('utf-8') != self.signature or null != 0:
logger.error("Invalid signature!")
return False
@ -577,7 +577,7 @@ def is_int(val):
def write_file(filename, buf):
f = open(filename, 'w')
f = open(filename, 'wb')
f.write(buf)
f.close