usb-device: Rename descriptor.append to extend.

Nitpicky change, but what it does is closer to the latter wrt bytearrays
and similar in Python.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
Angus Gratton 2024-04-03 15:32:34 +11:00
rodzic 744f8c4ea5
commit b876d149f2
1 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -164,14 +164,14 @@ class _Device:
# Determine the total length of the configuration descriptor, by making dummy
# calls to build the config descriptor
desc = Descriptor(None)
desc.append(initial_cfg)
desc.extend(initial_cfg)
for itf in itfs:
itf.desc_cfg(desc, 0, 0, [])
# Allocate the real Descriptor helper to write into it, starting
# after the standard configuration descriptor
desc = Descriptor(bytearray(desc.o))
desc.append(initial_cfg)
desc.extend(initial_cfg)
for itf in itfs:
itf.desc_cfg(desc, itf_num, ep_num, strs)
@ -603,8 +603,8 @@ class Descriptor:
struct.pack_into(fmt, self.b, offs, *args)
self.o = max(self.o, end)
def append(self, a):
# Append some bytes-like data to the descriptor
def extend(self, a):
# Extend the descriptor with some bytes-like data
if self.b:
self.b[self.o : self.o + len(a)] = a
self.o += len(a)