Skip to content

Commit

Permalink
Merge pull request schodet#133 from feinstaub/nxtfilemgr1
Browse files Browse the repository at this point in the history
Fixes for nxtfilemgr
  • Loading branch information
GoldSloth authored Apr 30, 2018
2 parents 17a5a29 + bdb5c74 commit baf8490
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion nxt/telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ def add_string(self, n_bytes, v):
self.pkt.write(pack('%ds' % n_bytes, v.encode('windows-1252')))

def add_filename(self, fname):
self.pkt.write(pack('20s', fname.encode('utf-8')))
self.pkt.write(pack('20s', fname.encode('windows-1252')))


def add_s8(self, v):
self.pkt.write(pack('<b', v))
Expand Down
7 changes: 5 additions & 2 deletions scripts/nxtfilemgr
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class NXTListing(Gtk.ListStore):
def populate(self, brick, pattern):
f = FileFinder(brick, pattern)
for (fname_b, size) in f:
fname = fname_b.decode('utf-8')
fname = fname_b.decode('windows-1252')
self.append((fname, str(size)))


Expand Down Expand Up @@ -282,8 +282,11 @@ class NXT_FileMgr(Gtk.Window):
prot_version, fw_version = self.brick.get_firmware_version()
print("Protocol version: %s.%s" % prot_version)
if prot_version == PROTOCOL_VER:
brick_name, brick_hostid, brick_signal_strength, brick_user_flash = self.brick.get_device_info()
brick_name_b, brick_hostid, brick_signal_strength, brick_user_flash = self.brick.get_device_info()
connection_type = str(self.brick.sock)
brick_name_str = brick_name_b.decode('windows-1252')
print("brick_name_b = {0}, brick_name_str = {1}".format(brick_name_b, brick_name_str))

if DEBUG:
print("Brick Info: ", connection_type, brick_name, brick_hostid, brick_signal_strength, fw_version, brick_user_flash)
self.brick_info_str = "%s ==> %s [%s]\tFirmware: v%s.%s\tFreespace: %s" % (connection_type, brick_name, brick_hostid, fw_version[0], fw_version[1], brick_user_flash)
Expand Down

0 comments on commit baf8490

Please sign in to comment.