Skip to content

Commit d5fdba9

Browse files
committed
Return bytearray objects
1 parent c59885c commit d5fdba9

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

adafruit_usb_host_descriptors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def get_device_descriptor(device):
8888
get_descriptor(device, DESC_DEVICE, 0, buf)
8989
full_buf = array.array("B", bytearray(buf[0]))
9090
get_descriptor(device, DESC_DEVICE, 0, full_buf)
91-
return full_buf
91+
return bytearray(full_buf)
9292

9393

9494
def get_configuration_descriptor(device, index):
@@ -100,7 +100,7 @@ def get_configuration_descriptor(device, index):
100100
wTotalLength = struct.unpack("<xxH", buf)[0]
101101
full_buf = array.array("B", bytearray(wTotalLength))
102102
get_descriptor(device, DESC_CONFIGURATION, index, full_buf)
103-
return full_buf
103+
return bytearray(full_buf)
104104

105105

106106
def get_report_descriptor(device, interface_num, length):
@@ -122,7 +122,7 @@ def get_report_descriptor(device, interface_num, length):
122122
interface_num,
123123
buf,
124124
)
125-
return buf
125+
return bytearray(buf)
126126
except usb.core.USBError as e:
127127
print(f"Failed to read Report Descriptor: {e}")
128128
return None

0 commit comments

Comments
 (0)