Skip to content

Commit 88e06be

Browse files
committed
add readinto()
1 parent 74865a8 commit 88e06be

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

adafruit_usb_host_midi.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,14 @@ def read(self, size):
7171
self.start += size
7272
self._remaining -= size
7373
return b
74+
75+
def readinto(self, buf):
76+
b = self.read(len(buf))
77+
n = len(b)
78+
if n:
79+
buf[:] = b
80+
return n
81+
82+
def __repr__(self):
83+
# also idProduct/idVendor for vid/pid
84+
return "MIDI Device " + str(self.device.manufacturer) + "/" + str(self.device.product)

0 commit comments

Comments
 (0)