Skip to content

Commit

Permalink
Merge pull request schodet#147 from dlech/fix-devsock
Browse files Browse the repository at this point in the history
Fix TypeError when using devsock connection
  • Loading branch information
GoldSloth authored Apr 30, 2018
2 parents e6d2aa1 + b7b573b commit e88d7d8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nxt/devsock.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ def close(self):
def send(self, data):
l0 = len(data) & 0xFF
l1 = (len(data) >> 8) & 0xFF
d = chr(l0) + chr(l1) + data
d = bytes((l0, l1)) + data
self._device.write(d)

def recv(self):
data = self._device.read(2)
l0 = ord(data[0])
l1 = ord(data[1])
l0 = data[0]
l1 = data[1]
plen = l0 + (l1 << 8)
return self._device.read(plen)

Expand Down

0 comments on commit e88d7d8

Please sign in to comment.