mirror of https://github.com/tuhiproject/tuhi.git
Add support for long device names
If the device name is longer than one reply, the registration will crash. This adds support for a variable number of replies until the reply ends with `0x0a`.pull/240/head
parent
a0566e0dc0
commit
f5ea08f171
|
@ -651,11 +651,18 @@ class MsgGetName(Msg):
|
||||||
opcode = 0xbb
|
opcode = 0xbb
|
||||||
protocol = ProtocolVersion.ANY
|
protocol = ProtocolVersion.ANY
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
self.name = ""
|
||||||
|
|
||||||
def _handle_reply(self, reply):
|
def _handle_reply(self, reply):
|
||||||
if reply.opcode != 0xbc:
|
if reply.opcode != 0xbc:
|
||||||
raise UnexpectedReply(f'Unknown reply: {reply.opcode}')
|
raise UnexpectedReply(f'Unknown reply: {reply.opcode}')
|
||||||
self.name = bytes(reply).decode('utf-8')
|
self.name += bytes(reply).decode('utf-8')
|
||||||
|
if bytes(reply)[-1] != 0x0a:
|
||||||
|
self.requires_request = False
|
||||||
|
self.execute()
|
||||||
|
self.requires_request = True
|
||||||
|
|
||||||
class MsgGetNameIntuosPro(Msg):
|
class MsgGetNameIntuosPro(Msg):
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in New Issue