Minor cleanups.

This commit is contained in:
Kovid Goyal 2007-01-22 19:34:39 +00:00
parent a5e40a9f25
commit 481b12293e
2 changed files with 3 additions and 1 deletions

View File

@ -375,7 +375,7 @@ class PRS500Device(Device):
rsize = size rsize = size
if size % msize: if size % msize:
rsize = size - size % msize + 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: if self.log_packets:
self.log_packet(data, "Answer d->h") self.log_packet(data, "Answer d->h")
return data return data

View File

@ -253,6 +253,8 @@ class DeviceHandle(Structure):
if rsize < 0: if rsize < 0:
raise Error('Could not read ' + str(size) + ' bytes on the '\ raise Error('Could not read ' + str(size) + ' bytes on the '\
'bulk bus. Error code: ' + str(rsize)) 'bulk bus. Error code: ' + str(rsize))
if rsize < size:
arr = arr[:rsize]
return arr return arr
def bulk_write(self, endpoint, bytes, timeout=100): def bulk_write(self, endpoint, bytes, timeout=100):