Merge pull request #3362 from SomberNight/dbb_py3_hid_send

fix: py3 digitalbitbox hid_send
This commit is contained in:
ThomasV 2017-11-23 19:32:39 +01:00 committed by GitHub
commit 355e77b39d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -11,7 +11,7 @@ try:
from electrum.i18n import _
from electrum.keystore import Hardware_KeyStore
from ..hw_wallet import HW_PluginBase
from electrum.util import print_error
from electrum.util import print_error, to_string
import time
import hid
@ -365,6 +365,7 @@ class DigitalBitbox_Client():
r = self.hid_read_frame()
r = r.rstrip(b' \t\r\n\0')
r = r.replace(b"\0", b'')
r = to_string(r, 'utf8')
reply = json.loads(r)
except Exception as e:
print_error('Exception caught ' + str(e))
@ -379,6 +380,7 @@ class DigitalBitbox_Client():
reply = self.hid_send_plain(msg)
if 'ciphertext' in reply:
reply = DecodeAES(secret, ''.join(reply["ciphertext"]))
reply = to_string(reply, 'utf8')
reply = json.loads(reply)
if 'error' in reply:
self.password = None