mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 16:43:40 +02:00
Minor cleanups.
This commit is contained in:
parent
a5e40a9f25
commit
481b12293e
2 changed files with 3 additions and 1 deletions
|
|
@ -375,7 +375,7 @@ def bulk_read_packet(data_type=Answer, size=0x1000):
|
|||
rsize = size
|
||||
if size % msize:
|
||||
rsize = size - size % msize + msize
|
||||
data = data_type(self.handle.bulk_read(self.BULK_IN_EP, rsize)[:size])
|
||||
data = data_type(self.handle.bulk_read(self.BULK_IN_EP, rsize))
|
||||
if self.log_packets:
|
||||
self.log_packet(data, "Answer d->h")
|
||||
return data
|
||||
|
|
|
|||
|
|
@ -253,6 +253,8 @@ def bulk_read(self, endpoint, size, timeout=100):
|
|||
if rsize < 0:
|
||||
raise Error('Could not read ' + str(size) + ' bytes on the '\
|
||||
'bulk bus. Error code: ' + str(rsize))
|
||||
if rsize < size:
|
||||
arr = arr[:rsize]
|
||||
return arr
|
||||
|
||||
def bulk_write(self, endpoint, bytes, timeout=100):
|
||||
|
|
|
|||
Loading…
Reference in a new issue